Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active October 12, 2022 14:14
Show Gist options
  • Save higebu/90c0504545978e0cf12cc97b89cb5c81 to your computer and use it in GitHub Desktop.
Save higebu/90c0504545978e0cf12cc97b89cb5c81 to your computer and use it in GitHub Desktop.
Usage of gobgp BGP-MUP Support

BGP Extensions for the Mobile User Plane (MUP) SAFI

https://datatracker.ietf.org/doc/html/draft-mpmz-bess-mup-safi-01

gobgpd configs

gobgpd1.toml

[global.config]
    as = 65000
    router-id = "10.0.0.1"
    local-address-list = ["10.0.0.1"]

[[neighbors]]
    [neighbors.config]
        peer-as = 65000
        local-as = 65000
        neighbor-address = "10.0.0.2"
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv4-mup"
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv6-mup"

gobgpd2.toml

[global.config]
    as = 65000
    router-id = "10.0.0.2"
    local-address-list = ["10.0.0.2"]

[[neighbors]]
    [neighbors.config]
        peer-as = 65000
        local-as = 65000
        neighbor-address = "10.0.0.1"
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv4-mup"
    [[neighbors.afi-safis]]
        [neighbors.afi-safis.config]
            afi-safi-name = "ipv6-mup"

Setup netns

sudo ip link add veth0 type veth peer name veth1

sudo ip netns add red
sudo ip link set veth0 netns red
sudo ip netns exec red ip link set up lo
sudo ip netns exec red ip link set up veth0
sudo ip netns exec red ip addr add 10.0.0.1/24 dev veth0

sudo ip netns add blue
sudo ip link set veth1 netns blue
sudo ip netns exec blue ip link set up lo
sudo ip netns exec blue ip link set up veth1
sudo ip netns exec blue ip addr add 10.0.0.2/24 dev veth1

Start gobgpd

sudo ip netns exec red ./gobgpd -f ./gobgp1.toml
sudo ip netns exec blue ./gobgpd -f ./gobgp2.toml

ipv4-mup

Add MUP Routes (IPv4)

sudo ip netns exec red ./gobgp global rib add -a ipv4-mup isd 10.0.0.0/24 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior ENDM_GTP4E rt 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib add -a ipv4-mup dsd 10.0.0.1 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior END_DT4 rt 10:10 mup 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib add -a ipv4-mup t1st 192.168.0.1/32 rd 100:100 rt 10:10 teid 12345 qfi 9 endpoint 10.0.0.1 nexthop 10.0.0.2
sudo ip netns exec red ./gobgp global rib add -a ipv4-mup t2st 10.0.0.1 rd 100:100 rt 10:10 teid 12345 mup 10:10 nexthop 10.0.0.2

Show MUP Routes (IPv4)

$ sudo ip netns exec red ./gobgp global rib -a ipv4-mup
   Network                                                                              Next Hop             AS_PATH              Age        Attrs
*> [type:dsd][rd:100:100][prefix:10.0.0.1]                                              2001::2                                   00:00:05   [{Origin: ?} {Extcomms: [10:10], [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 19 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]
*> [type:t1st][rd:100:100][prefix:192.168.0.1/32][teid:12345][qfi:9][endpoint:10.0.0.1] 10.0.0.2                                  00:00:05   [{Origin: ?} {Extcomms: [10:10]}]
*> [type:t2st][rd:100:100][endpoint:10.0.0.1][teid:12345]                               10.0.0.2                                  00:00:05   [{Origin: ?} {Extcomms: [10:10], [10:10]}]
*> [type:isd][rd:100:100][prefix:10.0.0.0/24]                                           2001::2                                   00:00:05   [{Origin: ?} {Extcomms: [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 72 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]

$ sudo ip netns exec blue ./gobgp global rib -a ipv4-mup   Network                                                                              Next Hop             AS_PATH              Age        Attrs
*> [type:t1st][rd:100:100][prefix:192.168.0.1/32][teid:12345][qfi:9][endpoint:10.0.0.1] 10.0.0.2                                  00:00:41   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10]}]
*> [type:t2st][rd:100:100][endpoint:10.0.0.1][teid:12345]                               10.0.0.2                                  00:00:41   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10], [10:10]}]
*> [type:isd][rd:100:100][prefix:10.0.0.0/24]                                           2001::2                                   00:00:41   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 72 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]
*> [type:dsd][rd:100:100][prefix:10.0.0.1]                                              2001::2                                   00:00:41   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10], [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 19 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]

Delete MUP Routes (IPv4)

sudo ip netns exec red ./gobgp global rib del -a ipv4-mup isd 10.0.0.0/24 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior ENDM_GTP4E rt 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib del -a ipv4-mup dsd 10.0.0.1 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior END_DT4 rt 10:10 mup 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib del -a ipv4-mup t1st 192.168.0.1/32 rd 100:100 rt 10:10 teid 12345 qfi 9 endpoint 10.0.0.1 nexthop 10.0.0.2
sudo ip netns exec red ./gobgp global rib del -a ipv4-mup t2st 10.0.0.1 rd 100:100 rt 10:10 teid 12345 mup 10:10 nexthop 10.0.0.2

ipv6-mup

Add MUP Routes (IPv6)

sudo ip netns exec red ./gobgp global rib add -a ipv6-mup isd 2001::/64 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior ENDM_GTP6E rt 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib add -a ipv6-mup dsd 2001::1 rd 100:100 prefix 2001:db8:2:2::/64 locator-node-length 24 function-length 16 behavior END_DT6 rt 10:10 mup 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib add -a ipv6-mup t1st 2001:db8:1:1::1/128 rd 100:100 rt 10:10 teid 12345 qfi 9 endpoint 2001::1 nexthop 10.0.0.2
sudo ip netns exec red ./gobgp global rib add -a ipv6-mup t2st 2001::1 rd 100:100 rt 10:10 teid 12345 mup 10:10 nexthop 10.0.0.2

Show MUP Routes (IPv6)

$ sudo ip netns exec red ./gobgp global rib -a ipv6-mup
   Network                                                                                  Next Hop             AS_PATH              Age        Attrs
*> [type:t2st][rd:100:100][endpoint:2001::1][teid:12345]                                    10.0.0.2                                  00:00:09   [{Origin: ?} {Extcomms: [10:10], [10:10]}]
*> [type:isd][rd:100:100][prefix:2001::/64]                                                 2001::2                                   00:00:10   [{Origin: ?} {Extcomms: [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 71 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]
*> [type:dsd][rd:100:100][prefix:2001::1]                                                   2001::2                                   00:00:10   [{Origin: ?} {Extcomms: [10:10], [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:2:2:: Flag: 0 Endpoint Behavior: 18 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]
*> [type:t1st][rd:100:100][prefix:2001:db8:1:1::1/128][teid:12345][qfi:9][endpoint:2001::1] 10.0.0.2                                  00:00:10   [{Origin: ?} {Extcomms: [10:10]}]

$ sudo ip netns exec blue ./gobgp global rib -a ipv6-mup
   Network                                                                                  Next Hop             AS_PATH              Age        Attrs
*> [type:t1st][rd:100:100][prefix:2001:db8:1:1::1/128][teid:12345][qfi:9][endpoint:2001::1] 10.0.0.2                                  00:00:34   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10]}]
*> [type:t2st][rd:100:100][endpoint:2001::1][teid:12345]                                    10.0.0.2                                  00:00:33   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10], [10:10]}]
*> [type:isd][rd:100:100][prefix:2001::/64]                                                 2001::2                                   00:00:34   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:1:1:: Flag: 0 Endpoint Behavior: 71 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]
*> [type:dsd][rd:100:100][prefix:2001::1]                                                   2001::2                                   00:00:34   [{Origin: ?} {LocalPref: 100} {Extcomms: [10:10], [10:10]} {Prefix SID attributes: {SRv6 L3 Service Attribute: {SRv6 Information Sub TLV: SID: 2001:db8:2:2:: Flag: 0 Endpoint Behavior: 18 {SRv6 Structure Sub Sub TLV: [ Locator Block Length: 40, Locator Node Length: 24, Function Length: 16, Argument Length: 0, Transposition Length: 0, Transposition Offset: 0] } } } }]

Delete MUP Routes (IPv6)

sudo ip netns exec red ./gobgp global rib del -a ipv6-mup isd 2001::/64 rd 100:100 prefix 2001:db8:1:1::/64 locator-node-length 24 function-length 16 behavior ENDM_GTP6E rt 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib del -a ipv6-mup dsd 2001::1 rd 100:100 prefix 2001:db8:2:2::/64 locator-node-length 24 function-length 16 behavior END_DT6 rt 10:10 mup 10:10 nexthop 2001::2
sudo ip netns exec red ./gobgp global rib del -a ipv6-mup t1st 2001:db8:1:1::1/128 rd 100:100 rt 10:10 teid 12345 qfi 9 endpoint 2001::1 nexthop 10.0.0.2
sudo ip netns exec red ./gobgp global rib del -a ipv6-mup t2st 2001::1 rd 100:100 rt 10:10 teid 12345 mup 10:10 nexthop 10.0.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment