Yêu cầu:
- Cấu hình cơ bản trên các thiết bị.
- Sử dụng Iperf đo băng thông khả dụng giữa PC1 và PC2.
- Cấu hình QoS trên R1 giới hạn băng thông giữa PC1 và PC2 xuống còn 1M.
Yêu cầu 1. Cấu hình cơ bản trên các thiết bị.
Cấu hình trên R1.
Code:
[B]hostname R1[/B] [B]interface f0/0[/B] [B] ip address 172.16.1.1 255.255.255.0[/B] [B] no shutdown[/B] [B] exit[/B] [B]interface f0/1[/B] [B] ip address 172.16.2.1 255.255.255.0[/B] [B] no shutdown[/B] [B] exit[/B] [B]line console 0[/B] [B] logging synchronous[/B] [B] exec-timeout 0 0[/B] [B] exit[/B] [B]no ip domain-lookup[/B]
Bật chức năng Iperf Server trên PC2.
Bật chức năng Iperf Client trên PC1.
Code:
[B]C:\iperf > iperf-c 172.16.2.2 -t 10 -i 1[/B] [B]------------------------------------------------------------[/B] [B]Client connecting to 172.16.2.2, TCP port 5001[/B] [B]TCP window size: 63.0 KByte (default)[/B] [B]------------------------------------------------------------[/B] [B][ 3] local 172.16.1.2 port 2500 connected with 172.16.2.2 port 5001[/B] [B][ ID] Interval Transfer Bandwidth[/B] [B][ 3] 0.0- 1.0 sec 10.4 MBytes 87.0 Mbits/sec[/B] [B][ 3] 1.0- 2.0 sec 10.1 MBytes 84.9 Mbits/sec[/B] [B][ 3] 2.0- 3.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 3.0- 4.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 4.0- 5.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 5.0- 6.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 6.0- 7.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 7.0- 8.0 sec 10.1 MBytes 84.9 Mbits/sec[/B] [B][ 3] 8.0- 9.0 sec 10.2 MBytes 86.0 Mbits/sec[/B] [B][ 3] 9.0-10.0 sec 10.5 MBytes 88.1 Mbits/sec[/B] [B][ 3] 0.0-10.0 sec 103 MBytes 85.9 Mbits/sec[/B] [B]C:\iperf>[/B]
Yêu cầu 3. Cấu hình QoS trên R1 giới hạn băng thông giữa PC1 và PC2 xuống còn 1M.
- shape average 1000000: đảm bảo tốc độ không vượt quá 1M, các gói tin vượt ngưỡng 1M sẽ được lưu trữ tạm thời vào bộ lưu trữ cache trên Router.
Code:
[B]access-list 100 permit ip 172.16.1.2 0.0.0.0 172.16.2.2 0.0.0.0[/B] [B]class-map 1M[/B] [B]match access-group 100[/B] [B]exit[/B] [B]policy-map shape.1M[/B] [B]class 1M[/B] [B]shape average 1000000[/B] [B]exit[/B] [B]interface f0/1[/B] [B] service-policy output shape.1M[/B] [B] exit[/B]
Tiến hành bật chức năng Iperf Client trên PC1 trỏ về IP của Iperf Server.
Code:
[B]C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1[/B] [B]------------------------------------------------------------[/B] [B]Client connecting to 172.16.2.2, TCP port 5001[/B] [B]TCP window size: 63.0 KByte (default)[/B] [B]------------------------------------------------------------[/B] [B][ 3] local 172.16.1.2 port 2631 connected with 172.16.2.2 port 5001[/B] [B][ ID] Interval Transfer Bandwidth[/B] [B][ 3] 0.0- 1.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 1.0- 2.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 3.0- 4.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 4.0- 5.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 5.0- 6.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 6.0- 7.0 sec 0.00 Bytes 0.00 bits/sec[/B] [B][ 3] 7.0- 8.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 8.0- 9.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 9.0-10.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 0.0-11.5 sec 1.38 MBytes 1.01 Mbits/sec[/B] [B]C:\iperf>[/B]
Với tính năng shape average, các packet không hề bị drop bỏ mà sẽ được lưu trữ tạm tại bộ nhớ cache trên Router.
Code:
[B]R1# show int f0/1[/B] [B]FastEthernet0/1 is up, line protocol is up[/B] [B] Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)[/B] [B] Internet address is 172.16.2.1/24[/B] [B] MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, [/B] [B] reliability 255/255, txload 1/255, rxload 1/255[/B] [B] Encapsulation ARPA, loopback not set[/B] [B] Keepalive set (10 sec)[/B] [B] Full-duplex, 100Mb/s, 100BaseTX/FX[/B] [B] ARP type: ARPA, ARP Timeout 04:00:00[/B] [B] Last input 00:00:11, output 00:00:02, output hang never[/B] [B] Last clearing of "show interface" counters 00:01:12[/B] [B] Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0[/B] [B] Queueing strategy: fifo[/B] [B] Output queue: 0/40 (size/max)[/B] [B] 5 minute input rate 3000 bits/sec, 4 packets/sec[/B] [B] 5 minute output rate 72000 bits/sec, 9 packets/sec[/B] [B] 762 packets input, 45732 bytes[/B] [B] Received 1 broadcasts, 0 runts, 0 giants, 0 throttles[/B] [B] 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored[/B] [B] 0 watchdog[/B] [B] 0 input packets with dribble condition detected[/B] [B] 2137 packets output, 2737284 bytes, 0 underruns[/B] [B] 0 output errors, 0 collisions, 0 interface resets[/B] [B]--More--[/B]
Code:
[B]policy-map shape.1M[/B] [B]class 1M[/B] [B] shape average 1000000[/B] [B]exit[/B] [B]interface f0/1[/B] [B] service-policy output shape.1M[/B] [B] exit[/B] [B]interface f0/1[/B] [B] no service-policy output shape.1M[/B] [B] exit[/B] [B]policy-map shape.1M[/B] [B] class 1M[/B] [B] no shape average 1000000[/B] [B] police cir 1000000[/B] [B] exit[/B] [B]interface f0/1[/B] [B] service-policy output shape.1M[/B] [B] exit[/B]
Trên PC1, bật chức năng Iperf Client.
Code:
[B]C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1[/B] [B]------------------------------------------------------------[/B] [B]Client connecting to 172.16.2.2, TCP port 5001[/B] [B]TCP window size: 63.0 KByte (default)[/B] [B]------------------------------------------------------------[/B] [B][ 3] local 172.16.1.2 port 2767 connected with 172.16.2.2 port 5001[/B] [B][ ID] Interval Transfer Bandwidth[/B] [B][ 3] 0.0- 1.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 1.0- 2.0 sec 0.00 Bytes 0.00 bits/sec[/B] [B][ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 3.0- 4.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 4.0- 5.0 sec 0.00 Bytes 0.00 bits/sec[/B] [B][ 3] 5.0- 6.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 6.0- 7.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 7.0- 8.0 sec 0.00 Bytes 0.00 bits/sec[/B] [B][ 3] 8.0- 9.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 9.0-10.0 sec 0.00 Bytes 0.00 bits/sec[/B] [B][ 3] 0.0-11.7 sec 1.00 MBytes 717 Kbits/sec[/B] [B]C:\iperf>[/B]
Kiểm tra số lượng gói tin đã bị drop bỏ do tính năng police cir.
Code:
[B]R1# show interfaces f0/1[/B] [B] FastEthernet0/1 is up, line protocol is up[/B] [B] Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)[/B] [B] Internet address is 172.16.2.1/24[/B] [B] MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, [/B] [B] reliability 255/255, txload 1/255, rxload 1/255[/B] [B] Encapsulation ARPA, loopback not set[/B] [B] Keepalive set (10 sec)[/B] [B] Full-duplex, 100Mb/s, 100BaseTX/FX[/B] [B] ARP type: ARPA, ARP Timeout 04:00:00[/B] [B] Last input 00:00:41, output 00:00:08, output hang never[/B] [B] Last clearing of "show interface" counters never[/B] [B] Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 262[/B] [B] Queueing strategy: fifo[/B] [B] Output queue: 0/40 (size/max)[/B] [B] 5 minute input rate 0 bits/sec, 0 packets/sec[/B] [B] 5 minute output rate 0 bits/sec, 0 packets/sec[/B] [B] 39279 packets input, 4159794 bytes[/B] [B] Received 134 broadcasts, 0 runts, 0 giants, 0 throttles[/B] [B] 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored[/B] [B] 0 watchdog[/B] [B] 0 input packets with dribble condition detected[/B] [B] 110808 packets output, 127564205 bytes, 0 underruns[/B] [B] 0 output errors, 0 collisions, 1 interface resets[/B] [B]--More--[/B]
Code:
[B]R1# clear counters f0/1[/B] [B]Clear "show interface" counters on this interface [confirm][/B] [B]R1# show int f0/1[/B] [B]FastEthernet0/1 is up, line protocol is up[/B] [B] Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)[/B] [B] Internet address is 172.16.2.1/24[/B] [B] MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, [/B] [B] reliability 255/255, txload 1/255, rxload 1/255[/B] [B] Encapsulation ARPA, loopback not set[/B] [B] Keepalive set (10 sec)[/B] [B] Full-duplex, 100Mb/s, 100BaseTX/FX[/B] [B] ARP type: ARPA, ARP Timeout 04:00:00[/B] [B] Last input 00:00:29, output 00:00:02, output hang never[/B] [B]Last clearing of "show interface" counters 00:00:02[/B] [B]Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0[/B] [B]Queueing strategy: fifo[/B] [B]Output queue: 0/40 (size/max)[/B] [B]5 minute input rate 0 bits/sec, 0 packets/sec[/B] [B]5 minute output rate 0 bits/sec, 0 packets/sec[/B] [B]0 packets input, 0 bytes[/B] [B]Received 0 broadcasts, 0 runts, 0 giants, 0 throttles[/B] [B]0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored[/B] [B]0 watchdog[/B] [B]0 input packets with dribble condition detected[/B] [B]1 packets output, 60 bytes, 0 underruns[/B] [B]0 output errors, 0 collisions, 0 interface resets[/B] [B] --More--[/B]
Code:
[B]access-list 100 permit ip 172.16.1.2 0.0.0.0 172.16.2.2 0.0.0.0[/B] [B]access-list 101 permit ip 172.16.1.3 0.0.0.0 172.16.2.2 0.0.0.0[/B] [B]class-map 1M[/B] [B] match access-group 100[/B] [B] exit[/B] [B]class-map 2M[/B] [B] match access-group 101[/B] [B] exit[/B] [B]policy-map shape.1M[/B] [B] class 1M[/B] [B] police cir 1000000[/B] [B] exit[/B] [B] class 2M[/B] [B] shape average 2000000[/B] [B] exit[/B] [B]interface f0/1[/B] [B] service-policy output shape.1M[/B] [B] exit[/B]
Trên PC1, bật chức năng Iperf Client.
Code:
[B]C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1[/B] [B]------------------------------------------------------------[/B] [B]Client connecting to 172.16.2.2, TCP port 5001[/B] [B]TCP window size: 63.0 KByte (default)[/B] [B]------------------------------------------------------------[/B] [B][ 3] local 172.16.1.3 port 2961 connected with 172.16.2.2 port 5001[/B] [B][ ID] Interval Transfer Bandwidth[/B] [B][ 3] 0.0- 1.0 sec 384 KBytes 3.15 Mbits/sec[/B] [B][ 3] 1.0- 2.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 3.0- 4.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 4.0- 5.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 5.0- 6.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 6.0- 7.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 7.0- 8.0 sec 128 KBytes 1.05 Mbits/sec[/B] [B][ 3] 8.0- 9.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 9.0-10.0 sec 256 KBytes 2.10 Mbits/sec[/B] [B][ 3] 0.0-10.7 sec 2.50 MBytes 1.95 Mbits/sec[/B] [B]C:\iperf>[/B]
Nguồn: VnPro