New on LowEndTalk? Please Register and read our Community Rules.
BGP VM with BIRD2, how to route outgoing traffic via the IP in the dummy adapter instead of main IP?
With below configuration, I could ping the IP and access the IP on the dummy adapter. However, on the server, when I try to run curl ifconfig.co/ I got my main IP. How do I set the dummy to the default route?
Thanks
Here is my BIRD2 configure
define OURASN = ;
define OURIPv6 = ;
define OURIPv4 = ;
define OURIPv6_2 = ;
define MyIPV6Block =;
log syslog all;
router id OURIPv4;
protocol device {
scan time 5;
}
protocol direct {
interface "dummy*";
ipv6;
}
protocol static localmap{
ipv6;
route MyIPV6Block via OURIPv6%ens19;
}
protocol kernel {
ipv6 { import all; };
learn;
}
protocol bgp s1{
description "s1";
local OURIPv6 as OURASN;
interface "ens18";
neighbor NEIGHBOURIP1 as NEIGHBOURAS1;
ipv6 {
import all;
export where proto = "localmap";
};
}
protocol bgp s2{
description "s2";
local OURIPv6_2 as OURASN;
neighbor NEIGHBOURIP2fas NEIGHBOURAS2;
interface "ens19";
ipv6 {
import all;
export where proto ="localmap";
};
}
Here is how I add IP to dummy
ip link add dev dummy1 type dummy
ip link set dummy1 up
ip addr add dev dummy1 MYIPV6ADDRESS
Comments
you can do that with
ip r add default $GW src $DUMMYIP metric 256
, or have bird export the routes to kernel table withkrt_prefsrc
.Could you show me an example of full Kernel config? And for $GW, what is my $GW, I haven't figured out. Is it the same as my VM's public IP?
This would export all routes(~150k) to the kernel table with the preferred src attribute. Replace OURIPV6 with $DUMMYIP.
Since you can reach your announced ips without exporting anything i presume the same gateway(that you configured for the vm, check with
ip -6 r get ::/0
) is used as the nexthop.Success! Thanks! With this kernel configure, my outgoing IP is set to the one in my dummy adapter!
By the way,
ip -6 r get ::/0
doesn't work. it says "need at least a destination address"Try
ip -6 r show ::/0
.What does bgp_path.prepend AS Path prepending do? Does it make incoming connection to choose the preferred upstream?
The effect depends on where you put it, on import or export.
Usually, it's in the export filter. When prepending a prefix on export, the path for a prefix becomes longer for the peer, hence usually less preferred for inbound traffic.
That said, a peer may have a preference set on their import filter, which overrules the as-path length.