牧場生まれの牛乳

いろんなことしてる牛乳です。

exabgpでSRv6 L3VPN経路を流すときにハマったことのメモ

よくハマるので走り書きのようなメモ。

exabgpを用いてSRv6 L3VPN経路を広報する際には次のようなconfigを書く。この中で、exabgpから広報するAFI/SAFIのリストにipv4 mpls-vpn, ipv6 mpls-vpnの両方を指定している。だが、実際に広報しているのはIPv4VPN経路のみである。

neighbor fd00::1 {
    router-id 10.0.0.2;
    local-address fd00::2;
    local-as 65182;
    peer-as 65182;

    capability {
        nexthop true;
    }

    family {
        ipv4 mpls-vpn;
        ipv6 mpls-vpn;
    }

    nexthop {
        ipv4 mpls-vpn ipv6;
    }

    static {
        route 172.31.1.0/24 {
            rd 4:100;
            next-hop 2001:db8:1::;
            extended-community [ target:4:100 ];
            label 1024;
            attribute [0x28 0xc0 0x0500220001001e0020010db800010000000000000000000000001300010006281810001040];
        }
    }
}

これは、exabgpがextended nexthopの設定をパースする際に、AFI/SAFIのペアだけでなく、NHAFI/SAFIのペアも広報する設定になっているかどうかをチェックしているためである。

        if neighbor.nexthop:
            nexthops = []
            for family in nexthop:
                nexthops.extend(nexthop[family])
            if nexthops:
                for afi, safi, nhafi in nexthops:
                    if (afi, safi) not in neighbor.families():
                        self.logger.debug(
                            'skipping nexthop afi,safi ' + str(afi) + '/' + str(safi) + ' as it is not negotiated',
                            'configuration',
                        )
                        continue
                    if (nhafi, safi) not in neighbor.families():
                        self.logger.debug(
                            'skipping nexthop afi ' + str(nhafi) + '/' + str(safi) + ' as it is not negotiated',
                            'configuration',
                        )
                        continue
                    neighbor.add_nexthop(afi, safi, nhafi)

github.com