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

スポンサーリンク

NEC IX ルータにおけるIPv4, IPv6 ospf routingの設定例を紹介します。IPv4におけるOSPFはOSPFv2と呼ばれ、IPv6におけるOSPFはOSPFv3と呼ばれます。

設定まとめ

コマンド一覧

OSPFに関連するコマンド一覧は以下の通りです。

Router(config)# ip router ospf <proc_num>
Router(config-ospfv2-1)# router-id <id>
Router(config-ospfv2-1)# network <addr>/<mask> area <area_num>

Router(config)# ipv6 router ospf <proc_num>
Router(config-ospfv3-1)# router-id <id>
Router(config-ospfv3-1)# network <interface> area <area_num>

OSPFv2 (IPv4 OSPF)

OSPFv2の最小限の設定は以下networkコマンドの一文のみです。

Router(config)# ip router ospf <proc_num>
Router(config-ospfv2-1)# network <addr>/<mask> area <area_num>

必要に応じて、以下コマンドでrouter-idを明示指定する事ができます。

Router(config)# ip router ospf <proc_num>
Router(config-ospfv2-1)# router-id <id>

OSPFv3 (IPv4 OSPF)

OSPFv3を設定するにはrouter-idを明示指定する必要があります。router-idは、IPv6 OSPFであってもIPv4形式である32bitの文字列を指定する必要があります。

ネットワークOS(例:Cisco IOS XEなど)によっては、Loopbackなどに付与されたIPv4アドレスがrouter-idとして採番される挙動の機器が多いです。もちろん、「混乱を避ける」「router-idのバッティング事故を避ける」目的で明示的にrouter-idを指定するのは悪い事ではありません。

Router(config)# ipv6 router ospf <proc_num>
Router(config-ospfv3-1)# router-id <id>

networkコマンドで、OSPFを有効にするインターフェースを指定します。

Router(config)# ipv6 router ospf <proc_num>
Router(config-ospfv3-1)# network <interface> area <area_num>

動作確認

動作確認の構成

以下の環境で動作確認を行います。

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

設定投入

互いに疎通可能になるようOSPFv2を設定します。

[R1:VyOS1.4]
set protocols ospf area 0 network '192.168.1.0/24'
set protocols ospf area 0 network '192.168.12.0/24'
set protocols ospf area 0 network '10.1.1.1/32'
[R2:IX2015]
ip router ospf 1
  network 192.168.12.0/24 area 0
  network 192.168.23.0/24 area 0
  network 10.2.2.2/32 area 0
[R3:VyOS1.4]
set protocols ospf area 0 network '192.168.23.0/24'
set protocols ospf area 0 network '192.168.3.0/24'
set protocols ospf area 0 network '10.3.3.3/32'

疎通確認

互いにprefixを交換できている事を確認します。

[R2:IX2015]
R2(config)# show ip route ospf 
IP Routing Table - 4 entries, 5 hidden, 2039 frees
Entries: 0 Connected, 0 Static, 0 RIP, 4 OSPF, 0 BGP
Codes: C - Connected, S - Static, R - RIP, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, B - BGP
       * - Candidate default, s - Summary
Timers: Age
O      10.1.1.1/32 [110/1] via 192.168.12.1, GigaEthernet1.0, 0:10:19
O      10.3.3.3/32 [110/1] via 192.168.23.3, GigaEthernet0.0, 0:00:45
O    192.168.1.0/24 [110/2] via 192.168.12.1, GigaEthernet1.0, 0:10:19
O    192.168.3.0/24 [110/2] via 192.168.23.3, GigaEthernet0.0, 0:00:45
R2(config)# 

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.476 ms
64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.509 ms
64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.513 ms

--- 10.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0.476/0.499/0.513
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.537 ms
64 bytes from 10.3.3.3: icmp_seq=1 ttl=64 time=0.489 ms
64 bytes from 10.3.3.3: icmp_seq=2 ttl=64 time=0.411 ms

--- 10.3.3.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0.411/0.479/0.537
R2(config)# 

動作確認 (2) IPv6 OSPFv3

設定投入

互いに疎通可能になるOSPFv3を設定します。

[R1:VyOS1.4]
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'eth1'
set protocols ospfv3 area 0 interface 'lo'
[R2:IX2015]
ipv6 router ospf 1
  network GigaEthernet1.0 area 0
  network GigaEthernet0.0 area 0
  network Loopback0.0 area 0
[R3:VyOS1.4]
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'eth1'
set protocols ospfv3 area 0 interface 'lo'

このまでの設定が完了した時点で”show ipv6 ospf interface”の出力を観察します。router-idを明示的に指定する前はOSPFv3はDOWN状態である事に注意ください。

[R2:IX2015]
R2(config)# show ipv6 ospf interface 
Interface           ID    InstID ProcID AreaID     State     Cost   Pri  Nbrs
GigaEthernet0.0     1     0      1      0          DOWN      0      0    0/0
GigaEthernet1.0     2     0      1      0          DOWN      0      0    0/0
Loopback0.0         113   0      1      0          DOWN      0      0    0/0
R2(config)# 

router-idを設定します。設定後、”clear ipv6 ospf process”で再起動するように促されます。

[R2:IX2015]
R2(config)# ipv6 router ospf 1
R2(config-ospfv3-1)# router-id 10.2.2.2
% Reload or use "clear ipv6 ospf process" command, for this to take effect
R2(config-ospfv3-1)#     

router-id設定後、OSPFv3 interfaceが有効になった事を確認します。

[R2:IX2015]
R2(config)# show ipv6 ospf interface 
Interface           ID    InstID ProcID AreaID     State     Cost   Pri  Nbrs
GigaEthernet0.0     1     0      1      0          BACKUP    1      1    1/1
GigaEthernet1.0     2     0      1      0          BACKUP    1      1    1/1
Loopback0.0         113   0      1      0          LOOPBACK  1      1    0/0
R2(config)# 

疎通確認

互いにprefixを交換できている事を確認します。

[R2:IX2015]
R2(config)# show ipv6 route ospf 
IPv6 Routing Table - 9 entries, unlimited
Codes: C - Connected, L - Local, S - Static
       R - RIPng, O - OSPF, IA - OSPF inter area
       E1 - OSPF external type 1, E2 - OSPF external type 2, B - BGP
       s - Summary
Timers: Uptime/Age
O      2001:1::/64 global [110/1]
         via ::, GigaEthernet0.0, 0:06:21/0:00:00
O      2001:3::/64 global [110/1]
         via ::, GigaEthernet1.0, 0:06:21/0:00:00
O      2001:10::1/128 global [110/11]
         via fe80::250:56ff:fe90:d6f, GigaEthernet1.0, 0:06:21/0:00:00
O      2001:12::/64 global [110/1]
         via ::, GigaEthernet1.0, 0:06:21/0:00:00
O      2001:20::2/128 global [110/1]
         via ::, Loopback0.0, 0:06:21/0:00:00
O      2001:23::/64 global [110/1]
         via ::, GigaEthernet0.0, 0:06:21/0:00:00
O      2001:30::3/128 global [110/11]
         via fe80::250:56ff:fe90:8de0, GigaEthernet0.0, 0:06:21/0:00:00
R2(config)# 

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.705 ms
64 bytes from 2001:10::1 icmp_seq=1 hlim=64 time=0.470 ms
64 bytes from 2001:10::1 icmp_seq=2 hlim=64 time=0.481 ms

--- 2001:10::1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0.470/0.552/0.705
R2(config)# 
R2(config)# 
R2(config)# 
R2(config)# ping6 2001:30::3 count 3
PING 2001:12::2 > 2001:30::3 56 data bytes
64 bytes from 2001:30::3 icmp_seq=0 hlim=64 time=0.858 ms
64 bytes from 2001:30::3 icmp_seq=1 hlim=64 time=0.537 ms
64 bytes from 2001:30::3 icmp_seq=2 hlim=64 time=0.577 ms

--- 2001:30::3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0.537/0.657/0.858
R2(config)# 
タイトルとURLをコピーしました