12. ポリシールーティング設定

12.1. 端末ごとに異なる回線を使用する

ネットワークごとやアプリケーションごとに異なるプロバイダと接続したい場合は、ポリシールーティングを使用します。

../_images/12.1.png

設定

本装置の設定

Router# configure
Router(config)# ip access-list list1 permit ip src 192.168.0.1/32 dest any
Router(config)# ip access-list list2 permit ip src 192.168.0.2/32 dest any
Router(config)# route-map rmap permit 10
Router(config-route-map-rmap-10)# match ip address access-list list1
Router(config-route-map-rmap-10)# set interface GigaEthernet0.1
Router(config-route-map-rmap-10)# exit
Router(config)# route-map rmap permit 20
Router(config-route-map-rmap-20)# match ip address access-list list2
Router(config-route-map-rmap-20)# set interface GigaEthernet1.1
Router(config-route-map-rmap-20)# exit
Router(config)# ppp profile ppp-prof1
Router(config-ppp-ppp-prof1)# authentication myname user-a@example.com
Router(config-ppp-ppp-prof1)# authentication password user-a@example.com password-a
Router(config-ppp-ppp-prof1)# exit
Router(config)# ppp profile ppp-prof2
Router(config-ppp-ppp-prof2)# authentication myname user-b@example.com
Router(config-ppp-ppp-prof2)# authentication password user-b@example.com password-b
Router(config-ppp-ppp-prof2)# exit
Router(config)# interface GigaEthernet2.0
Router(config-GigaEthernet2.0)# ip address 192.168.0.254/24
Router(config-GigaEthernet2.0)# ip policy route-map rmap
Router(config-GigaEthernet2.0)# no shutdown
Router(config-GigaEthernet2.0)# exit
Router(config)# interface GigaEthernet0.1
Router(config-GigaEthernet0.1)# encapsulation pppoe
Router(config-GigaEthernet0.1)# ppp binding ppp-prof1
Router(config-GigaEthernet0.1)# ip address ipcp
Router(config-GigaEthernet0.1)# ip napt enable
Router(config-GigaEthernet0.1)# no shutdown
Router(config-GigaEthernet0.1)# exit
Router(config)# interface GigaEthernet1.1
Router(config-GigaEthernet1.1)# encapsulation pppoe
Router(config-GigaEthernet1.1)# ppp binding ppp-prof2
Router(config-GigaEthernet1.1)# ip address ipcp
Router(config-GigaEthernet1.1)# ip napt enable
Router(config-GigaEthernet1.1)# no shutdown
Router(config-GigaEthernet1.1)# exit
Router(config)#

解説

ip access-list list1 permit ip src 192.168.0.1/32 dest any
ip access-list list2 permit ip src 192.168.0.2/32 dest any

ポリシールーティングの対象とする端末をアクセスリストで指定します。

route-map rmap permit 10
  match ip address access-list list1
  set interface GigaEthernet0.1
rmap という名前のルートマップを作成します。
10 はシーケンス番号です。
送信元アドレスが 192.168.0.1 のパケットは、インタフェース GE0.1 から出力されます。
route-map rmap permit 20
  match ip address access-list list2
  set interface GigaEthernet1.1
同名のルートマップにシーケンス番号をずらしたかたちで2つ目を設定します。
20 は値 10 よりもシーケンス番号が大きいため、シーケンス番号 10 に一致しなかったパケットが本ルートマップの対象となります。
送信元アドレスが 192.168.0.2 のパケットは、インタフェース GE1.1 から出力されます。
いずれのシーケンス番号にも一致しなかったパケットは、通常の方法でルーティングされます。
interface GigaEthernet2.0
  ip policy route-map rmap
ルートマップを GE2.0 に適用します。
GE2.0 で受信したパケットがポリシールーティングの評価対象になります。