FreeBSD 10 multiple gateway routing problem.

Hi,

I've 2 nics connected to 2 different upstreams on my server. IPs are private so i've changed them. I need to configure that both subnets should be active.
nics : bce1 ve bge1

Code:
ifconfig_bce1="inet 172.20.20.66 netmask 255.255.255.248"  -> gw : 172.20.20.65
ifconfig_bge1="inet 192.100.254.154 netmask 255.255.255.248" -> gw : 192.100.254.153
when nics up, FreeBSD adds all routes to fib 0 (default fib) and doesnt allow to remove or change.

Code:
Destination        Gateway            Flags    Refs      Use  Netif Expire
172.20.20.64/29    link#6             U           0        0   bce1
172.20.20.66       link#6             UHS         0        0    lo0
127.0.0.1          link#9             UH          0        0    lo0
192.100.254.152/29   link#2             U           0        0   bge1
192.100.254.154      link#2             UHS         0        0    lo0

Code:
[ root@host ] ~ $ route del -net 192.100.254.152/29
route: writing to routing socket: Address already in use
del net 192.100.254.152 fib 0: gateway uses the same route

what I've tried;

1) static routes only 1 route table (fib0)
Code:
static_routes="uplink0 uplink1"
route_uplink0="-net 172.20.20.64/29 172.20.20.65"
route_uplink1="-net 192.100.254.152/29 192.100.254.153"

Code:
route: writing to routing socket: Address already in use
delete net 172.20.20.64: gateway 172.20.20.65 fib 0: gateway uses the same route
route: writing to routing socket: Address already in use
delete net 192.100.254.152: gateway 192.100.254.153 fib 0: gateway uses the same route
route: writing to routing socket: File exists
add net 172.20.20.64: gateway 172.20.20.65 fib 0: route already in table
route: writing to routing socket: File exists
add net 192.100.254.152: gateway 192.100.254.153 fib 0: route already in table

2) defaultrouter enabled for any of interfaces
Code:
defaultrouter="192.100.254.153"

both subnets are accessable but if defaultrouter or nic connected to it gets down both is unavailable.

3) multiple route tables and multiple defaulrouters
Code:
ifconfig_bce1="inet 172.20.20.66 netmask 255.255.255.248 fib 0 "
ifconfig_bge1="inet 192.100.254.154 netmask 255.255.255.248  fib 1"
setfib 0 route add default 172.20.20.65
setfib 1 route add default 192.100.254.153
net.fibs:2
also net.add_addr_allfibs=1
FreeBSD adds add all routes to default fib (sysctl net.my_fibnum -> net.my_fibnum: 0) so second route table doesnt affect.

4) multiple route table and static routes

Code:
static_routes="uplink0 uplink1"
route_uplink0="-net 172.20.20.64/29 172.20.20.65 -fib 0"
route_uplink1="-net 192.100.254.152/29 192.100.254.153 -fib 1"

same result as 2, because of FreeBSD adds all routing to default fib (fib0).

Is there any solution for this simple problem? What I've missed?

Thanks,
 
Several things you need to realize, any directly connected network can never be removed. So you cannot remove the 172.20.20.64/29 and 192.100.254.152/29 networks. The other thing is that there can only be one default gateway.

In order to create some sort of failover you need to use lagg(4). Another option is to use PF and the route-to feature.
 
Hi,
Thank you for your reply. This is our network monitoring and IP accounting server. 172.20.20.64/29 used for IP accounting as primary and 192.100.254.192/29 used for monitoring. Both of them are different networks. So LAGG is not compatible for me. Also software post route, because IP accounting network should be unaccessible under attack. So I need both of them separately routed.

Thanks,
 
Back
Top