交換機中line-rate用於端口限速,主要用於出端口上;traffic-limit用於流限速,主要用於入端口上。由於其實現機制原因可能導致一些軟件測速工具(如ftp和chariot等)測試交換機traffic-limit時數據不準確,而測試line-rate比較準確。
這是由於這些軟件工具測試的都是有效數據流的吞吐量。在交換機內部,
line-rate是端口的出流量限制,有芯片內報文緩存,可以讓流量穩定在設置的值,沒有丟包,所以不會重傳。traffic-limit是端口入流量限制,沒有芯片內的報文緩存,一旦暴發流量超過限制,直接丟包,這樣,基於TCP連接的應用就會重傳,導致效率降低較多,從而從下載工具上看到得最終下載速率低於限速值。
一般在測試端口的限速是否準確時,都使用Smartbits、IXIA等專用測試儀器,排除重傳干擾。
下面我們以traffic-limit對流量監管。
案例:對交換機eth0/10的流量進行監管。
拓撲圖:
正常情況時:
配置:
[Quidway]dis cu
vlan 1
#
vlan 10
#
vlan 20
#
interface Vlan-interface1
#
interface Vlan-interface10
ip address 192.168.10.254 255.255.255.0
#
interface Vlan-interface20
ip address 192.168.20.254 255.255.255.0
#
i
interface Ethernet0/10
port access vlan 10
interface Ethernet0/20
port access vlan 20
測試:
監管時,
配置:
[Quidway]dis cu
acl number 3000
rule 10 permit ip
#
vlan 1
#
vlan 10
#
vlan 20
#
interface Vlan-interface1
#
interface Vlan-interface10
ip address 192.168.10.254 255.255.255.0
#
interface Vlan-interface20
ip address 192.168.20.254 255.255.255.0
#
interface Ethernet0/10
port access vlan 10
traffic-limit inbound ip-group 3000 rule 10 1
#
interface Ethernet0/20
port access vlan 20
測試:
端口鏡像就是將一個端口或多個端口的數據複製到一個端口。
案例:由於ftp是以明文方式傳遞信息的,所以,我們要對ftp進行監控。
拓撲圖:
配置:
<Quidway>dis cu
acl number 3000
rule 10 permit tcp destination-port eq ftp #配置防控列表對ftp進行監聽
#
vlan 1
#
vlan 10
#
vlan 20
#
vlan 30
interface Vlan-interface10
ip address 192.168.10.254 255.255.255.0
#
interface Vlan-interface20
ip address 192.168.20.254 255.255.255.0
#
interface Vlan-interface30
ip address 192.168.30.254 255.255.255.0
#
interface Ethernet0/10
port access vlan 10
#
interface Ethernet0/20
port access vlan 20
#
packet-filter ip-group 3000 rule 10
interface Ethernet0/24
port access vlan 30
mirrored-to ip-group 3000 rule 10 interface Ethernet0/10 #將鏡像數據發往eth0/10
測試:
在pc1上用抓包工具抓取數據報
tshark -ni eth0 -R “tcp.port eq 21”
能夠監聽到不同網段的訪問,並且能夠抓取用戶名和密碼。