この部分の広告を募集しています。 詳しくはこちら

2012年7月アーカイブの最新記事

ポリシーベースルーティングの設定例

(所属カテゴリー:IPルーティング | シスコ---投稿日時:2012年7月27日)

ネットワーク構成

policy_base_routing01.png
図 ポリシーベースルーティング ネットワーク構成

設定条件

  • R3で、HTTPのトラフィックをR1へルーティングするようにしてください。
  • HTTP以外のトラフィックはR1、R2のどちらへルーティングしてもよいものとします。

確認条件

  • R3でSRVあてのHTTPトラフィックをR1へルーティングしていることを確認します。

初期設定

以下の設定は設定済みとします。

  • ホスト名
  • IPアドレス
  • スタティックルート
    R1、R2でネクストホップをR3として172.16.0.0/16のスタティックルートを設定
    R3でネクストホップをR1、R2とするデフォルトルートのスタティックルートを設定

設定

【Step1:ルートマップの設定】

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
------------------------------------------

【Step2:ルートマップの確認】

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
------------------------------------------

【Step3:ポリシーベースルーティングの確認】

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
------------------------------------------

Google
Web n-study.com

各コンテンツの最新記事

有料コンテンツライブラリ(ITエンジニア教育資料)

ネットワーク技術雑誌レビュー

ベンダ資格受験記

オススメ!ネットワーク技術雑誌・書籍

MindMapでおべんきょ

結果を出せるコーチング

Geneのつぶやき

The Power of Words

スポンサードリンク

スポンサードリンク