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

スポンサーリンク

NEC IX ルータにおけるBGP routingの設定例を紹介します。BGPは、IPv6, multicastなどの様々なアドレス体系を伝播できるプロトコルですが、2021年3月時点のコマンドリファレンスを見る限りNEC IXはIPv6をサポートしないようです。

設定まとめ

コマンド一覧

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

Router(config)# router bgp <own_as>
Router(config-bgp)# neighbor <remote_addr> remote <remote_as> 
Router(config-bgp)# neighbor <remote_addr> password <passwd>
Router(config-bgp)# neighbor <remote_addr> route-reflector-client
Router(config-bgp)# neighbor <remote_addr> update-source <passwd>

BGP neighbor

以下のコマンドでBGP neighborを確立する事ができます。

Router(config)# router bgp <local_as>
Router(config-bgp)# neighbor <remote_addr> remote <remote_as> 

以下のようなコマンド群でneihgborに関する詳細な設定ができます。

Router(config)# router bgp <local_as>
Router(config-bgp)# neighbor <remote_addr> password <passwd>
Router(config-bgp)# neighbor <remote_addr> route-reflector-client
Router(config-bgp)# neighbor <remote_addr> update-source <passwd>

以下はBGP neighbor設定に関するヘルプストリングです。Cisco IOS XEと比較すると選択肢は少なめです。限られた機能で要件を満たす事ができるか、満たせないならば落とし所は現実的なのかを十分に考えましょう。

Router(config-bgp)# neighbor X.X.X.X ?
  advertisement-interval  -- Minimum interval between route advertisement
  connect-interval        -- BGP per neighbor connect interval
  description             -- Neighbor specific description
  ebgp-multihop           -- Allow EBGP neighbors not directly connected
  password                -- Set a password for TCP MD5 signature option
  receive-capability      -- Override receive capability
  remote-as               -- Specify a BGP neighbor
  route-reflector-client  -- Configure a neighbor as Route Reflector client
  send-capability         -- Send-capability configuration
  shutdown                -- Administratively shut down this neighbor
  timers                  -- BGP per neighbor timers
  update-source           -- Source of routing updates
Router(config-bgp)# neighbor  X.X.X.X

BGP advertise

BGPはnetworkコマンドを使ってprefixを広報します。広報されるのはルーティングテーブルに載っているprefixのみです。

NEC IXの場合は以下のように”address-family ipv4 unicast”を指定してからnetworkコマンドを実行します。他のネットワークOSでは複数のaddress-family(例:IPv6, EVPNなど)を指定できるようにaddress-familyコマンドを設けますが、NEC IXではipv4 unicastしか指定できません。

Router(config)# router bgp <local_as>
Router(config-bgp)# address-family ipv4 unicast 
Router(config-bgp-af4)# network <prefix>

動作確認

動作確認の構成

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

        |
        | 192.168.3.0/24
        | 
   eth1 | .3
+-------+----------+
|    VyOS 1.4      | 
|        R3        |
| Lo:10.3.3.3/32   |
+-------+----------+
   eth0 | .3
        |
        | 192.168.23.0/24
        | 
   G0.0 | .2 
+-------+----------+ 
|    NEC IX 2015   | 
|        R2        |
| Lo:10.2.2.2/32   |
+-------+----------+
   G1.0 | .2
        |
        | 192.168.12.0/24
        |
   eth1 | .1
+-------+----------+ 
|    VyOS 1.4      | 
|        R1        |
| Lo:10.1.1.1/32   |
+-------+----------+
   eth0 | .1
        |
        | 192.168.1.0/24
        |

初期設定

初期設定はIPアドレスのみとします。NATの設定は入れていません。

R1 : VyOS1.4
set interfaces ethernet eth0 address '192.168.1.1/24'
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 hw-id '00:50:56:90:0d:6f'
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
  no shutdown
!
interface GigaEthernet1.0
  ip address 192.168.12.2/24
  no shutdown
!
interface Loopback0.0
  ip address 10.2.2.2/32
!
interface Null0.0
  no ip address
R1 : VyOS1.4
set interfaces ethernet eth0 address '192.168.23.3/24'
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 hw-id '00:50:56:90:21:b2'
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) BGP neighbor確立

設定投入

R1, R2, R3の間でiBGP neighborを確立します。AS番号は全機器65000とします。

[R1:VyOS1.4]
set protocols bgp address-family ipv4-unicast network 10.1.1.1/32
set protocols bgp address-family ipv4-unicast network 192.168.1.0/24
set protocols bgp local-as '65000'
set protocols bgp neighbor 192.168.12.2 remote-as '65000'
[R2:IX2015]
router bgp 65000
  neighbor 192.168.12.1 remote-as 65000
  neighbor 192.168.23.3 remote-as 65000
[R3:VyOS1.4]
set protocols bgp address-family ipv4-unicast network 10.3.3.3/32
set protocols bgp address-family ipv4-unicast network 192.168.3.0/24
set protocols bgp local-as '65000'
set protocols bgp neighbor 192.168.23.2 remote-as '65000'

疎通確認

R2がR1, R3からprefixを受け取っている事を確認します。

[R2:IX2015]
R2(config)# show ip route bgp 
IP Routing Table - 4 entries, 5 hidden, 2039 frees
Entries: 0 Connected, 0 Static, 0 RIP, 0 OSPF, 4 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
B      10.1.1.1/32 [200/0] via 192.168.12.1, GigaEthernet1.0, 0:02:27
B      10.3.3.3/32 [200/0] via 192.168.23.3, GigaEthernet0.0, 0:00:27
B    192.168.1.0/24 [200/0] via 192.168.12.1, GigaEthernet1.0, 0:02:27
B    192.168.3.0/24 [200/0] via 192.168.23.3, GigaEthernet0.0, 0:00:27
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.346 ms
64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.523 ms
64 bytes from 10.1.1.1: icmp_seq=2 ttl=64 time=0.553 ms

--- 10.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip (ms)  min/avg/max = 0.346/0.474/0.553
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.512 ms
64 bytes from 10.3.3.3: icmp_seq=1 ttl=64 time=0.419 ms
64 bytes from 10.3.3.3: icmp_seq=2 ttl=64 time=0.446 ms

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

動作確認 (2) route reflector

問題点の把握

ここまでの設定ではR1, R3間で疎通はできません。R1はR2からprefixを受信していません。”show ip bgp neighbors 192.168.12.2 routes”は受信したprefix一覧を表示するコマンドですが、何も表示されません。つまり、prefixを受け取っていない事を表します。

[R1:VyOS1.4]
admin@R1:~$ show ip bgp neighbors 192.168.12.2 routes 
admin@R1:~$ 
admin@R1:~$ 
admin@R1:~$ 
admin@R1:~$ show ip bgp summary 

IPv4 Unicast Summary:
BGP router identifier 10.1.1.1, local AS number 65000 vrf-id 0
BGP table version 2
RIB entries 3, using 576 bytes of memory
Peers 1, using 21 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.12.2    4      65000        10        10        0    0    0 00:04:41            0        2

Total number of neighbors 1
admin@R1:~$ 

設定投入

デフォルトでは、iBGPは教えられたprefixを教え返さないsplit horizonと呼ばれるルールが働きます。このデフォルトの挙動を打ち消すにはroute reflectorと呼ばれる設定を入れます。

NEC IXの場合は以下のようなコマンドになります。

[R2:IX2015]
router bgp 65000
  neighbor 192.168.12.1 route-reflector-client
  neighbor 192.168.12.1 route-reflector-client

設定投入時に、以下のようにneighbor再起動を促されるメッセージが表示されます。

[R2:IX2015]
R2(config)# router bgp 65000
R2(config-bgp)# 
R2(config-bgp)# neighbor 192.168.12.1 route-reflector-client 
% Need to reset neighbor 192.168.12.1 to take effect of the command.
R2(config-bgp)# 


neighborを再起動するとroute reflectorの設定が反映されます。


[R2:IX2015]
clear ip bgp *

設定確認

R1がR2からprefixを受信できている事を確認します。

[R1:VyOS1.4]
admin@R1:~$ show ip bgp neighbors 192.168.12.2 routes 
BGP table version is 2, local router ID is 10.1.1.1, vrf id 0
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
  i10.3.3.3/32      192.168.23.3             0    100      0 i
  i192.168.3.0/24   192.168.23.3             0    100      0 i

Displayed  2 routes and 4 total paths
admin@R1:~$ 
admin@R1:~$ 
admin@R1:~$ 
admin@R1:~$ show ip bgp summary 

IPv4 Unicast Summary:
BGP router identifier 10.1.1.1, local AS number 65000 vrf-id 0
BGP table version 2
RIB entries 7, using 1344 bytes of memory
Peers 1, using 21 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
192.168.12.2    4      65000       127       124        0    0    0 01:47:40            2        2

Total number of neighbors 1
admin@R1:~$ 

動作確認 (3) next hop 到達性

問題点の把握

R1はR2からprefixをBGPによって受信しているにもかかわらず、ルーティングテーブルにエントリが見られません。

[R1:VyOS1.4]
admin@R1:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

C>* 10.1.1.1/32 is directly connected, lo, 03:46:42
C>* 192.168.1.0/24 is directly connected, eth0, 05:03:59
C>* 192.168.12.0/24 is directly connected, eth1, 03:25:12
admin@R1:~$ 

BGPテーブルに着目します。10.3.3.3を例に挙げると、validを意味する「*」が付与されていません。これはNext Hopである192.168.23.3に到達できないためです。

[R1:VyOS1.4]
admin@R1:~$ show ip bgp 
BGP table version is 10, local router ID is 10.1.1.1, vrf id 0
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.1/32      0.0.0.0                  0         32768 i
  i10.3.3.3/32      192.168.23.3             0    100      0 i
*> 192.168.1.0/24   0.0.0.0                  0         32768 i
  i192.168.3.0/24   192.168.23.3             0    100      0 i

Displayed  4 routes and 4 total paths
admin@R1:~$ 

設定投入

このような状況の解決策のひとつとして、一般的にはNext Hopへ到達できるように自分自身をNext Hopとして指定する「Next Hop Self」と呼ばれる機能があります。しかし、NEC IXはNext Hop Selfの機能が備わっていません。

Next Hop Selfの代わりに、192.168.12.0/24と192.168.23.0/24をBGPでAdvertiseします。そうすれば前述のNext Hop到達性の問題は解消されます。

[R2:IX2015]
router bgp 65000
  address-family ipv4 unicast 
    network 192.168.12.0/24
    network 192.168.23.0/24

設定確認

設定変更後、BGPテーブルにvalidを意味する「*」が付与された事を確認します。

[R1:VyOS1.4]
admin@R1:~$ show ip bgp 
BGP table version is 6, local router ID is 10.1.1.1, vrf id 0
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.1/32      0.0.0.0                  0         32768 i
*>i10.3.3.3/32      192.168.23.3             0    100      0 i
*> 192.168.1.0/24   0.0.0.0                  0         32768 i
*>i192.168.3.0/24   192.168.23.3             0    100      0 i
*>i192.168.12.0/24  192.168.12.2             1    100      0 i
*>i192.168.23.0/24  192.168.12.2             1    100      0 i

Displayed  6 routes and 6 total paths
admin@R1:~$ 

ルーティングテーブルにBGPのエントリが載った事を確認します。

[R1:VyOS1.4]
admin@R1:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

C>* 10.1.1.1/32 is directly connected, lo, 03:49:56
B>  10.3.3.3/32 [200/0] via 192.168.23.3 (recursive), weight 1, 00:00:27
  *                       via 192.168.12.2, eth1, weight 1, 00:00:27
C>* 192.168.1.0/24 is directly connected, eth0, 05:07:13
B>  192.168.3.0/24 [200/0] via 192.168.23.3 (recursive), weight 1, 00:00:27
  *                          via 192.168.12.2, eth1, weight 1, 00:00:27
B   192.168.12.0/24 [200/1] via 192.168.12.2 inactive, weight 1, 00:01:38
C>* 192.168.12.0/24 is directly connected, eth1, 03:28:26
B>* 192.168.23.0/24 [200/1] via 192.168.12.2, eth1, weight 1, 00:00:27
admin@R1:~$ 
タイトルとURLをコピーしました