NEC IX ルータにおけるIPv4, IPv6 static routeの設定例を紹介します。static routeを設定するには、ip route, ipv6 routeコマンドを使用します。
設定まとめ
コマンド一覧
static routeに関連するコマンド一覧は以下の通りです。
Router(config)# ip route default <next_hop> [ <interface> ] Router(config)# ipv6 route default <next_hop> [ <interface> ] Router(config)# ip route <destination> <next_hop> [ <interface> ] Router(config)# ipv6 route <destination> <next_hop> [ <interface> ]
デフォルトゲートウェイ設定
以下のようなコマンドでデフォルトゲートウェイをstaicに設定する事ができます。
Router(config)# ip route default <next_hop> [ <interface> ] Router(config)# ipv6 route default <next_hop> [ <interface> ]
スタティックルート設定
スタティックルートの設定は以下コマンドを使用します。
Router(config)# ip route <destination> <next_hop> [ <interface> ] Router(config)# ipv6 route <destination> <next_hop> [ <interface> ]
動作確認
動作確認の構成
以下の環境で動作確認を行います。
|
| 192.168.3.0/24
| 2001:3::/64
|
| .3
eth1 | :3
+-------+----------+
| VyOS 1.4 |
| R3 |
| Lo:10.3.3.3/32 |
| 2001:30::3/128|
+-------+----------+
eth0 | .3
| :3
|
| 192.168.23.0/24
| 2001:23::/64
|
| .2
G0.0 | :2
+-------+----------+
| NEC IX 2015 |
| R2 |
| Lo:10.2.2.2/32 |
| 2001:20::2/128|
+-------+----------+
G1.0 | .2
| :2
|
| 192.168.12.0/24
| 2001:12::/64
|
| .1
eth1 | :1
+-------+----------+
| VyOS 1.4 |
| R1 |
| Lo:10.1.1.1/32 |
| 2001:10::1/128|
+-------+----------+
eth0 | .1
| :1
|
| 192.168.1.0/24
| 2001:1::/64
|
初期設定
初期設定はIPアドレスのみとします。NATの設定は入れていません。
動作確認 (1) IPv4 static route
設定投入
互いに疎通可能になるstatic routeを定義します。
[R1:VyOS1.4] set protocols static route 0.0.0.0/0 next-hop 192.168.12.2
[R2:IX2015] ip route 10.1.1.1/32 192.168.12.1 ip route 10.3.3.3/32 192.168.23.3 ip route 192.168.1.0/24 192.168.12.1 ip route 192.168.3.0/24 192.168.23.3
[R3:VyOS1.4] set protocols static route 0.0.0.0/0 next-hop 192.168.23.2
疎通確認
R2からR1, R3への疎通を確認します。
[R2:IX2015] R2(config)# ping 10.1.1.1 count 3 PING 192.168.12.2 > 10.1.1.1 56 data bytes 64 bytes from 10.1.1.1: icmp_seq=0 ttl=64 time=0.472 ms 64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.566 ms 64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.539 ms --- 10.1.1.1 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0.472/0.525/0.566 R2(config)# R2(config)# R2(config)# R2(config)# ping 10.3.3.3 count 3 PING 192.168.23.2 > 10.3.3.3 56 data bytes 64 bytes from 10.3.3.3: icmp_seq=0 ttl=64 time=0.418 ms 64 bytes from 10.3.3.3: icmp_seq=1 ttl=64 time=0.495 ms 64 bytes from 10.3.3.3: icmp_seq=2 ttl=64 time=0.528 ms --- 10.3.3.3 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0.418/0.480/0.528 R2(config)#
動作確認 (2) IPv6 static route
設定投入
互いに疎通可能になるstatic routeを定義します。
[R1:VyOS1.4] set protocols static route6 ::/0 next-hop 2001:12::2
[R2:IX2015] ipv6 route 2001:10::1/128 2001:12::1 ipv6 route 2001:1::/64 2001:12::1 ipv6 route 2001:30::3/128 2001:23::3 ipv6 route 2001:3::/64 2001:23::3
[R3:VyOS1.4] set protocols static route6 ::/0 next-hop 2001:23::2
疎通確認
R2からR1, R3への疎通を確認します。NEC IXでIPv6 pingを実行するにはping6コマンドを使います。
[R2:IX2015] R2(config)# ping6 2001:10::1 count 3 PING 2001:12::2 > 2001:10::1 56 data bytes 64 bytes from 2001:10::1 icmp_seq=0 hlim=64 time=0.511 ms 64 bytes from 2001:10::1 icmp_seq=1 hlim=64 time=0.560 ms 64 bytes from 2001:10::1 icmp_seq=2 hlim=64 time=0.572 ms --- 2001:10::1 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0.511/0.547/0.572 R2(config)# R2(config)# R2(config)# R2(config)# ping6 2001:30::3 count 3 PING 2001:23::2 > 2001:30::3 56 data bytes 64 bytes from 2001:30::3 icmp_seq=0 hlim=64 time=0.555 ms 64 bytes from 2001:30::3 icmp_seq=1 hlim=64 time=1.030 ms 64 bytes from 2001:30::3 icmp_seq=2 hlim=64 time=0.450 ms --- 2001:30::3 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip (ms) min/avg/max = 0.450/0.678/1.030 R2(config)#
