Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active December 4, 2018 06:23
Show Gist options
  • Save hkwi/f713e82dbe6d4abe91d7c969d00216b7 to your computer and use it in GitHub Desktop.
Save hkwi/f713e82dbe6d4abe91d7c969d00216b7 to your computer and use it in GitHub Desktop.
cisco+frrouting vpn/bgp+mpls ibgp

cisco+frrouting vpn/bgp+mpls ibgp

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

Linux の MPLS は loopback を使うことが前提になっている。Linux では LDP を動作させなくても 192.168.0.1 が label 付きパケットを受け取るという前提で動作してしまう。 Cisco は LDP を動作させてから疎通するようになる。以下は LDP をオンにする前後の状態。

before

R1#show mpls ip binding all detail
  100.0.0.1/32, rev 2, chkpt: none
        in label:     imp-null   (owner LDP)
  100.0.0.2/32, rev 6, chkpt: none
        in label:     16         (owner LDP)
  192.168.0.0/24, rev 4, chkpt: none
        in label:     imp-null   (owner LDP)
R1#show mpls ldp bindings
  lib entry: 100.0.0.1/32, rev 2
        local binding:  label: imp-null
  lib entry: 100.0.0.2/32, rev 6
        local binding:  label: 16
  lib entry: 192.168.0.0/24, rev 4
        local binding:  label: imp-null
R1#show mpls forwarding-table
Local  Outgoing      Prefix            Bytes Label   Outgoing   Next Hop
Label  Label or VC   or Tunnel Id      Switched      interface
16     No Label      100.0.0.2/32      0             Fa0/0      192.168.0.2
17     No Label      192.168.1.0/24[V] 0             aggregate/A

after

R1#show mpls ip binding all detail
  100.0.0.1/32, rev 2, chkpt: none
        in label:     imp-null   (owner LDP)
          Advertised to:
          100.0.0.2:0
        out label:    16        lsr: 100.0.0.2:0
  100.0.0.2/32, rev 6, chkpt: none
        in label:     16         (owner LDP)
          Advertised to:
          100.0.0.2:0
        out label:    imp-null  lsr: 100.0.0.2:0      inuse
  192.168.0.0/24, rev 4, chkpt: none
        in label:     imp-null   (owner LDP)
          Advertised to:
          100.0.0.2:0
        out label:    imp-null  lsr: 100.0.0.2:0
R1#show mpls ldp bindings
  lib entry: 100.0.0.1/32, rev 2
        local binding:  label: imp-null
        remote binding: lsr: 100.0.0.2:0, label: 16
  lib entry: 100.0.0.2/32, rev 6
        local binding:  label: 16
        remote binding: lsr: 100.0.0.2:0, label: imp-null
  lib entry: 192.168.0.0/24, rev 4
        local binding:  label: imp-null
        remote binding: lsr: 100.0.0.2:0, label: imp-null
R1#show mpls forwarding-table
Local  Outgoing      Prefix            Bytes Label   Outgoing   Next Hop
Label  Label or VC   or Tunnel Id      Switched      interface
16     Pop Label     100.0.0.2/32      0             Fa0/0      192.168.0.2
17     No Label      192.168.1.0/24[V] 0             aggregate/A
version 12.4
ip cef
ip vrf A
rd 65000:1
route-target both 65000:100
interface lo 0
ip addr 100.0.0.1 255.255.255.255
interface f 0/0
ip addr 192.168.0.1 255.255.255.0
mpls ip
no shutdown
interface e 1/0
ip vrf forwarding A
ip addr 192.168.1.1 255.255.255.0
no shutdown
router bgp 65000
neighbor 100.0.0.2 remote-as 65000
neighbor 100.0.0.2 update-source lo0
address-family vpnv4
neighbor 100.0.0.2 activate
neighbor 100.0.0.2 next-hop-self
address-family ipv4 vrf A
redistribute connected
ip route 100.0.0.2 255.255.255.255 192.168.0.2
end
int lo
ip addr 100.0.0.2/32
int eth0
ip addr 192.168.0.2/24
int eth1 vrf A
ip addr 192.168.2.1/24
mpls ldp
address-family ipv4
discovery transport-address 100.0.0.2
interface eth0
router bgp 65000
neighbor 100.0.0.1 remote-as 65000
neighbor 100.0.0.1 update-source lo
address-family ipv4 vpn
neighbor 100.0.0.1 activate
neighbor 100.0.0.1 next-hop-self
router bgp 65000 vrf A
address-family ipv4
import vpn
export vpn
rd vpn export 65000:2
rt vpn both 65000:100
label vpn export auto
redistribute connected
ip route 100.0.0.1/32 192.168.0.1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment