DynagenでCCIEを目指す
Priority Queueing
最終更新:
it_certification
-
view
1. 目的
- Priority Queueingの設定方法について確認します。
2. 構成
2.1. 設定概要
- 初期設定はIPアドレスのみです。
- Host OS側でApacheを起動させます。
- Guest OS, R1間は10Mで接続する事で、わざと輻輳を発生させます。
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 = 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.201.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 ! ! 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.1
3. [検証] priority queue 基本設定
3.1. 設定投入
以下のqueueingを定義します。
通信 | queue |
---|---|
SSH | high |
tcp10880を使用したHTTP | medium |
tcp10881を使用したHTTP | normal(default) |
tcp10882を使用したHTTP | low |
投入するconfigは以下の通りです。
R1(config)#priority-list 1 protocol ip high tcp 22 R1(config)#priority-list 1 protocol ip medium tcp 10880 R1(config)#priority-list 1 protocol ip low tcp 10882 R1(config)# R1(config)# R1(config)#interface Ethernet 1/0 R1(config-if)#priority-group 1
3.2. テストトラフィックの送信
Host OSからGuest OSへssh接続い、以下要領のwgetコマンドを3つ同時に実行します。
priorityが高いものほど、ダウンロード速度が速い事を確認します。
priorityが高いものほど、ダウンロード速度が速い事を確認します。
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10880/large.html --2010-11-02 08:58:02-- 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' 73% [===================================> ] 16,973,824 19.1K/s eta 2m 22s <- 速い事を確認
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10881/large.html --2010-11-02 08:58:40-- 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' 12% [=====> ] 2,934,832 18.4K/s eta 42m 27s <- やや速い事を確認
[root@localhost ~]# wget -O /dev/null http://192.168.200.100:10882/large.html --2010-11-02 09:02:43-- http://192.168.200.100:10882/large.html Connecting to 192.168.200.100:10882... connected. HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers. Retrying. --2010-11-02 09:03:43-- (try: 2) 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' 2% [> ] 496,140 5.27K/s eta 58m 39s <- 遅い事を確認
3.3. showコマンドによる確認
show queueingコマンドでqueueingの設定を確認する事ができます。
R1#show queueing Current fair queue configuration: Current DLCI priority queue configuration: Current priority queue configuration: List Queue Args 1 high protocol ip list 100 1 medium protocol ip tcp port 10880 1 low protocol ip tcp port 10882 Current custom queue configuration: Current random-detect configuration: Current per-SID queue configuration: R1#
show queueing interfaceコマンドで各queueを通過したパケット数を確認する事ができます。
R1#show queueing interface Ethernet 1/0 Interface Ethernet1/0 queueing strategy: priority Output queue utilization (queue/count) high/1401 medium/34481 normal/8058 low/1208 R1#
show queueコマンドで現在queueに格納されているパケットを確認する事ができます。tcp10881など比較的優先度が低いパケットが格納されている事が読み取れます。
R1#show queue Ethernet 1/0 Output queue for Ethernet1/0 is 14/60 Packet 1, linktype: ip, length: 590, flags: 0x88 source: 192.168.200.100, destination: 192.168.201.101, id: 0x7876, ttl: 127, <- ip addressなどを確認できます。 TOS: 0 prot: 6, source port 10881, destination port 39819 <- port番号を確認できます。 data: 0x2A81 0x9B8B 0x1382 0x2201 0xF311 0x838E 0x8010 0x43E6 0xF04C 0x0000 0x0101 0x080A 0x0000 0x6A4C Packet 2, linktype: ip, length: 590, flags: 0x88 source: 192.168.200.100, destination: 192.168.201.101, id: 0x7877, ttl: 127, TOS: 0 prot: 6, source port 10881, destination port 39819 data: 0x2A81 0x9B8B 0x1382 0x240D 0xF311 0x838E 0x8010 0x43E6 0xED56 0x0000 0x0101 0x080A 0x0000 0x6A4C Packet 3, linktype: ip, length: 590, flags: 0x88 source: 192.168.200.100, destination: 192.168.201.101, id: 0x7878, ttl: 127, TOS: 0 prot: 6, source port 10881, destination port 39819 data: 0x2A81 0x9B8B 0x1382 0x2619 0xF311 0x838E 0x8010 0x43E6 0xEC60 0x0000 0x0101 0x080A 0x0000 0x6A4C Packet 4, linktype: ip, length: 590, flags: 0x88 source: 192.168.200.100, destination: 192.168.201.101, id: 0x7879, ttl: 127, TOS: 0 prot: 6, source port 10881, destination port 39819 data: 0x2A81 0x9B8B 0x1382 0x2825 0xF311 0x838E 0x8010 0x43E6 0xEB4A 0x0000 0x0101 0x080A 0x0000 0x6A4C - 略 - R1#
show interfaceコマンドで各queueに何パケット格納されているかを確認する事ができます。
R1#show interfaces Ethernet 1/0 Ethernet1/0 is up, line protocol is up Hardware is AmdP2, address is cc00.04d8.0010 (bia cc00.04d8.0010) Internet address is 192.168.201.1/24 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, reliability 255/255, txload 9/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:05:46, output 00:00:00, output hang never Last clearing of "show interface" counters never Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: priority-list 1 Output queue (queue priority: size/max/drops): high: 0/20/0, medium: 0/40/0, normal: 2/60/0, low: 8/80/0 <- queueに格納されたパケットを確認できます。 5 minute input rate 36000 bits/sec, 57 packets/sec 5 minute output rate 358000 bits/sec, 96 packets/sec 20739 packets input, 1668028 bytes, 0 no buffer Received 4 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 37252 packets output, 20334264 bytes, 0 underruns 0 output errors, 0 collisions, 2 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out R1#
4. [検証] priority queueingの詳細設定
4.1. ACLを用いた設定
以下の通りACLを用いて設定を行う事も可能です。
R1(config)#no priority-list 1 protocol ip medium tcp 10880 R1(config)#no priority-list 1 protocol ip low tcp 10882 R1(config)#no priority-list 1 protocol ip high tcp 22 R1(config)#interface Ethernet 1/0 R1(config-if)#no priority-group 1 R1(config-if)#exit R1(config)# R1(config)# R1(config)#access-list 100 permit tcp any any eq 22 R1(config)#access-list 101 permit tcp any any eq 10880 R1(config)#access-list 102 permit tcp any any eq 10882 R1(config)# R1(config)#priority-list 1 protocol ip high list 100 R1(config)#priority-list 1 protocol ip medium list 101 R1(config)#priority-list 1 protocol ip normal list 102 R1(config)#interface Ethernet 1/0 R1(config-if)#priority-group 1 R1(config-if)# R1(config-if)# R1(config-if)# R1(config-if)#do show queueing Current fair queue configuration: Current DLCI priority queue configuration: Current priority queue configuration: List Queue Args 1 high protocol ip list 100 <- ACLに基づく定義がなされた事を確認します。 1 medium protocol ip list 101 <- ACLに基づく定義がなされた事を確認します。 1 normal protocol ip list 102 <- ACLに基づく定義がなされた事を確認します。 Current custom queue configuration: Current random-detect configuration: Current per-SID queue configuration: R1(config-if)#
4.2. 入力I/Fによる設定
入力I/Fによる設定を行う事も可能です。以下はFa0/0から入ってきたパケットをmedium queueに挿入する設定です。
R1(config)#priority-list 1 interface FastEthernet 0/0 medium R1(config)# R1(config)#do show queueing Current fair queue configuration: Current DLCI priority queue configuration: Current priority queue configuration: List Queue Args 1 high protocol ip list 100 1 medium protocol ip list 101 1 normal protocol ip list 102 1 medium interface FastEthernet0/0 <- 入力I/Fによる定義を確認します。 Current custom queue configuration: Current random-detect configuration: Current per-SID queue configuration: R1(config)#
4.3. default queueの変更
default queueを変更する事も可能です(デフォルトのdefault queueはnormalです)。設定例は以下の通りです。
R1(config)#priority-list 1 default low R1#show queueing Current fair queue configuration: Current DLCI priority queue configuration: Current priority queue configuration: List Queue Args 1 low default <- default queueが変更された事を確認します。 1 high protocol ip list 100 1 medium protocol ip list 101 1 normal protocol ip list 102 1 medium interface FastEthernet0/0 Current custom queue configuration: Current random-detect configuration: Current per-SID queue configuration: R1#
4.4. queueのサイズ変更
各queueに格納できるパケット数を変更する事もできます。設定例は以下の通りです。
R1(config)#priority-list 1 queue-limit 50 50 50 100 R1(config)# R1(config)# R1(config)# R1(config)#do show queueing Current fair queue configuration: Current DLCI priority queue configuration: Current priority queue configuration: List Queue Args 1 medium default 1 high protocol ip list 100 1 medium protocol ip list 101 1 normal protocol ip list 102 1 medium interface FastEthernet0/0 1 high limit 50 <- queueのサイズが定義された事を確認します。 1 medium limit 50 <- queueのサイズが定義された事を確認します。 1 normal limit 50 <- queueのサイズが定義された事を確認します。 1 low limit 100 <- queueのサイズが定義された事を確認します。 Current custom queue configuration: Current random-detect configuration: Current per-SID queue configuration: R1(config)# R1(config)# R1(config)#do show interface Ethernet 1/0 Ethernet1/0 is up, line protocol is up Hardware is AmdP2, address is cc00.04c4.0010 (bia cc00.04c4.0010) Internet address is 192.168.201.1/24 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:07, output 00:00:00, output hang never Last clearing of "show interface" counters 00:29:21 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: priority-list 1 Output queue (queue priority: size/max/drops): high: 0/50/0, medium: 0/50/0, normal: 0/50/0, low: 0/100/0 <- 各queueのサイズが変わった事を確認します。 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 26112 packets input, 2019236 bytes, 0 no buffer Received 16 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 input packets with dribble condition detected 46917 packets output, 26131329 bytes, 0 underruns 0 output errors, 0 collisions, 0 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out R1(config)#
5. [補足] 設定のバッティング
5.1. 設定のバッティング
以下のようなI/Fによる設定とACLによる設定がバッティングしているconfigについて考察します。
interface Ethernet1/0 ip address 192.168.201.1 255.255.255.0 half-duplex priority-group 1 ! access-list 100 permit tcp any any eq 22 access-list 101 permit tcp any any eq 10880 access-list 102 permit tcp any any eq 10882 priority-list 1 protocol ip high list 100 priority-list 1 protocol ip medium list 101 priority-list 1 protocol ip normal list 102 priority-list 1 interface FastEthernet0/0 medium priority-list 1 default low priority-list 1 queue-limit 50 50 50 100
queueingの方法を表でまとめると以下の通りです。sshやtcp10882については、設定がバッティングしている事が分かります。
通信 | ACLによる定義 | 入力I/Fによる定義 |
---|---|---|
SSH | high | medium |
tcp10880を使用したHTTP | medium | medium |
tcp10881を使用したHTTP | 定義なし | medium |
tcp10882を使用したHTTP | norma | medium |
この場合は、優先度が高いqueueに格納されます。sshはhigh, mediumの両方に格納される可能性がありますが、実際に格納されるのはhighです。tcp10882についてはmedium, normalの両方に格納される可能性がありますが、mediumに格納されます。
上記を確かめる実験として、Host OSからGuest OSにsshログインし、下記のwgetを実行します。
上記を確かめる実験として、Host OSからGuest OSにsshログインし、下記のwgetを実行します。
[root@localhost ~]# wget http://192.168.200.100:10882/large.html --2010-11-02 21:09:06-- 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: `large.html' 3% [> ] 733,708 54.1K/s eta 7m 5s
カウンタをクリアした後に、以下のコマンドを実行します。high, mediumのみのカウンタが増加している事から、設定がバッティングした場合は、優先度が高いqueueに格納される仕様になっている事が推測できます。
R1#show queueing interface Ethernet 1/0 Interface Ethernet1/0 queueing strategy: priority Output queue utilization (queue/count) high/37 medium/749 normal/0 low/0 R1#
添付ファイル