• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

Policing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Policing

    POLICING


    Mô tả:
    Police là tính năng Qos nhằm đảm bảo traffic không được gởi qua tốc độ được cho phép, khi traffic vào hoặc ra vượt mức tốc độ cho phép bất chấp có xảy ra nghẽn hay không thì traffic sẽ bị drop hoặc thay đổi lại giá trị ưu tiên.
    Policing dùng các khái niệm Bucket, Token… để quyết định loại Traffic là conform, exceed hay Violation.

    Yêu cầu:
    Trong bài thực này yêu cầu đặt ra là sẽ dùng tính năng Police trên mỗi lớp trong CBWFQ. Việc drop gói của lớp này sẽ không ảnh hưởng đến traffic của lớp khác.
    + Nếu tốc độ traffic <= Conform thì cho phép gởi
    + Nếu Conform<tốc độ traffic<Violation thay đổi lại giá tri DSCP
    + Còn lại sẽ bị drop
    Với Police mặc dù lượng traffic nhiều có thể gây mất gói, nhưng đảm bảo cho băng thông dành cho class khác (VoIP) vẫn được dành riêng, dó đó trong trường hợp này chất lượng của cuộc gọi vẫn có thể được đảm bảo.

    Thực hiện
    Cấu hình ban đầu

    Cấu hình ban đầu trên R1:
    R1#sh run
    Building configuration...

    Current configuration : 1311 bytes
    !
    version 12.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname R1
    !
    logging queue-limit 100
    !
    memory-size iomem 10
    ip subnet-zero
    !
    !
    !
    ip cef
    mpls ldp logging neighbor-changes
    !
    !
    no voice hpi capture buffer
    no voice hpi capture destination
    !
    !
    mta receive maximum-recipients 0
    !
    !
    interface Ethernet0/0
    ip address 192.168.0.1 255.255.255.0
    half-duplex
    !
    interface Serial0/0
    ip address 192.168.1.1 255.255.255.0
    !
    no ip http server
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.1.2
    !
    !
    call rsvp-sync
    !
    voice-port 1/1/0
    !
    voice-port 1/1/1
    !
    !
    mgcp profile default
    !
    dial-peer cor custom
    !
    !
    !
    dial-peer voice 1 pots
    destination-pattern 101
    port 1/1/0
    !
    dial-peer voice 2 voip
    destination-pattern 201
    session target ipv4:192.168.2.2
    !
    !
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    no login
    !
    !
    end

    R1#

    Cấu hình ban đầu trên R2:

    R2#sh run
    Building configuration...

    Current configuration : 1717 bytes
    !
    version 12.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname R2
    !
    logging queue-limit 100
    !
    ip subnet-zero
    !
    !
    no ip domain lookup
    ip host R3 192.168.2.2
    ip host R1 192.168.1.1
    !
    ip cef
    mpls ldp logging neighbor-changes
    !
    !
    !
    no voice hpi capture buffer
    no voice hpi capture destination
    !
    !
    mta receive maximum-recipients 0
    !
    !
    interface Ethernet0/0
    ip address 172.16.1.1 255.255.255.0
    half-duplex
    no cdp enable
    !
    interface Serial0/0
    ip address 192.168.1.2 255.255.255.0
    no ip route-cache cef
    no ip mroute-cache
    clockrate 2000000
    no cdp enable
    !
    interface Serial0/1
    bandwidth 128
    ip address 192.168.2.1 255.255.255.0
    load-interval 30
    no cdp enable
    !
    ip http server
    ip classless
    ip route 100.1.1.0 255.255.255.0 192.168.2.2
    ip route 101.1.1.0 255.255.255.0 192.168.2.2
    ip route 192.168.0.0 255.255.255.0 192.168.1.1
    !
    !
    !
    no cdp run
    !
    !
    tftp-server flash:
    call rsvp-sync
    !
    !
    mgcp profile default
    !
    dial-peer cor custom
    !
    !
    !
    !
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    no login
    !
    !
    end

    R2#

    Cấu hình ban đầu trên R3:

    R3#sh run
    Building configuration...

    Current configuration : 1060 bytes
    !
    version 12.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname R3
    !
    !
    ip subnet-zero
    !
    !
    voice call carrier capacity active
    !
    !
    mta receive maximum-recipients 0
    !
    !
    interface Loopback0
    ip address 100.1.1.1 255.255.255.0
    !
    interface Loopback1
    ip address 101.1.1.1 255.255.255.0
    !
    !
    interface Ethernet0/0
    no ip address
    half-duplex
    !
    interface Serial0/0
    ip address 192.168.2.2 255.255.255.0

    !
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.2.1
    ip http server

    !
    call rsvp-sync
    !
    voice-port 1/0/0
    !
    voice-port 1/0/1
    !
    !
    mgcp profile default
    !
    dial-peer cor custom
    !
    dial-peer voice 1 pots
    destination-pattern 201
    port 1/0/0
    !
    dial-peer voice 2 voip
    destination-pattern 101
    session target ipv4:192.168.1.1
    !
    !
    !
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    no login
    !
    !
    end

    R3#

    Các bước thực hiện
    Bước 1: cấu hình đánh dấu lưu lượng trên R1

    Cấu hình ACL chọn các lưu lượng đến 2 đích đến 100.1.1.1 và 101.1.1.1

    access-list 100 permit ip any host 100.1.1.1
    access-list 101 permit ip any host 101.1.1.1

    Cấu hình class-map chọn lưu lượng voip, lưu lượng thỏa ACL 100 và 101

    class-map match-all VoIP
    match ip rtp 16384 16383
    class-map match-all D-100
    match access-group 100
    class-map match-all D-101
    match access-group 101

    Cấu hình policy-map dùng để đánh dấu lưu lượng voip

    policy-map CLASSIFY
    class VoIP
    set dscp ef << đánh dấu lưu lượng voip thành ef
    class D-100
    set dscp af21 << đánh dấu lưu lượng thỏa ACL 100 thành af21
    class D-101
    set dscp af23 << đánh dấu lưu lượng thỏa ACL 101 thành af23

    Áp dụng lên cổng

    interface Serial0/0
    ip address 192.168.1.1 255.255.255.0
    service-policy output CLASSIFY

    Bước 2: cấu hình phân loại lưu lượng dựa trên các giá trị đã đánh dấu và tiến hành police:

    Phân loại lưu lượng dựa trên giá trị đánh dấu:

    class-map match-all VoIP
    match dscp ef
    class-map match-all D-100
    match dscp af21
    class-map match-all D-101
    match dscp af23

    Cấu hình khống chế lưu lượng :
    policy-map TRAFFIC
    class VoIP
    class D-100
    police cir 15000 << khống chế lưu lương này xuống 15 kpbs
    conform-action transmit << lưu lượng tương thích cho phép gửi
    exceed-action set-dscp-transmit af11 << lưu lượng vượt quá nhưng còn trong ngưỡng chấp nhận, đánh dấu lưu lượng xuống af11
    violate-action drop << lưu lượng xâm phạm, loại bỏ
    class D-101
    police cir 15000
    conform-action transmit
    exceed-action set-dscp-transmit af13
    violate-action drop << lưu lượng không tương thích bị loại bỏ
    class class-default
    police cir 32000
    conform-action transmit
    exceed-action set-dscp-transmit default
    violate-action drop

    Áp dụng lên cổng
    interface Serial0/0
    service-policy input TRAFFIC


    Kiểm tra
    Thực hiên lệnh ping từ host A đến 100.1.1.1 và 101.1.1.1 với lượng traffic lớn, kiếm tra thông số trên mỗi lớp, sau đó thực hiên cuộc gọi tứ EX 101 đến EX 201 để kiểm tra chất lượng cuộc gọi.

    R1#sh policy-map interface
    Serial0/0

    Service-policy output: CLASSIFY

    Class-map: VoIP (match-all)
    46020 packets, 2945136 bytes
    5 minute offered rate 0 bps, drop rate 0 bps
    Match: ip rtp 16384 16383
    QoS Set
    dscp ef
    Packets marked 46020

    Class-map: D-100 (match-all)
    4431 packets, 3446592 bytes
    5 minute offered rate 19000 bps, drop rate 0 bps
    Match: access-group 100
    QoS Set
    dscp af21
    Packets marked 4431

    Class-map: D-101 (match-all)
    4402 packets, 3423304 bytes
    5 minute offered rate 19000 bps, drop rate 0 bps
    Match: access-group 101
    QoS Set
    dscp af23
    Packets marked 4402

    Class-map: class-default (match-any)
    29594 packets, 22665156 bytes
    5 minute offered rate 124000 bps, drop rate 0 bps
    Match: any
    R1#

    R2#sh policy-map
    Policy Map TRAFFIC
    Class VoIP
    Class D-100
    police cir 15000 bc 1500 be 1500
    conform-action transmit
    exceed-action set-dscp-transmit af11
    violate-action drop
    Class D-101
    police cir 15000 bc 1500 be 1500
    conform-action transmit
    exceed-action set-dscp-transmit af13
    violate-action drop
    Class class-default
    police cir 32000 bc 1500 be 1500
    conform-action transmit
    exceed-action set-dscp-transmit default
    violate-action drop

    R2#
    R2#sh policy-map interface s0/0
    Serial0/0

    Service-policy input: TRAFFIC

    Class-map: VoIP (match-all)
    21198 packets, 1356547 bytes
    5 minute offered rate 25000 bps
    Match: dscp ef

    Class-map: D-100 (match-all)
    609 packets, 872088 bytes
    5 minute offered rate 14000 bps, drop rate 1000 bps
    Match: dscp af21
    police:
    cir 15000 bps, bc 1500 bytes, be 1500 bytes
    conformed 455 packets, 651560 bytes; actions:
    transmit
    exceeded 71 packets, 101672 bytes; actions:
    set-dscp-transmit af11
    violated 83 packets, 118856 bytes; actions:
    drop
    conformed 11000 bps, exceed 1000 bps, violate 1000 bps

    Class-map: D-101 (match-all)
    475 packets, 680200 bytes
    5 minute offered rate 11000 bps, drop rate 0 bps
    Match: dscp af23
    police:
    cir 15000 bps, bc 1500 bytes, be 1500 bytes
    conformed 454 packets, 650128 bytes; actions:
    transmit
    exceeded 10 packets, 14320 bytes; actions:
    set-dscp-transmit af13
    violated 11 packets, 15752 bytes; actions:
    drop
    conformed 11000 bps, exceed 0 bps, violate 0 bps

    Class-map: class-default (match-any)
    1321 packets, 1619194 bytes
    5 minute offered rate 31000 bps, drop rate 0 bps
    Match: any
    police:
    cir 32000 bps, bc 1500 bytes, be 1500 bytes
    conformed 993 packets, 1199634 bytes; actions:
    transmit
    exceeded 308 packets, 391320 bytes; actions:
    set-dscp-transmit default
    violated 20 packets, 28240 bytes; actions:
    drop
    conformed 23000 bps, exceed 8000 bps, violate 0 bps
    R2#



    Cấu hình cuối cùng
    Cấu hình trên R1:
    R1#sh run
    Building configuration...

    Current configuration : 1311 bytes
    !
    version 12.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname R1
    !
    logging queue-limit 100
    !
    memory-size iomem 10
    ip subnet-zero
    !
    !
    !
    ip cef
    mpls ldp logging neighbor-changes
    !
    !
    no voice hpi capture buffer
    no voice hpi capture destination
    !
    !
    mta receive maximum-recipients 0
    !
    !
    class-map match-all VoIP
    match ip rtp 16384 16383
    class-map match-all D-100
    match access-group 100
    class-map match-all D-101
    match access-group 101
    !
    !
    policy-map CLASSIFY
    class VoIP
    set dscp ef
    class D-100
    set dscp af21
    class D-101
    set dscp af23
    !
    !
    !
    !
    interface Ethernet0/0
    ip address 192.168.0.1 255.255.255.0
    half-duplex
    !
    interface Serial0/0
    ip address 192.168.1.1 255.255.255.0
    service-policy output CLASSIFY
    !
    no ip http server
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.1.2
    !
    !
    !
    access-list 100 permit ip any host 100.1.1.1
    access-list 101 permit ip any host 101.1.1.1
    !
    !
    call rsvp-sync
    !
    voice-port 1/1/0
    !
    voice-port 1/1/1
    !
    !
    mgcp profile default
    !
    dial-peer cor custom
    !
    !
    !
    dial-peer voice 1 pots
    destination-pattern 101
    port 1/1/0
    !
    dial-peer voice 2 voip
    destination-pattern 201
    session target ipv4:192.168.2.2
    !
    !
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    no login
    !
    !
    end

    R1#

    Cấu hình trên R2:

    R2#sh run
    Building configuration...

    Current configuration : 1717 bytes
    !
    version 12.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname R2
    !
    logging queue-limit 100
    !
    ip subnet-zero
    !
    !
    no ip domain lookup
    ip host R3 192.168.2.2
    ip host R1 192.168.1.1
    !
    ip cef
    mpls ldp logging neighbor-changes
    !
    !
    !
    no voice hpi capture buffer
    no voice hpi capture destination
    !
    !
    mta receive maximum-recipients 0
    !
    !
    class-map match-all VoIP
    match dscp ef
    class-map match-all D-100
    match dscp af21
    class-map match-all D-101
    match dscp af23
    !
    !
    policy-map TRAFFIC
    class VoIP
    class D-100
    police cir 15000
    conform-action transmit
    exceed-action set-dscp-transmit af11
    violate-action drop
    class D-101
    police cir 15000
    conform-action transmit
    exceed-action set-dscp-transmit af13
    violate-action drop
    class class-default
    police cir 32000
    conform-action transmit
    exceed-action set-dscp-transmit default
    violate-action drop
    !
    !
    !
    !
    interface Ethernet0/0
    ip address 172.16.1.1 255.255.255.0
    half-duplex
    no cdp enable
    !
    interface Serial0/0
    ip address 192.168.1.2 255.255.255.0
    service-policy input TRAFFIC
    no ip route-cache cef
    no ip mroute-cache
    clockrate 2000000
    no cdp enable
    !
    interface Serial0/1
    bandwidth 128
    ip address 192.168.2.1 255.255.255.0
    load-interval 30
    no cdp enable
    !
    ip http server
    ip classless
    ip route 100.1.1.0 255.255.255.0 192.168.2.2
    ip route 101.1.1.0 255.255.255.0 192.168.2.2
    ip route 192.168.0.0 255.255.255.0 192.168.1.1
    !
    !
    !
    no cdp run
    !
    !
    tftp-server flash:
    call rsvp-sync
    !
    !
    mgcp profile default
    !
    dial-peer cor custom
    !
    !
    !
    !
    line con 0
    line aux 0
    line vty 0 4
    privilege level 15
    no login
    !
    !
    end
    Phạm Minh Tuấn

    Email : phamminhtuan@vnpro.org
    Yahoo : phamminhtuan_vnpro
    -----------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog
Working...
X