H O M E > ネットワークのおべんきょしませんか? Cisco CCNA/CCNP/CCIE、ネットワークスペシャリスト試験の勉強にピッタリ > 2012年7月
(所属カテゴリー:IPルーティング | シスコ---投稿日時:2012年7月27日)
以下の設定は設定済みとします。
R3でHTTPトラフィックをR1へルーティングするように、ポリシーベースルーティングの設定を行います。ポリシーベースルーティングのためのルートマップ「HTTP」を作成します。match条件でHTTPをpermitするアクセスリストを関連付けて、R1へルーティングするset条件を指定します。 作成したルートマップ「HTTP」を受信インタフェースであるE0/1に適用します。
R3
------------------------------------------ interface Ethernet0/1 ip policy route-map HTTP ! access-list 100 permit tcp any any eq www ! route-map HTTP permit 10 match ip address 100 set ip next-hop 172.16.2.1 ------------------------------------------
R3でshow route-mapおよびshow ip policyコマンドでルートマップの設定を確認します。
R3 show route-map/show ip policy
------------------------------------------ R3#show route-map route-map HTTP, permit, sequence 10 Match clauses: ip address (access-lists): 100 Set clauses: ip next-hop 172.16.2.1 Policy routing matches: 0 packets, 0 bytes R3#show ip policy Interface Route map Ethernet0/1 HTTP ------------------------------------------
R3でポリシーベースルーティングを確認するために、debug ip policyコマンドを入力します。その状態でHOSTからSRVあてにHTTPパケットを送信します。R3のデバッグの出力は次のようになります。
R3 debug ip policy
------------------------------------------ R3#debug ip policy Policy routing debugging is on R3# *Mar 1 01:31:43.407: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100, len 44, FIB policy match *Mar 1 01:31:43.411: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100, len 44, policy match *Mar 1 01:31:43.415: IP: route map HTTP, item 10, permit *Mar 1 01:31:43.419: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100 (Ethernet0/0), len 44, policy routed *Mar 1 01:31:43.423: IP: Ethernet0/1 to Ethernet0/0 172.16.2.1 *Mar 1 01:31:45.407: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100, len 44, FIB policy match *Mar 1 01:31:45.411: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100, len 44, policy match *Mar 1 01:31:45.415: IP: route map HTTP, item 10, permit *Mar 1 01:31:45.419: IP: s=172.16.3.100 (Ethernet0/1), d=192.168.1.100 (Ethernet0/0), len 44, policy routed *Mar 1 01:31:45.423: IP: Ethernet0/1 to Ethernet0/0 172.16.2.1 ~省略~ ------------------------------------------
また、show route-mapコマンドでポリシーベースルーティングを行ったパケット数を確認できます。
------------------------------------------ R3#show route-map route-map HTTP, permit, sequence 10 Match clauses: ip address (access-lists): 100 Set clauses: ip next-hop 172.16.2.1 Policy routing matches: 4 packets, 240 bytes ------------------------------------------
R1
------------------------------------------ hostname R1 ! interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 ! interface Serial1/0 ip address 172.16.1.1 255.255.255.0 ! ip route 172.16.0.0 255.255.0.0 172.16.1.3 ------------------------------------------
R2
------------------------------------------ hostname R2 ! interface Ethernet0/0 ip address 192.168.1.2 255.255.255.0 ! interface Ethernet0/1 ip address 172.16.2.2 255.255.255.0 ! ip route 172.16.0.0 255.255.0.0 172.16.2.3 ------------------------------------------
R3
------------------------------------------ hostname R3 ! interface Ethernet0/0 ip address 172.16.2.3 255.255.255.0 ! interface Ethernet0/1 ip address 172.16.3.3 255.255.255.0 ip policy route-map HTTP ! interface Serial1/0 ip address 172.16.1.3 255.255.255.0 ! ip route 0.0.0.0 0.0.0.0 172.16.1.1 ip route 0.0.0.0 0.0.0.0 172.16.2.2 ! access-list 100 permit tcp any any eq www ! route-map HTTP permit 10 match ip address 100 set ip next-hop 172.16.2.1 ------------------------------------------
SRV
------------------------------------------ hostname SRV ! no ip routing ! interface Ethernet0/0 ip address 192.168.1.100 255.255.255.0 ! ip default-gateway 192.168.1.1 ------------------------------------------
HOST
------------------------------------------ hostname HOST ! no ip routing ! interface Ethernet0/0 ip address 172.16.3.100 255.255.255.0 ! ip default-gateway 172.16.3.3 ------------------------------------------