root

Leader IT/Architect
Dec 31, 2012
1,153
72
48

Lab Configure qos policing on cisco asa


I. Mô hình và yêu cầu
1. Mô hình Lab Configure qos policing on cisco asa


Configure qos policing on cisco asa (1)

2. Yêu cầu
- Thiết lập thiết bị theo sơ đồ
- Cấu hình Routing và NAT trên ROuter và ASA cho phép client ra internet thành công
- Cấu hình QoS dạng

  • Policing: với ICMP, Telnet, Http
  • Shaping
- Sơ đồ IP

Configure qos policing on cisco asa (2)

II. Triển khai Lab Configure qos policing on cisco asa


1. Trên Router R1
- Thực hiện đặt IP, telnet và định tuyến cho mạng Lan, nat overload bên trong ra internet.

Code:
R1(config-if)#int f0/0
R1(config-if)#ip address dhcp
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 172.16.16.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#ip route 192.168.10.0 255.255.255.0 172.16.16.1

R1(config)#access-list 1 permit any
R1(config)#ip nat inside source list 1 interface f0/0 overload
R1(config)#int f0/0
R1(config-if)#ip nat outside
R1(config-if)#int f0/1
R1(config-if)#ip nat inside

R1(config)#line vty 0 4
R1(config-line)#privilege level 15
R1(config-line)#no login
- Đảm bảo Router R1 ping ra internet thành công.

R1(config)#do ping 8.8.8.8


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
.!!!!
2. Cấu hình Router R2.

Code:
R2(config-if)#int f0/0
R2(config-if)#ip address 192.168.10.11 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.1
3. Cấu hình trên Cisco ASA.
- Cấu hình IP, trỏ default-route về Router R1.

Code:
ciscoasa(config-if)# interface g0
ciscoasa(config-if)# nameif outside
ciscoasa(config-if)# ip address 172.16.16.1 255.255.255.0
ciscoasa(config-if)# no shutdown

ciscoasa(config-if)# int g1
ciscoasa(config-if)# nameif inside
ciscoasa(config-if)# ip address 192.168.10.1 255.255.255.0
ciscoasa(config-if)# no shutdown

ciscoasa(config)# route outside 0 0 172.16.16.254
- Đảm bảo ASA đi internet thành công.

ciscoasa(config)# ping 8.8.8.8

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 70/94/130 ms

4. Cấu hình QoS Policing on Cisco ASA


- Tạo các class-map cho các protocol ICMP, Telnet, Http.

Code:
ciscoasa(config)# access-list ICMP extended permit icmp any any
ciscoasa(config)# class-map ICMP
ciscoasa(config-cmap)# match access-list ICMP

ciscoasa(config)# class-map TELNET
ciscoasa(config-cmap)# match port tcp eq 23

ciscoasa(config-cmap)# class-map HTTP
ciscoasa(config-cmap)# match port tcp eq 80
- Đưa các class-map vào policy-map để thực hiện các chính sách về QoS với traffic bình quân là 8000 bits/giây và kích thước truyền tối đa là 1000 bytes per second.

Code:
ciscoasa(config)# policy-map QOS
ciscoasa(config-pmap)# class TELNET
ciscoasa(config-pmap-c)# police input 8000 1000 conform-action transmit exceed-action drop

ciscoasa(config-pmap-c)# class ICMP
ciscoasa(config-pmap-c)# police input 8000 1000 conform-action transmit exceed-action drop

ciscoasa(config-pmap-c)# class HTTP
ciscoasa(config-pmap-c)# police input 8000 1000 conform-action transmit exceed-action drop
- Trước khi áp policy này lên interface các bạn thử dùng R2 ping và PC ra internet. Các bạn sẽ thấy R2 ping không rớt gói nào, PC truy cập trang svuit.com bình thường.

R2#ping 8.8.8.8 re 100


Type escape sequence to abort.
Sending 100, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (100/100), round-trip min/avg/max = 52/72/104 ms
- Bây giờ các bạn thực hiện áp policy này interface inside của ASA.

Code:
ciscoasa(config-priority-queue)# service-policy QOS interface inside

- Bây giờ các bạn dùng R2 ping ra internet thấy R2 đã bị rớt 5 gói.

R2#ping 8.8.8.8 re 100


Type escape sequence to abort.
Sending 100, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!.
!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!
Success rate is 95 percent (95/100), round-trip min/avg/max = 56/70/108 ms
- Qua ASA show hàng thì thấy nó drop mất 5 gói icmp của thằng R2
ciscoasa(config-pmap-c)# sh service-policy


Interface inside:
Service-policy: QOS
Class-map: ICMP
Inspect: icmp, packet 568, drop 0, reset-drop 0
Input police Interface inside:
cir 8000 bps, bc 1000 bytes
conformed 158 packets, 17252 bytes; actions: transmit
exceeded 5 packets, 554 bytes; actions: drop
conformed 0 bps, exceed 0 bps

- Giờ bạn dùng PC truy cập trang svuit.com lai thì thấy nó hiện thị không đầy đủ ( nhớ xóa cache trước khi truy cập.

Configure qos policing on cisco asa (3)

- Nguyên nhân là thằng ASA nó thẳng tay drop mất vài gói TCP của PC.

ciscoasa(config-pmap-c)# sh service-policy


Interface inside:
Service-policy: QOS
Class-map: ICMP
Inspect: icmp, packet 568, drop 0, reset-drop 0
Input police Interface inside:
cir 8000 bps, bc 1000 bytes
conformed 158 packets, 17252 bytes; actions: transmit
exceeded 5 packets, 554 bytes; actions: drop
conformed 0 bps, exceed 0 bps

Class-map: HTTP
Input police Interface inside:
cir 8000 bps, bc 1000 bytes
conformed 223 packets, 27722 bytes; actions: transmit
exceeded 124 packets, 24638 bytes; actions: drop
conformed 24 bps, exceed 16 bps
 
Last edited:

5. Cấu hình QoS Shaping on Cisco ASA


- Bỏ mấy cái Policing HTTP ở trên đi nhé và cấu hình shaping với đường truyền là 512kbps.

Code:
ciscoasa(config)# policy-map QOS
ciscoasa(config-pmap)# class-map HTTP
ciscoasa(config-pmap-c)# no police input 8000 1000

ciscoasa(config-pmap)# class class-default
ciscoasa(config-pmap-c)# shape average 512000
- Giờ các bạn dùng client truy cập lại trang svuit.com xem thế nào (xóa cache đi nhé)
Bạn sẽ thấy mặc dù truy cập vào svuit.com có chậm nhưng mà nó không bị mât hình hay vài thứ linh tinh như cái hình ở trên khi mình dùng Policing.

Configure qos policing on cisco asa (5)


- Show trên ASA các bạn sẽ thấy, nó không có drop gói nào của client. Chỉ là nó thiết lập 1 cái hàng đợi rồi làm client truy cập chậm 1 tý thôi, không như thằng Policing là thẳng tay drop mà không có truyền lại :)
ciscoasa(config-pmap-c)# sh service-policy


Interface inside:
Service-policy: QOS
Class-map: ICMP
Inspect: icmp, packet 568, drop 0, reset-drop 0
Input police Interface inside:
cir 8000 bps, bc 1000 bytes
conformed 158 packets, 17252 bytes; actions: transmit
exceeded 5 packets, 554 bytes; actions: drop
conformed 0 bps, exceed 0 bps
Class-map: class-default


shape (average) cir 512000, bc 2048
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 1398/1465177
 
Last edited:

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu