Binding 2 VRFs to the same BGP instance

Ramanathan Selvamani ramana.it05 at gmail.com
Mon Feb 27 06:28:35 CET 2023


Hi Team,

I am using linux kernel 4.14 and trying to bind 2 vrfs to the same BGP
instance.

The BGP session is established. But the second VRF binding over-writes the
first VRF binding.

Do bird support this 2 vrf binding to the same BGP instance ?

R1
======
ipv4 table T_VRF_RED;
ipv4 table T_VRF_BLUE;

function oro_set_bgp_local_as() {
        bgp_path.prepend(100);
        return true;
}
function redistribute_proto()
{
        if ((source = RTS_BGP)) then {
                return true;
        }
        if (net=0.0.0.0/0) then { return false;}
        if ((source = RTS_DEVICE)) then {
                 return false;
        }
        if (source = RTS_STATIC) then {
                if(net=0.0.0.0/0) then { return false;}
                if (ifname = "lo") then {
                        return false;
                } else {
                        return false;
                }
        }
        if ((source = RTS_CFGSET)) then {
                 return false;
        }
        if ((source = RTS_IAPVPN)) then {
                 return false;
        }
        if ((source = RTS_OAP)) then {
                 return false;
        }
        if (source = RTS_OSPF) then {
                 return false;
        }
        if (source = RTS_OSPF_IA) then {
                 return false;
        }
        if (source = RTS_OSPF_EXT1) then {
                 return false;
        }
        if (source = RTS_OSPF_EXT2) then {
                 return false;
        }
        if ((source = RTS_OSPF) || (source = RTS_OSPF_IA) || (source =
RTS_OSPF_EXT1) || (source = RTS_OSPF_EXT2)) then {
                 return false;
        }
        return false;
}
protocol kernel K_VRF_RED {
        vrf "red";
        kernel table 100;
        scan time 20;

        ipv4 {
                table T_VRF_RED;
                import all;
                export all;
        };
}
protocol kernel K_VRF_BLUE {
        vrf "blue";
        kernel table 200;
        scan time 20;

        ipv4 {
                table T_VRF_BLUE;
                import all;
                export all;
        };
}
protocol direct C_VRF_RED {
        vrf "red";
        ipv4 { table T_VRF_RED; };

}
protocol direct C_VRF_BLUE {
        vrf "blue";
        ipv4 { table T_VRF_BLUE; };

}

protocol static S_VRF_RED {
        vrf "red";
        ipv4 { table T_VRF_RED; };

        route 10.10.1.0/24 blackhole;
}
protocol static S_VRF_BLUE {
        vrf "blue";
        ipv4 { table T_VRF_BLUE; };

        route 10.10.1.0/24 blackhole;
}
protocol bgp B_VRF_RED {
        vrf "red";
        vrf "blue";
        router id 10.16.44.216;
        local 50.0.12.1 as 100;
        neighbor 50.0.12.2  as 100;
        enable as4 on;
        hold time 90;
        keepalive time 30;
        direct;
        # regular IPv4 unicast (1/1)
        ipv4 {
                table T_VRF_RED;
                table T_VRF_BLUE;
                import all;
                export all;
        };
}
R2
======
ipv4 table T_VRF_RED;
ipv4 table T_VRF_BLUE;

function oro_set_bgp_local_as() {
        bgp_path.prepend(100);
        return true;
}
function redistribute_proto()
{
        if ((source = RTS_BGP)) then {
                return true;
        }
        if (net=0.0.0.0/0) then { return false;}
        if ((source = RTS_DEVICE)) then {
                 return false;
        }
        if (source = RTS_STATIC) then {
                if(net=0.0.0.0/0) then { return false;}
                if (ifname = "lo") then {
                        return false;
                } else {
                        return false;
                }
        }
        if ((source = RTS_CFGSET)) then {
                 return false;
        }
        if ((source = RTS_IAPVPN)) then {
                 return false;
        }
        if ((source = RTS_OAP)) then {
                 return false;
        }
        if (source = RTS_OSPF) then {
                 return false;
        }
        if (source = RTS_OSPF_IA) then {
                 return false;
        }
        if (source = RTS_OSPF_EXT1) then {
                 return false;
        }
        if (source = RTS_OSPF_EXT2) then {
                 return false;
        }
        if ((source = RTS_OSPF) || (source = RTS_OSPF_IA) || (source =
RTS_OSPF_EXT1) || (source = RTS_OSPF_EXT2)) then {
                 return false;
        }
        return false;
}
protocol kernel K_VRF_RED {
        vrf "red";
        kernel table 100;
        scan time 20;

        ipv4 {
                table T_VRF_RED;
                import all;
                export all;
        };
}
protocol kernel K_VRF_BLUE {
        vrf "blue";
        kernel table 200;
        scan time 20;

        ipv4 {
                table T_VRF_BLUE;
                import all;
                export all;
        };
}
protocol direct C_VRF_RED {
        vrf "red";
        ipv4 { table T_VRF_RED; };
}
protocol direct C_VRF_BLUE {
        vrf "blue";
        ipv4 { table T_VRF_BLUE; };
}
protocol static S_VRF_RED {
        vrf "red";
        ipv4 { table T_VRF_RED; };

        route 10.10.1.0/24 blackhole;
}
protocol static S_VRF_BLUE {
        vrf "blue";
        ipv4 { table T_VRF_BLUE; };

        route 10.10.1.0/24 blackhole;
}
protocol bgp B_VRF_RED {
        vrf "red";
        vrf "blue";
        router id 10.16.44.217;
        local 50.0.12.2 as 100;
        neighbor 50.0.12.1  as 100;
        enable as4 on;
        hold time 90;
        keepalive time 30;
        direct;
        # regular IPv4 unicast (1/1)
        ipv4 {
                table T_VRF_RED;
                table T_VRF_BLUE;
                import all;
                export all;
        };
}


Thanks,
Ramanathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20230227/d41ce15c/attachment.htm>


More information about the Bird-users mailing list