DynagenでCCIEを目指す
Commited Access Rate
最終更新:
it_certification
-
view
1. 目的
- CAR (Commited Access Rate)の設定方法について確認します。
2. 構成
2.1. 設定概要
- Host OS側でApacheを起動させます。
- R1, R2間は10Mで接続する事で、わざと輻輳を発生させます。
- R1, R2はstaticでルーティングします。
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 ! ! no ip domain lookup ! 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 ! ip http server ip classless ip route 192.168.201.0 255.255.255.0 192.168.1.2 ! ! no cdp run ! ! ! ! ! ! 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 ! ! no ip domain lookup ! 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 ! ip http server ip classless ip route 192.168.200.0 255.255.255.0 192.168.1.1 ! ! no cdp run ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
2.5. Apache 設定
ホストOSにApacheをインストールし、ポートベースのバーチャルホストを定義します。構築方法はトップページ/手順書 サーバ系/Apache HTTP Server バーチャルホストの設定を参考にして下さい。
この検証例で実際に使用したhttpd.confの要所となる部分を以下に記載します。
この検証例で実際に使用したhttpd.confの要所となる部分を以下に記載します。
Listen 10880 Listen 10881 Listen 10882 NameVirtualHost *:10880 NameVirtualHost *:10881 NameVirtualHost *:10882 <VirtualHost *:10880> DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" </VirtualHost> <VirtualHost *:10881> DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs10881" </VirtualHost> <VirtualHost *:10882> DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs10882" </VirtualHost>
2.6. サーバ側 ルーティング設定
- 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. [検証] CAR (Commited Access Rate)
3.1. CAR 関連の用語
CARは、以下のCIR, Bc, Beの3つの指標を用いて送信速度を定義します(Tcは自動的に算出されます)。
用語 | 意味 |
---|---|
CIR (Committed Information Rate) | 認定アクション(confirm-action)内での送信速度です。 |
Bc (Burst Committed) | Tcで定義された時間内に送信可能なbit数です。(Tc = Bc/CIRという式が成立します) |
Be (Excess Burst) | Bcを超過してTcで定義された時間内に送信可能なbit数です。Bc超過分には、超過アクション(exceed-action)が適用されます。 |
Tc (time interval) | Bcで定義されたbit数を送信する時間です。 |
3.2. CAR 設定概要
CARは以下のコマンドで、cir, bc, beを定義します。また、access-groupなどを用いてrate-limitを適用する範囲を限定する事ができます(その他、dscpやqos-groupなども使用する事ができます。rate-limitを適用する範囲を省略すると、全てのパケットがrate-limitの対象となります。)。
Router(config-if)# rate-limit output [access-group <acl>] <cir> <bc> <be> conform-action <conform-action> exceed-action <exceed-action>
cir, bc, beを定義した後は、conform-action, exceed-actionなど動作を定義します。動作の定義方法は以下の通りです。
action | 説明 |
---|---|
transmit | パケットを転送します。 |
drop | パケットを破棄します。 |
continue | 次の行で定義したrate-limitを元に評価します。 |
set-dscp-transmit | dscp値をマークし、パケットを転送します。 |
set-dscp-continue | dscp値をマークし、次の行で定義したrate-limitを元に評価します。 |
set-prec-transmit | precedence値をマークし、パケットを転送します。 |
set-prec-continue | precedence値をマークし、次の行で定義したrate-limitを元に評価します。 |
set-qos-transmit | qos-group値をマークし、パケットを転送します。 |
set-qos-continue | qos-group値をマークし、次の行で定義したrate-limitを元に評価します。 |
3.3. CARの設定
以下のような帯域制御をR1 e1/0で行います。
No | 条件 | CIR | bc | be | conform-action | exceed-action |
---|---|---|---|---|---|---|
1 | SSH | 200Kbps | 20Kbits | 40Kbits | set-prec-transmit 5 | transmit |
2 | tcp10880 | 200Kbps | 40Kbits | 80Kbits | set-prec-transmit 3 | continue |
3 | tcp10880 or tcp10881 | 16Kbps | 30Kbits | 60Kbits | set-prec-transmit 1 | continue |
4 | tcp10880 or tcp10881 or tcp10882 | 8Kbps | 15Kbits | 30Kbits | transmit | drop |
具体的に投入するconfigは以下の通りです。
R1(config)#access-list 122 permit tcp any any eq 22 R1(config)# R1(config)#access-list 180 permit tcp any eq 10880 any R1(config)# R1(config)#access-list 181 permit tcp any eq 10880 any R1(config)#access-list 181 permit tcp any eq 10881 any R1(config)# R1(config)#access-list 182 permit tcp any eq 10880 any R1(config)#access-list 182 permit tcp any eq 10881 any R1(config)#access-list 182 permit tcp any eq 10882 any R1(config)# R1(config)# R1(config)#interface Ethernet 1/0 R1(config-if)#rate-limit output access-group 122 200000 20000 40000 conform-action set-prec-transmit 5 exceed-action transmit R1(config-if)#rate-limit output access-group 180 200000 40000 80000 conform-action set-prec-transmit 3 exceed-action continue R1(config-if)# R1(config-if)#rate-limit output access-group 181 16000 3000 6000 conform-action set-prec-transmit 1 exceed-action continue R1(config-if)#rate-limit output access-group 182 8000 1500 3000 conform-action transmit exceed-action drop
3.4. 単一actionの確認
動作確認のため、Guest OSでtcp10880宛てのwgetコマンドを実行します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-11-14 19:19:47-- 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' 9% [===> ] 2,241,036 19.9K/s eta 36m 40s
show interfaces Ethernet 1/0 rate-limitコマンドで、rate-limiteの設定確認やactionの実施状況を確認する事ができます。
tcp10880はaccess-group 180に合致します。access-group 180のconformedのパケット数が増大している事を確認します。
tcp10880はaccess-group 180に合致します。access-group 180のconformedのパケット数が増大している事を確認します。
R1#show interfaces Ethernet 1/0 rate-limit Ethernet1/0 Output matches: access-group 122 params: 200000 bps, 20000 limit, 40000 extended limit conformed 42 packets, 2424 bytes; action: set-prec-transmit 5 exceeded 0 packets, 0 bytes; action: transmit last packet: 36ms ago, current burst: 0 bytes last cleared 00:00:17 ago, conformed 1000 bps, exceeded 0 bps matches: access-group 180 params: 200000 bps, 40000 limit, 80000 extended limit conformed 652 packets, 376808 bytes; action: set-prec-transmit 3 <- パケット数が増大している事を確認します。 exceeded 0 packets, 0 bytes; action: continue last packet: 52ms ago, current burst: 12050 bytes last cleared 00:00:17 ago, conformed 174000 bps, exceeded 0 bps matches: access-group 181 params: 16000 bps, 3000 limit, 6000 extended limit conformed 0 packets, 0 bytes; action: set-prec-transmit 1 exceeded 0 packets, 0 bytes; action: continue last packet: 74840ms ago, current burst: 3796 bytes last cleared 00:00:17 ago, conformed 0 bps, exceeded 0 bps matches: access-group 182 params: 8000 bps, 1500 limit, 3000 extended limit conformed 0 packets, 0 bytes; action: transmit exceeded 0 packets, 0 bytes; action: drop last packet: 73864ms ago, current burst: 1572 bytes last cleared 00:00:17 ago, conformed 0 bps, exceeded 0 bps R1#
3.5. 複数actionの確認
動作確認のため、Guest OSでtcp10881宛てのwgetコマンドを実行します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10881/large.html --2010-11-14 19:25:16-- 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' 0% [ ] 110,600 2.26K/s eta 2h 33m
show interfaces Ethernet 1/0 rate-limitコマンドを実行します。
access-group 181, 182のパケット数が増大している事を確認します。また、access-group 181のexceed-actionはcontinueになっているため、超過分はaccess-group 182に基づいて評価されます。access-group 181のexceededが、access-group 182のconformedとexceededの合計になっている事も確認できます(126 = 55 + 121)。
access-group 181, 182のパケット数が増大している事を確認します。また、access-group 181のexceed-actionはcontinueになっているため、超過分はaccess-group 182に基づいて評価されます。access-group 181のexceededが、access-group 182のconformedとexceededの合計になっている事も確認できます(126 = 55 + 121)。
R1#show interfaces Ethernet 1/0 rate-limit Ethernet1/0 Output matches: access-group 122 params: 200000 bps, 20000 limit, 40000 extended limit conformed 300 packets, 16720 bytes; action: set-prec-transmit 5 exceeded 0 packets, 0 bytes; action: transmit last packet: 312ms ago, current burst: 0 bytes last cleared 00:02:40 ago, conformed 0 bps, exceeded 0 bps matches: access-group 180 params: 200000 bps, 40000 limit, 80000 extended limit conformed 4037 packets, 2332826 bytes; action: set-prec-transmit 3 exceeded 0 packets, 0 bytes; action: continue last packet: 58012ms ago, current burst: 3700 bytes last cleared 00:02:40 ago, conformed 116000 bps, exceeded 0 bps matches: access-group 181 params: 16000 bps, 3000 limit, 6000 extended limit conformed 121 packets, 72970 bytes; action: set-prec-transmit 1 <- パケット数が増大している事を確認します。 exceeded 126 packets, 67343 bytes; action: continue <- access-group 182のconformedとexceededの合計になっているはずです。 last packet: 608ms ago, current burst: 5696 bytes last cleared 00:02:40 ago, conformed 3000 bps, exceeded 3000 bps matches: access-group 182 params: 8000 bps, 1500 limit, 3000 extended limit conformed 55 packets, 31657 bytes; action: transmit <- パケット数が増大している事を確認します。 exceeded 71 packets, 35686 bytes; action: drop <- パケット数が増大している事を確認します。 last packet: 636ms ago, current burst: 2821 bytes last cleared 00:02:40 ago, conformed 1000 bps, exceeded 1000 bps R1#
3.6. 送信速度の確認
動作確認のため、Guest OSで以下wgetコマンドを3つ同時に実行します。
充分な帯域が割り当てられている通信ほど、通信速度が速い事が読み取れます。
充分な帯域が割り当てられている通信ほど、通信速度が速い事が読み取れます。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-11-14 19:30:16-- 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' 25% [===========> ] 5,861,900 14.5K/s eta 30m 53s [root@localhost ~]# wget -O /dev/null http://192.168.200.100:10881/large.html --2010-11-14 19:35:54-- 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' 3% [> ] 713,000 2.44K/s eta 2h 40m [root@localhost ~]# wget -O /dev/null http://192.168.200.100:10882/large.html --2010-11-14 19:35:56-- 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' 0% [ ] 15,949 --.-K/s eta 5d 6h
3.7. precedence値の確認
現在、CARの設定は以下のようになっています(再掲)。
No | 条件 | CIR | bc | be | conform-action | exceed-action |
---|---|---|---|---|---|---|
1 | SSH | 200Kbps | 20Kbits | 40Kbits | set-prec-transmit 5 | transmit |
2 | tcp10880 | 200Kbps | 40Kbits | 80Kbits | set-prec-transmit 3 | continue |
3 | tcp10880 or tcp10881 | 16Kbps | 30Kbits | 60Kbits | set-prec-transmit 1 | continue |
4 | tcp10880 or tcp10881 or tcp10882 | 8Kbps | 15Kbits | 30Kbits | transmit | drop |
tcp 10880の通信に対して、precedence 3がマークされている事を確認します。
以下がR2 e1/0でキャプチャを実施した結果です。

;
以下がR2 e1/0でキャプチャを実施した結果です。

tcp 10881の通信に対しては、通常はprecedence 1がマークされ、超過分は何もマークされない事を確認します。
以下がR2 e1/0でキャプチャを実施した結果です。

;

;
以下がR2 e1/0でキャプチャを実施した結果です。

