Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active November 30, 2018 10:08
Show Gist options
  • Save hkwi/5c116f05667a3abf43c7456fae32a529 to your computer and use it in GitHub Desktop.
Save hkwi/5c116f05667a3abf43c7456fae32a529 to your computer and use it in GitHub Desktop.
frrouting vpn/bgp+mpls inter-as option b

frrouting vpn/bgp+mpls inter-as option b

  • with next-hop-self
  • without loopback
  • without bgp labeled-unicast
  • without route-reflector
  • without multi-hop ebgp

r1, r2

exit
ip link add A type vrf table 10
ip link set A up
vtysh
conf t

r3, r4

exit
ip link add A type vrf table 10
ip link set A up
ip link set eth1 master A
vtysh
conf t

BGP-LU は RFC3107 BGP labeled unicast の略の様子。

issue 1 : 経路が入らないことがある。BGP としては受け取って valid になっているが、zebra 側に入らない。 適用順に依存していて、不定な順序の一式を適用する際に、next-hop との順序の問題で入らないようだ。 明示的にアドレスを付けなおして、next-hop のアドレスが広報された後に広報されるようにすると、zebra 側に経路が入ったりする。

issue 2: bgpd がクラッシュする。vrf 指定した bgp インスタンスを先に宣言するとクラッシュした。

Nov 28 01:25:06 localhost daemon.debug bgpd[2012]: Deregistering VRF 0
Nov 28 01:25:06 localhost daemon.crit bgpd[2012]: Assertion `node->lock > 0' failed in file ../lib/table.h, line 238, function route_unlock_node

issue 3: frrouting apline package の watchfrr が bgp クラッシュ検知後に再起動を試みるが、再起動スクリプトが誤っているため bgpd は起動されない。

Diag

r1

# show bgp ipv4 vpn
BGP table version is 3, local router ID is 192.168.1.1, vrf id 0
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
Route Distinguisher: 100.0.0.3:1
*>i192.168.3.0      192.168.1.2         0    100      0 ?
    UN=192.168.1.2 EC{65000:1} label=80 type=bgp, subtype=0
Route Distinguisher: 100.0.0.4:1
*> 192.168.4.0      192.168.0.2                       0 65001 ?
    UN=192.168.0.2 EC{65000:1} label=80 type=bgp, subtype=0

Displayed  2 routes and 2 total paths

r3

# show ip route vrf A
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,
       > - selected route, * - FIB route


VRF A:
C>* 192.168.3.0/24 is directly connected, eth1, 01:21:21
B>* 192.168.4.0/24 [200/0] via 192.168.1.1, eth0(vrf Default-IP-Routing-Table), label 80, 00:20:24
int eth0
ip addr 192.168.0.1/24
int eth1
ip addr 192.168.1.1/24
router bgp 65000
neighbor 192.168.0.2 remote-as 65001
neighbor 192.168.1.2 remote-as 65000
address-family ipv4
neighbor 192.168.0.2 activate
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
redistribute connected
address-family ipv4 vpn
neighbor 192.168.0.2 activate
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
router bgp 65000 vrf A
address-family ipv4
import vpn
export vpn
rd vpn export 100.0.0.1:1
rt vpn both 65000:1
label vpn export auto
redistribute connected
end
int eth0
ip addr 192.168.0.2/24
int eth1
ip addr 192.168.2.1/24
router bgp 65001
neighbor 192.168.0.1 remote-as 65000
neighbor 192.168.2.2 remote-as 65001
address-family ipv4
neighbor 192.168.0.1 activate
neighbor 192.168.2.2 activate
neighbor 192.168.2.2 next-hop-self
redistribute connected
address-family ipv4 vpn
neighbor 192.168.0.1 activate
neighbor 192.168.2.2 activate
neighbor 192.168.2.2 next-hop-self
router bgp 65001 vrf A
address-family ipv4
import vpn
export vpn
rd vpn export 100.0.0.2:1
rt vpn both 65000:1
label vpn export auto
redistribute connected
end
int eth0
ip addr 192.168.1.2/24
int eth1 vrf A
ip addr 192.168.3.1/24
router bgp 65000
neighbor 192.168.1.1 remote-as 65000
address-family ipv4
neighbor 192.168.1.1 activate
redistribute connected
redistribute static
address-family ipv4 vpn
neighbor 192.168.1.1 activate
router bgp 65000 vrf A
address-family ipv4
import vpn
export vpn
rd vpn export 100.0.0.3:1
rt vpn both 65000:1
label vpn export auto
redistribute connected
end
int eth0
ip addr 192.168.2.2/24
int eth1 vrf A
ip addr 192.168.4.1/24
router bgp 65001
neighbor 192.168.2.1 remote-as 65001
address-family ipv4
neighbor 192.168.2.1 activate
redistribute connected
redistribute static
address-family ipv4 vpn
neighbor 192.168.2.1 activate
router bgp 65001 vrf A
address-family ipv4
import vpn
export vpn
rd vpn export 100.0.0.4:1
rt vpn both 65000:1
label vpn export auto
redistribute connected
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment