DynagenでCCIEを目指す
Class-Based Weighted Fair Queueing
最終更新:
it_certification
-
view
1. 目的
- CBWFQの設定について確認します。
2. 構成
2.1. 設定概要
- Host OS側でApacheを起動させます。
- Guest OS, R1間は10Mで接続する事で、わざと輻輳を発生させます。
- 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]] f0/0 = NIO_gen_eth:\Device\NPF_{8B89D910-5ED3-4A43-9DE9-6A272A3D7592} e1/0 = R2 e1/0 [[ROUTER R2]] f0/0 = NIO_gen_eth:\Device\NPF_{5933302A-7AAA-475C-A8FE-A6B82B0C0F98}
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 FastEthernet0/0 ip address 192.168.200.1 255.255.255.0 duplex auto speed auto ! interface Ethernet1/0 ip address 192.168.1.1 255.255.255.0 half-duplex ! interface Ethernet1/1 no ip address shutdown half-duplex ! interface Ethernet1/2 no ip address shutdown half-duplex ! interface Ethernet1/3 no ip address shutdown half-duplex ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface Ethernet1/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 FastEthernet0/0 ip address 192.168.201.2 255.255.255.0 duplex auto speed auto ! interface Ethernet1/0 ip address 192.168.1.2 255.255.255.0 half-duplex ! interface Ethernet1/1 no ip address shutdown half-duplex ! interface Ethernet1/2 no ip address shutdown half-duplex ! interface Ethernet1/3 no ip address shutdown half-duplex ! router ospf 1 log-adjacency-changes passive-interface default no passive-interface Ethernet1/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. [検証] CBWFQ
3.1. 設定投入
R1 e1/0で以下の割合で、CBWFQを実装します。
概要 | ACL | CLASS | 割当 |
---|---|---|---|
SSH | ACL_SSH | CLASS_SSH | 20% |
tcp10880のHTTP | ACL_10880 | CLASS_10880 | 50% |
その他 | class-default |
具体的な実装例は以下の通りです。
R1(config)#ip access-list extended ACL_SSH R1(config-ext-nacl)#permit tcp any any eq 22 R1(config-ext-nacl)#exit R1(config)#ip access-list extended ACL_10880 R1(config-ext-nacl)#permit tcp any eq 10880 any R1(config-ext-nacl)#exit R1(config)# R1(config)#class-map CLASS_SSH R1(config-cmap)#match access-group name ACL_SSH R1(config-cmap)#exit R1(config)#class-map CLASS_10880 R1(config-cmap)#match access-group name ACL_10880 R1(config-cmap)#exit R1(config)# R1(config)#policy-map POLICY_E00_OUT R1(config-pmap)#class CLASS_SSH R1(config-pmap-c)#bandwidth percent 20 R1(config-pmap-c)#exit R1(config-pmap)#class CLASS_10880 R1(config-pmap-c)#bandwidth percent 50 R1(config-pmap-c)#exit R1(config-pmap)#class class-default R1(config-pmap-c)#fair-queue R1(config-pmap-c)#exit R1(config-pmap)#exit R1(config)# R1(config)# R1(config)#interface Ethernet 1/0 R1(config-if)#service-policy output POLICY_E00_OUT
3.2. 設定の確認
show policy-map interfaceコマンドで設定を確認する事をできます。
R1#show policy-map interface Ethernet 1/0 Ethernet1/0 Service-policy output: POLICY_E00_OUT Class-map: CLASS_SSH (match-all) 593 packets, 32802 bytes 5 minute offered rate 2000 bps, drop rate 0 bps Match: access-group name ACL_SSH Queueing Output Queue: Conversation 265 Bandwidth 20 (%) Bandwidth 2000 (kbps) Max Threshold 64 (packets) (pkts matched/bytes matched) 553/30538 (depth/total drops/no-buffer drops) 0/0/0 Class-map: CLASS_10880 (match-all) 1112 packets, 642736 bytes 5 minute offered rate 26000 bps, drop rate 0 bps Match: access-group name ACL_10880 Queueing Output Queue: Conversation 266 Bandwidth 50 (%) Bandwidth 5000 (kbps) Max Threshold 64 (packets) (pkts matched/bytes matched) 917/529126 (depth/total drops/no-buffer drops) 1/0/0 Class-map: class-default (match-any) 1894 packets, 1087664 bytes 5 minute offered rate 37000 bps, drop rate 0 bps Match: any Queueing Flow Based Fair Queueing Maximum Number of Hashed Queues 256 (total queued/total drops/no-buffer drops) 13/0/0 R1#
3.3. 帯域の確認
Guest OS上で下記wgetを3つ同時に実行します。
より多くの帯域を割り当てているtcp10880のHTTPが、一番通信が速い事を確認します。
より多くの帯域を割り当てているtcp10880のHTTPが、一番通信が速い事を確認します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-12-05 13:52:44-- 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' 7% [==> ] 1,626,636 10.3K/s eta 53m 38s [root@localhost ~]# wget -O /dev/null http://192.168.200.100:10881/large.html --2010-12-05 13:52:55-- http://192.168.200.100:10881/large.html Connecting to 192.168.200.100:10881... connected. HTTP request sent, awaiting response... 200 OK Length: 23016000 (22M) [text/html] Saving to: `/dev/null' 5% [=> ] 1,346,632 4.07K/s eta 67m 26s [root@localhost ~]# wget -O /dev/null http://192.168.200.100:10882/large.html --2010-12-05 13:54:38-- http://192.168.200.100:10882/large.html Connecting to 192.168.200.100:10882... connected. HTTP request sent, awaiting response... 200 OK Length: 23016000 (22M) [text/html] Saving to: `/dev/null' 3% [> ] 786,432 5.04K/s eta 77m 49s
4. [補足] その他の設定
4.1. kbps指定
使用帯域をpercentではなく、kbpsで指定する事もできます。
設定例は以下の通りです。(下記の例では、queuingの設定も同時に行っています。)
設定例は以下の通りです。(下記の例では、queuingの設定も同時に行っています。)
R1(config)#policy-map POLICY_S00_OUT R1(config-pmap)#class CLASS_SSH R1(config-pmap-c)#bandwidth 100 R1(config-pmap-c)#queue-limit 20 R1(config-pmap-c)#exit R1(config-pmap)#class CLASS_10880 R1(config-pmap-c)#bandwidth 8 R1(config-pmap-c)#random-detect R1(config-pmap-c)#exit
なお、percent指定とkbps指定を併用する事はできません。併用すると、以下のようなエラーメッセージが出力されます。
R1(config-pmap)#class CLASS_SSH R1(config-pmap-c)#bandwidth 200 R1(config-pmap-c)#exit R1(config-pmap)#class CLASS_10880 R1(config-pmap-c)#bandwidth percent 15 All classes with bandwidth should have consistent units R1(config-pmap-c)#
4.2. 指定帯域の上限
指定できる帯域の上限は75%までです。75%を超過すると、以下のようなエラーメッセージが出力されます。
R1(config-pmap)#class CLASS_SSH R1(config-pmap-c)#bandwidth percent 50 R1(config-pmap-c)#exit R1(config-pmap)#class CLASS_10880 R1(config-pmap-c)#bandwidth percent 40 I/f Serial0/0 class CLASS_10880 requested bandwidth 40%, available only 25% R1(config-pmap-c)# R1(config-pmap-c)#bandwidth percent 25 R1(config-pmap-c)#exit R1(config-pmap)#exit
以下のコマンドで指定できる帯域の上限を変更する事ができます。以下は90%まで指定できるようにした設定例です。
R1(config-if)# max-reserved-bandwidth 90
添付ファイル