How to advertise two virtual IPs using BGP?

Alexander Zubkov green at qrator.net
Wed Nov 20 09:02:55 CET 2024


Hi Hans,

What about just adding it to your LOCAL_NET list? If it works for the first
IP, why it shouldn't work for the other?

On Wed, Nov 20, 2024 at 8:36 AM Hans Heng via Bird-users <
bird-users at network.cz> wrote:

> Hi all!
>
> I have a dual-home server, whose connection topology and configuration is described as below.
>
>
> **** Connection Topology and Configuration ****
>
> The server has two physical NICs enp4s0f0 and enp4s0f1, which are connected to two separate ports TOR_A and TOR_B on a Top of Rack (TOR) router, each representing a separate BGP session through bgp_A and bgp_B protocol.
>
> The server also has a dummy interface named em5, which has a private ip 38.145.72.193/32.
>
> Bird kernel protocol exports an ECMP routing rule to kernel as a kernel default routing, and bgp_A/bgp_B protocol export the private ip to my internet, then 38.145.72.193/32 on em5 acts as a public ip.
>
>
> ****   My goal ****
>
> I want to add another virtual ip on em5, say 38.145.72.198/32, and let this new virtual ip act as a public ip too.
> Can this requirement be met? If yes, how should I modify the configuration to make BGP advertise this ip over my internet?
>
>
>
> **** Additional Information on Server ****
>
>
> ## bird setup an ECMP route on 2 phy nics as default route,
> ## which set source ip to the public ip
> $ ip route
> default proto bird src 38.145.72.193 metric 32
>         nexthop via 10.105.1.10 dev enp4s0f0 weight 1
>         nexthop via 10.105.1.12 dev enp4s0f1 weight 110.105.1.10/31 dev enp4s0f0 proto kernel scope link src 10.105.1.1110.105.1.12/31 dev enp4s0f1 proto kernel scope link src 10.105.1.13
>
>
> bird> show route all
> Table master4:0.0.0.0/0            unicast [bgp_A 2024-11-17] * (100) [AS4212010101i]
>         via 10.105.1.10 on enp5s0f0
>         Type: BGP univ
>         BGP.origin: IGP
>         BGP.as_path: 4259105001 4212010101
>         BGP.next_hop: 10.105.1.10
>         BGP.local_pref: 0
>                      unicast [bgp_B 2024-11-18] (100) [AS4212010101i]
>         via 10.105.1.12 on enp5s0f1
>         Type: BGP univ
>         BGP.origin: IGP
>         BGP.as_path: 4259205001 4212010101
>         BGP.next_hop: 10.105.1.12
>         BGP.local_pref: 038.145.72.193/32     unicast [direct1 2024-11-06] * (240)
>         dev em5
>         Type: device univ
>
>
>
>
> # bird.conf
> router id 172.18.xxx.yyy;
> ipv4 table master4;
>
> define LOCAL_NET = [ 38.145.72.193/32 ];
>
> protocol direct {
>     ipv4;
>     interface "em5",-"*";
> }
>
> protocol kernel {
>     scan time 1;
>     merge paths yes limit 4;
>     ipv4 {
>       import none;
>       export filter {
>         if proto = "direct1" then reject;
>         krt_prefsrc = 38.145.72.193;
>         accept;
>       };
>   };
> }
>
> protocol device {
>     scan time 1;
> }
>
> protocol bgp bgp_A {
>     description "TOR A";
>     local 10.105.1.11 as 4290105101 ; # enp4s0f0
>     neighbor 10.105.1.10 as 4259105001; # TOR_A
>     path metric 1;
>     ipv4 {
>        import all;
>        export filter {
>            if net ~ LOCAL_NET then accept;
>            else reject;
>        };
>        next hop self;
>      };
> }
>
> protocol bgp bgp_B {
>     bfd;
>     description "TOR B";
>     local 10.105.1.13 as 4290105101 ; # enp4s0f1
>     neighbor 10.105.1.12 as 4259205001; # TOR_B
>     default bgp_med 0;
>     default bgp_local_pref 0;
>     path metric 1;
>     ipv4 {
>        import all;
>        export filter {
>            if net ~ LOCAL_NET then accept;
>            else reject;
>        };
>        next hop self;
>      };
> }
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20241120/a18fb4b2/attachment.htm>


More information about the Bird-users mailing list