DynagenでCCIEを目指す
Policing
最終更新:
it_certification
-
view
1. 目的
- Policingの設定について確認します。
2. 構成
2.1. 設定概要
- Host OS側でApacheを起動させます。
- R1, R2間はframe-relayで接続します。
- R1, R2はOSPFでルーティングします。
2.2. 構成図

2.3. netファイル
model = 3620 [localhost] [[3620]] image = C:\Program Files\Dynamips\images\c3620-j1s3-mz.123-18.bin ram = 128 [[ROUTER R1]] f1/0 = NIO_gen_eth:\Device\NPF_{8B89D910-5ED3-4A43-9DE9-6A272A3D7592} s0/0 = SW 0 [[FRSW SW]] 0:100 = 1:100 [[ROUTER R2]] f1/0 = NIO_gen_eth:\Device\NPF_{5933302A-7AAA-475C-A8FE-A6B82B0C0F98} s0/0 = SW 1
2.4. 初期設定
- R1
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Serial0/0 ip address 192.168.1.1 255.255.255.0 encapsulation frame-relay ip ospf network broadcast serial restart-delay 0 frame-relay map ip 192.168.1.2 100 broadcast ! interface Serial0/1 no ip address shutdown serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface FastEthernet1/0 ip address 192.168.200.1 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface Serial0/0 network 192.168.1.1 0.0.0.0 area 0 network 192.168.200.1 0.0.0.0 area 0 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- R2
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Serial0/0 ip address 192.168.1.2 255.255.255.0 encapsulation frame-relay ip ospf network broadcast serial restart-delay 0 frame-relay map ip 192.168.1.1 100 broadcast ! interface Serial0/1 no ip address shutdown serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address shutdown serial restart-delay 0 ! interface FastEthernet1/0 ip address 192.168.201.2 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface Serial0/0 network 192.168.1.2 0.0.0.0 area 0 network 192.168.201.2 0.0.0.0 area 0 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
2.5. サーバ側 ルーティング設定
- Host OS
route add 192.168.201.0 mask 255.255.255.0 192.168.200.1
- Guest OS
route add -net 192.168.200.0/24 gw 192.168.201.2
3. [検証] One Token Bucket
3.1. 設定投入
R1 s0/0において、shapingを行う設定を投入します。
R1(config)#policy-map POLICY_S00_OUT R1(config-pmap)#class class-default R1(config-pmap-c)#police 20000 R1(config-pmap-c-police)#conform-action transmit R1(config-pmap-c-police)#exit R1(config-pmap-c)#exit R1(config-pmap)#exit R1(config)# R1(config)# R1(config)#interface Serial 0/0 R1(config-if)#service-policy output POLICY_S00_OUT R1(config-if)#exit R1(config)#^Z
3.2. 送信速度の確認
Guest OS上で、以下のwgetコマンドを実行します。帯域が2Kbpsに抑えられている事を確認します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-11-29 12:03:33-- http://192.168.200.100:10880/large.html Connecting to 192.168.200.100:10880... connected. HTTP request sent, awaiting response... 200 OK Length: 23016000 (22M) [text/html] Saving to: `/dev/null' 0% [ ] 55,761 1.93K/s eta 3h 30m
4. [検証] Two Token Bucket
4.1. 設定投入
2段階のshapingの設定をRa s0/0に投入します。
CARと異なり、複数のアクションを定義する事ができます。以下の例は、exceed-actionとして、ip precedence 1をマークするだけでなく、DB bitを付加する処理を実施します。
また、violate-actionを定義できるのもCARとの違いです。
CARと異なり、複数のアクションを定義する事ができます。以下の例は、exceed-actionとして、ip precedence 1をマークするだけでなく、DB bitを付加する処理を実施します。
また、violate-actionを定義できるのもCARとの違いです。
R1(config)#policy-map POLICY_S00_OUT R1(config-pmap)#class class-default R1(config-pmap-c)#police 20000 2000 1000 R1(config-pmap-c-police)#conform-action transmit R1(config-pmap-c-police)#exceed-action set-prec-transmit 1 R1(config-pmap-c-police)#exceed-action set-frde-transmit R1(config-pmap-c-police)#violate-action drop
4.2. 送信速度の確認
Guest OS上で、以下のwgetコマンドを実行します。2Kbps以上の速度がでている事を確認します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-11-29 12:03:33-- http://192.168.200.100:10880/large.html Connecting to 192.168.200.100:10880... connected. HTTP request sent, awaiting response... 200 OK Length: 23016000 (22M) [text/html] Saving to: `/dev/null' 5% [=> ] 1,283,436 2.29K/s eta 91m 13s
4.3. 設定確認
show policy-map interfaceコマンドで、policingの設定を確認します。また、conformed, exceeded, violatedの各アクションが実施されたパケット数も確認する事ができます。
R1#show policy-map interface Serial 0/0 Serial0/0 Service-policy output: POLICY_S00_OUT Class-map: class-default (match-any) 3979 packets, 2245536 bytes 5 minute offered rate 33000 bps, drop rate 12000 bps Match: any police: cir 20000 bps, bc 2000 bytes, be 1000 bytes conformed 1623 packets, 924346 bytes; actions: transmit exceeded 1966 packets, 1135886 bytes; actions: set-prec-transmit 1 set-frde-transmit violated 317 packets, 183732 bytes; actions: drop conformed 20000 bps, exceed 13000 bps, violate 12000 bps R1#
show frame-relay pvcにより、DE bitが付加されたパケットが送信された事を確認します。
R1#show frame-relay pvc PVC Statistics for interface Serial0/0 (Frame Relay DTE) Active Inactive Deleted Static Local 1 0 0 0 Switched 0 0 0 0 Unused 0 0 0 0 DLCI = 100, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0/0 input pkts 2261 output pkts 2919 in bytes 131292 out bytes 1650922 dropped pkts 0 in pkts dropped 0 out pkts dropped 0 out bytes dropped 0 in FECN pkts 0 in BECN pkts 0 out FECN pkts 0 out BECN pkts 0 in DE pkts 0 out DE pkts 426 <- DE bitが付加されたパケット数 out bcast pkts 20 out bcast bytes 1280 5 minute input rate 1000 bits/sec, 3 packets/sec 5 minute output rate 18000 bits/sec, 4 packets/sec pvc create time 00:18:08, last time pvc status changed 00:18:08 R1#
4.4. パケットキャプチャによる確認
パケットキャプチャにより、ip precedenceが1であり、DE bitが付加されたパケットが存在する事を確認します。
以下はR2 s0/0でキャプチャを実施した結果です。
以下はR2 s0/0でキャプチャを実施した結果です。
#ref error :ご指定のファイルが見つかりません。ファイル名を確認して、再度指定してください。 (100%)
;
添付ファイル