I have configured BGP on my router (using Entware) to send some routes through VPN. It's worked. But now I needed exclude one deivce from it (it must go not via VPN tunnel).
My bird config
log syslog all;
log stderr all;
router id x.x.x.x;
function martians()
{
return net ~ [ 100.64.0.0/10+,
169.254.0.0/16+,
172.16.0.0/12+,
192.168.0.0/16+,
10.0.0.0/8+,
127.0.0.0/8+,
224.0.0.0/4+,
240.0.0.0/4+,
0.0.0.0/32-,
0.0.0.0/0{0,7}
];
}
protocol device {
scan time 15;
}
protocol kernel kernel_routes {
scan time 60;
import none;
export all;
kernel table 1000; # kernel routing table number
}
protocol static static_routes {
import all;
#route 192.168.2.62/32 via "eth3";
}
protocol bgp antifilter {
import filter {
if martians() then reject;
gw = 1.0.0.1; # override route nexthop
accept;
};
export none;
local as 64999; # local default as-number
neighbor y.y.y.y as 65432;
multihop;
hold time 240;
}
table 1000 creating when VPN connection turns up
ip rule add iif br0 table 1000
To SBR I'm tryed make this commands:
ip rule add from 192.168.2.62 table 120
ip route add default dev eth3 table 120
But result is "Network isn't available".
Now I'm tryed this
ip rule add from 192.168.2.62 table 120
ip route add default via x.x.x.x dev eth3 table 120
And it's worked. But I don't know gateway from carrier not in runtime. It comes by DHCP. How change default route in table 120 according to new information from DHCP? Or how exclude it in bird config