Giới Hạn Bandwidth Bằng QoS Trên Cisco Router - - VnPro

123

Yêu cầu:

  1. Cấu hình cơ bản trên các thiết bị.
  2. Sử dụng Iperf đo băng thông khả dụng giữa PC1 và PC2.
  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.

Thực hiện: 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. hostname R1 interface f0/0 ip address 172.16.1.1 255.255.255.0 no shutdown exit interface f0/1 ip address 172.16.2.1 255.255.255.0 no shutdown exit line console 0 logging synchronous exec-timeout 0 0 exit no ip domain-lookup Yêu cầu 2. Sử dụng Iperf đo băng thông khả dụng giữa PC1 và PC2. Bật chức năng Iperf Server trên PC2.

1

Bật chức năng Iperf Client trên PC1. C:\iperf > iperf-c 172.16.2.2 -t 10 -i 1

------------------------------------------------------------

Client connecting to 172.16.2.2, TCP port 5001 TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[ 3] local 172.16.1.2 port 2500 connected with 172.16.2.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 1.0 sec 10.4 MBytes 87.0 Mbits/sec

[ 3] 1.0- 2.0 sec 10.1 MBytes 84.9 Mbits/sec

[ 3] 2.0- 3.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 3.0- 4.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 4.0- 5.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 5.0- 6.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 6.0- 7.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 7.0- 8.0 sec 10.1 MBytes 84.9 Mbits/sec

[ 3] 8.0- 9.0 sec 10.2 MBytes 86.0 Mbits/sec

[ 3] 9.0-10.0 sec 10.5 MBytes 88.1 Mbits/sec

[ 3] 0.0-10.0 sec 103 MBytes 85.9 Mbits/sec

C:\iperf>

Kết quả đo được trên Iperf Server với băng thông trung bình đo được là 85.9 Mbits/sec.

2

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.

access-list 100 permit ip 172.16.1.2 0.0.0.0 172.16.2.2 0.0.0.0 class-map 1M

match access-group 100

exit

policy-map shape.1M

class 1M

shape average 1000000

exit

interface f0/1

service-policy output shape.1M

exit

Để kiểm tra, ta tiến hành bật chức năng Iperf Server trên PC2.

3

Tiến hành bật chức năng Iperf Client trên PC1 trỏ về IP của Iperf Server.

C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1

------------------------------------------------------------

Client connecting to 172.16.2.2, TCP port 5001 TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[ 3] local 172.16.1.2 port 2631 connected with 172.16.2.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 1.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 1.0- 2.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 3.0- 4.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 4.0- 5.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 5.0- 6.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 6.0- 7.0 sec 0.00 Bytes 0.00 bits/sec

[ 3] 7.0- 8.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 8.0- 9.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 9.0-10.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 0.0-11.5 sec 1.38 MBytes 1.01 Mbits/sec

C:\iperf>

Kết quả hiển thị tại Iperf Server đo được với tốc độ là 961 Kbits/sec.

4

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.

R1# show int f0/1

FastEthernet0/1 is up, line protocol is up

Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)

Internet address is 172.16.2.1/24

MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

reliability 255/255, txload 1/255, rxload 1/255

Encapsulation ARPA, loopback not set

Keepalive set (10 sec)

Full-duplex, 100Mb/s, 100BaseTX/FX

ARP type: ARPA, ARP Timeout 04:00:00

Last input 00:00:11, output 00:00:02, output hang never

Last clearing of "show interface" counters 00:01:12

Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0

Queueing strategy: fifo

Output queue: 0/40 (size/max)

5 minute input rate 3000 bits/sec, 4 packets/sec

5 minute output rate 72000 bits/sec, 9 packets/sec

762 packets input, 45732 bytes

Received 1 broadcasts, 0 runts, 0 giants, 0 throttles

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

0 watchdog

0 input packets with dribble condition detected

2137 packets output, 2737284 bytes, 0 underruns

0 output errors, 0 collisions, 0 interface resets

--More--

Tính năng shape có thể làm tiêu tốn tài nguyên xử lý trên Router, vì thế ta có thể tận dụng tính năng CIR giúp drop bỏ hoàn toàn các lưu lượng vượt ngưỡng băng thông cho phép.

policy-map shape.1M

class 1M

shape average 1000000

exit

interface f0/1

service-policy output shape.1M

exit

interface f0/1

no service-policy output shape.1M

exit

policy-map shape.1M

class 1M

no shape average 1000000

police cir 1000000

exit

interface f0/1

service-policy output shape.1M

exit

Để kiểm tra, bật chức năng Iperf Server trên PC2.

5

Trên PC1, bật chức năng Iperf Client.

C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1

------------------------------------------------------------

Client connecting to 172.16.2.2, TCP port 5001 TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[ 3] local 172.16.1.2 port 2767 connected with 172.16.2.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 1.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 1.0- 2.0 sec 0.00 Bytes 0.00 bits/sec

[ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 3.0- 4.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 4.0- 5.0 sec 0.00 Bytes 0.00 bits/sec

[ 3] 5.0- 6.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 6.0- 7.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 7.0- 8.0 sec 0.00 Bytes 0.00 bits/sec

[ 3] 8.0- 9.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 9.0-10.0 sec 0.00 Bytes 0.00 bits/sec

[ 3] 0.0-11.7 sec 1.00 MBytes 717 Kbits/sec

C:\iperf>

Kết quả hiển thị tại Iperf Server cho thấy bandwidth đo được là 645 Kbits/sec, tính năng police cir sẽ tiến hành drop bỏ các lưu lượng vượt ngưỡng 1M nên PC1 sẽ phải truyền lại các gói tin bị mất dẫn đến tốc độ sẽ giảm hơn hẳn so với tính năng shape average.

6

Kiểm tra số lượng gói tin đã bị drop bỏ do tính năng police cir.

R1# show interfaces f0/1

FastEthernet0/1 is up, line protocol is up

Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)

Internet address is 172.16.2.1/24

MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

reliability 255/255, txload 1/255, rxload 1/255

Encapsulation ARPA, loopback not set

Keepalive set (10 sec)

Full-duplex, 100Mb/s, 100BaseTX/FX

ARP type: ARPA, ARP Timeout 04:00:00

Last input 00:00:41, output 00:00:08, output hang never

Last clearing of "show interface" counters never

Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 262

Queueing strategy: fifo

Output queue: 0/40 (size/max)

5 minute input rate 0 bits/sec, 0 packets/sec

5 minute output rate 0 bits/sec, 0 packets/sec

39279 packets input, 4159794 bytes

Received 134 broadcasts, 0 runts, 0 giants, 0 throttles

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

0 watchdog

0 input packets with dribble condition detected

110808 packets output, 127564205 bytes, 0 underruns

0 output errors, 0 collisions, 1 interface resets

--More--

R1# clear counters f0/1

Clear "show interface" counters on this interface [confirm]

R1# show int f0/1

FastEthernet0/1 is up, line protocol is up

Hardware is MV96340 Ethernet, address is 0024.c412.04a9 (bia 0024.c412.04a9)

Internet address is 172.16.2.1/24

MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

reliability 255/255, txload 1/255, rxload 1/255

Encapsulation ARPA, loopback not set

Keepalive set (10 sec)

Full-duplex, 100Mb/s, 100BaseTX/FX

ARP type: ARPA, ARP Timeout 04:00:00

Last input 00:00:29, output 00:00:02, output hang never

Last clearing of "show interface" counters 00:00:02

Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0

Queueing strategy: fifo

Output queue: 0/40 (size/max)

5 minute input rate 0 bits/sec, 0 packets/sec

5 minute output rate 0 bits/sec, 0 packets/sec

0 packets input, 0 bytes

Received 0 broadcasts, 0 runts, 0 giants, 0 throttles

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

0 watchdog

0 input packets with dribble condition detected

1 packets output, 60 bytes, 0 underruns

0 output errors, 0 collisions, 0 interface resets

--More--

Ta có thể filter nhiều loại lưu lượng rồi thực thi chính sách QoS bằng cách tạo ra nhiều định nghĩa class-map như sau.

access-list 100 permit ip 172.16.1.2 0.0.0.0 172.16.2.2 0.0.0.0

access-list 101 permit ip 172.16.1.3 0.0.0.0 172.16.2.2 0.0.0.0

class-map 1M

match access-group 100

exit

class-map 2M

match access-group 101

exit

policy-map shape.1M

class 1M

police cir 1000000

exit

class 2M

shape average 2000000

exit

interface f0/1

service-policy output shape.1M

exit

Để kiểm tra, bật chức năng Iperf Server trên PC2.

7

Trên PC1, bật chức năng Iperf Client.

C:\iperf> iperf -c 172.16.2.2 -t 10 -i 1

------------------------------------------------------------

Client connecting to 172.16.2.2, TCP port 5001 TCP window size: 63.0 KByte (default)

------------------------------------------------------------

[ 3] local 172.16.1.3 port 2961 connected with 172.16.2.2 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 1.0 sec 384 KBytes 3.15 Mbits/sec

[ 3] 1.0- 2.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 2.0- 3.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 3.0- 4.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 4.0- 5.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 5.0- 6.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 6.0- 7.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 7.0- 8.0 sec 128 KBytes 1.05 Mbits/sec

[ 3] 8.0- 9.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 9.0-10.0 sec 256 KBytes 2.10 Mbits/sec

[ 3] 0.0-10.7 sec 2.50 MBytes 1.95 Mbits/sec

C:\iperf>

Kết quả hiển thị tại Iperf Server.

8

Thầy Bùi Quốc Kỳ - VnPro

Thông tin khác

  • » Dữ liệu ngày 2/11/2017 (03.11.2017)
  • » Dữ liệu ngày 3/11/2017 (03.11.2017)
  • » Các loại địa chỉ IPv6 đặc biệt và cấu trúc của IPv6 (25.10.2017)
  • » Thiết lập quan hệ láng giềng trong BGP (25.10.2017)
  • » Quá trình roaming layer 3 trong wireless (25.10.2017)
  • » Roaming trong wireless là gì? Quá trình roaming layer 2 xảy ra như thế nào? (24.10.2017)
  • » Địa chỉ Anycast và Multicast trong IPv6 (24.10.2017)
  • » Sơ lược về giao thức định tuyến BGP (24.10.2017)

Từ khóa » Cấu Hình Qos Trên Router Cisco