NEC IXのIPv4 IPv6ルーティング(static)

スポンサーリンク

NEC IX ルータにおけるIPv4, IPv6 static routeの設定例を紹介します。static routeを設定するには、ip route, ipv6 routeコマンドを使用します。

関連記事 : NEC IX 構築方法

設定まとめ

コマンド一覧

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の設定は入れていません。

R1 : VyOS1.4
set interfaces ethernet eth0 address '192.168.1.1/24'
set interfaces ethernet eth0 address '2001:1::1/64'
set interfaces ethernet eth0 hw-id '00:50:56:90:fa:a9'
set interfaces ethernet eth1 address '192.168.12.1/24'
set interfaces ethernet eth1 address '2001:12::1/64'
set interfaces ethernet eth1 hw-id '00:50:56:90:0d:6f'
set interfaces loopback lo address '2001:10::1/128'
set interfaces loopback lo address '10.1.1.1/32'
set service ssh
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'R1'
set system login user admin authentication encrypted-password '$6$lG0ncSUZMogMH9p3$LekXBmi0/S942wFfLdoo8wDbz1BIU3RP34aLLiw6KEht0Na63PMACvSKBfc9ahIsYpR8Oq8TtylCp6LCRPuEI1'
set system login user vyos authentication encrypted-password '$6$oi8WXPY0U$1zEw/LSjazofZ/LA866G9D08JmPb6gMjBK/5qDpyzAomekPDFKCfcsSzN/gGHUpQNVaM.lZyyFnN05cyL2l9P0'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'
R2 : NEC IX 2015
! NEC Portable Internetwork Core Operating System Software
! IX Series IX2105 (magellan-sec) Software, Version 8.10.11, RELEASE SOFTWARE
! Compiled Aug 02-Fri-2013 13:57:45 JST #2
! Current time Nov 26-Fri-2021 18:11:52 JST
!
!
hostname R2
timezone +09 00
!
!
!
!
!
!
!
!
!
logging buffered 131072
logging subsystem all warn
logging timestamp datetime
!
!       
ip ufs-cache enable
!
!
!
!
!
!
!
!
!
!
telnet-server ip enable
!
!
!
!
!
!
!
!
!
device GigaEthernet0
!       
device GigaEthernet1
!
interface GigaEthernet0.0
  ip address 192.168.23.2/24
  ipv6 address 2001:23::2/64
  no shutdown
!
interface GigaEthernet1.0
  ip address 192.168.12.2/24
  ipv6 address 2001:12::2/64
  no shutdown
!
interface Loopback0.0
  ip address 10.2.2.2/32
  ipv6 address 2001:20::2/128
!
interface Null0.0
  no ip address
R1 : VyOS1.4
set interfaces ethernet eth0 address '192.168.23.3/24'
set interfaces ethernet eth0 address '2001:23::3/64'
set interfaces ethernet eth0 hw-id '00:50:56:90:8d:e0'
set interfaces ethernet eth1 address '192.168.3.3/24'
set interfaces ethernet eth1 address '2001:3::3/64'
set interfaces ethernet eth1 hw-id '00:50:56:90:21:b2'
set interfaces loopback lo address '2001:30::3/128'
set interfaces loopback lo address '10.3.3.3/32'
set service ssh
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'R3'
set system login user admin authentication encrypted-password '$6$lG0ncSUZMogMH9p3$LekXBmi0/S942wFfLdoo8wDbz1BIU3RP34aLLiw6KEht0Na63PMACvSKBfc9ahIsYpR8Oq8TtylCp6LCRPuEI1'
set system login user vyos authentication encrypted-password '$6$oi8WXPY0U$1zEw/LSjazofZ/LA866G9D08JmPb6gMjBK/5qDpyzAomekPDFKCfcsSzN/gGHUpQNVaM.lZyyFnN05cyL2l9P0'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'

動作確認 (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)#  
タイトルとURLをコピーしました