0887 371 498 support@itservice-bg.net
11.07.2015 · Самуил Арсов · Cisco, Рутери

Cisco QOS per ip address

cisco_banner

configure upload on ip address 192.168.1.2

c1841>en
c1841#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
c1841(config)#ip access-list extended USER1-UP
c1841(config-ext-nacl)#permit ip host 192.168.1.2 any
c1841(config-ext-nacl)#exit
c1841(config)#class-map match-any USER1-DOWN
c1841(config-cmap)#match access-group name USER1-DOWN
c1841(config-cmap)#exit
c1841(config)#policy-map UP
c1841(config-pmap)#class USER1-UP
c1841(config-pmap-c)#police 10485760
c1841(config-pmap-c-police)#exit
c1841(config-pmap-c)#exit
c1841(config-pmap)#exit
c1841(config)#interface fastEthernet 0/0
c1841(config-if)#service-policy input UP
c1841(config-if)#end
c1841#wr
Building configuration...
[OK]

configure download on ip address 192.168.1.2

c1841>en
c1841#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
c1841(config)#ip access-list extended USER1-DOWN
c1841(config-ext-nacl)#permit ip any host 192.168.1.2
c1841(config-ext-nacl)#exit
c1841(config)#class-map match-any USER1-DOWN
c1841(config-cmap)#match access-group name USER1-DOWN
c1841(config-cmap)#exit
c1841(config)#policy-map DOWN
c1841(config-pmap)#class USER1-DOWN
c1841(config-pmap-c)#police 10485760
c1841(config-pmap-c-police)#exit
c1841(config-pmap-c)#exit
c1841(config-pmap)#exit
c1841(config)#interface fastEthernet 0/0
c1841(config-if)#service-policy output DOWN
c1841(config-if)#end
c1841#wr
Building configuration...
[OK]

show config

!         
ip access-list extended USER1-DOWN
 permit ip any host 192.168.1.2
ip access-list extended USER1-UP
 permit ip host 192.168.1.2 any
!                
!         
class-map match-any USER1-UP
 match access-group name USER1-UP
class-map match-any USER1-DOWN
 match access-group name USER1-DOWN
!         
!         
policy-map UP
 class USER1-UP
    police 10485500
policy-map DOWN
 class USER1-DOWN
    police 10485500
!         
!
interface FastEthernet0/0
 service-policy input UP
 service-policy output DOWN
!         

check with speedtest

cisco-qos1

check traffic

c1841#show policy-map interface fastEthernet 0/0
 FastEthernet0/0 

  Service-policy input: UP

    Class-map: USER1-UP (match-any)
      1487085 packets, 401300162 bytes
      5 minute offered rate 876000 bps, drop rate 0 bps
      Match: access-group name USER1-UP
        1487085 packets, 401300224 bytes
        5 minute rate 876000 bps
      police:
          cir 10485500 bps, bc 327671 bytes
        conformed 1394574 packets, 350424524 bytes; actions:
          transmit 
        exceeded 12365 packets, 18705602 bytes; actions:
          drop 
        conformed 876000 bps, exceed 0 bps

    Class-map: class-default (match-any)
      6 packets, 2052 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: any 

  Service-policy output: DOWN

    Class-map: USER1-DOWN (match-any)
      2018716 packets, 2609749304 bytes
      5 minute offered rate 12006000 bps, drop rate 1582000 bps
      Match: access-group name USER1-DOWN
        2018716 packets, 2609749304 bytes
        5 minute rate 12006000 bps
      police:
          cir 10485500 bps, bc 327671 bytes
        conformed 1833634 packets, 2360392184 bytes; actions:
          transmit 
        exceeded 185082 packets, 249357120 bytes; actions:
          drop 
        conformed 10439000 bps, exceed 1582000 bps

    Class-map: class-default (match-any)
      516 packets, 53416 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: any 

extended configuration

!         
ip access-list extended USER1-DOWN
 permit ip any host 192.168.1.2
ip access-list extended USER1-UP
 permit ip host 192.168.1.2 any
ip access-list extended USER2-DOWN
 permit ip any host 192.168.1.3
ip access-list extended USER2-UP
 permit ip host 192.168.1.3 any
ip access-list extended USER3-DOWN
 permit ip any host 192.168.1.4
ip access-list extended USER3-UP
 permit ip host 192.168.1.4 any
!
class-map match-any USER1-UP
 match access-group name USER1-UP
class-map match-any USER2-UP
 match access-group name USER2-UP
class-map match-any USER3-UP
 match access-group name USER3-UP
class-map match-any USER1-DOWN
 match access-group name USER1-DOWN
class-map match-any USER2-DOWN
 match access-group name USER2-DOWN
class-map match-any USER3-DOWN
 match access-group name USER3-DOWN
!         
!         
policy-map UP
 class USER1-UP
    police 10485500
 class USER2-UP
    police 10485500
 class USER3-UP
    police 10485500
policy-map DOWN
 class USER1-DOWN
    police 10485500
 class USER2-DOWN
    police 10485500
 class USER3-DOWN
    police 10485500
!         

megabits = bits

1Mbits = 1048576
2Mbits = 2097152
3Mbits = 3145728
4Mbits = 4194304
5Mbits = 5242880
6Mbits = 6291456
8Mbits = 8388608
10Mbits = 10485760
12Mbits = 12582912
15Mbits = 15728640
20Mbits = 20971520
25Mbits = 26214400
30Mbits = 31457280
40Mbits = 41943040
50Mbits = 52428800
60Mbits = 62914560
70Mbits = 73400320
80Mbits = 83886080
90Mbits = 94371840
100Mbits = 104857600