FIB on 10.1, adding gateway problem, bug?

Spod

New Member


Messages: 19

I am running some daemons, including postfix on FIB 1 which has specific rules but the same gateway as the default routing table. In FreeBSD this was working just fine, but after the upgrade, the command setfib 1 route add default 192.168.1.1 fails with:
Code:
route: writing to routing socket: Network is unreachable
add net default: gateway 192.168.1.1 fib 1: Network is unreachable

Just to make it clear, 192.168.1.1 is my default route and is reachable.

Does someone know what is wrong or what has changed in 10.1? :(

The problem is similar to this one http://lists.freebsd.org/pipermail/freebsd-stable/2014-September/079900.html but I am not using jails and he says his configuration works, probably he copies the entries from default routing table while I don't (net.add_addr_allfibs=0)

Some more details about the configuration: the default routing table is set to OpenVPN which applies some restrictions I don't want and pushes its own routing rules to default routing table. That's why some of my daemons are set to use second routing table which doesn't use the VPN.
 

usdmatt

Daemon

Reaction score: 610
Messages: 1,546

probaby he copies the entries from default routing table while i dont (net.add_addr_allfibs=0)

Hmm, if you're not copying any routes from the default table then is it possible that the second routing table has no idea how to actually get to 192.168.1.1 in the first place? Usually just by having an address on the 192.168.1.x network assigned to an interface, the system will add a connected route to the 192.168.1.x network via that interface. Once that route is in place, it will then allow you to add a default route via 192.168.1.1. If the second routing table has no routes at all, it doesn't know how to reach 192.168.1.1. You may have to do something along the lines of this in the second routing table (obviously interface name may be different):

Code:
setfib 1 route add 192.168.1.0/24 -iface em0
setfib 1 route add default 192.168.1.1
 
OP
S

Spod

New Member


Messages: 19

This was it. Thank you very much, the only joke is that this worked before the upgrade to 10.1 (well, I am sure as I had rc.d scripts to set up the tables and they weren't changed.
 

usdmatt

Daemon

Reaction score: 610
Messages: 1,546

Interesting. According to the following, it reads to me like it should work as you are seeing now:
net.add_addr_allfibs ... When this is set to 0, it will only allocate routes on interface changes for the FIB of the caller when adding a new set of addresses to an interface
I read that as, "when you add an address to an interface, routes will only be created on the routing table for the current FIB".

That's from 7.1-RELEASE release notes, when the multiple routing table feature appeared. I'd be surprised if it's been working incorrectly (compared to how it's supposed to according to the release notes) the whole time.
 
OP
S

Spod

New Member


Messages: 19

I understood this as it sets default routes to all routing tables. And actually it did work like this, I had to disable it to avoid adding of VPN routes also to FIB 1. The only difference is that I didn't need to specify setfib 1 route add 192.168.1.0/24 -iface em0 on FreeBSD 10. But never mind, this seems like a more logical way of doing.
 
Top