G
G
Gil Galad2021-12-19 17:50:21
FreeBSD
Gil Galad, 2021-12-19 17:50:21

Why does dhclient on FreeBSD 13 ignore setfib and write routes to the main table?

Axis FreeBSD 13. Dhclient regular.

loader.conf

net.add_addr_allfibs=0
net.fibs="2"


We start
setfib 1 dhclient em2

As a result, all routes, including the gateway, are registered in the main table (0) of the routing, and not in the table (1). If I manually prescribe routes, then they are normally added to the table (1).

Logically, a script running under setfib and its descendants use the routing table set by setfib. But for some reason dhclient is getting out of setfib's influence. I've already broken my head.

So far, it comes to mind to duplicate dhclient-script and to ironly prescribe "-fib 1" to all routes. But it's kind of a tricky decision.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gil-Galad, 2021-12-21
@Gil Galad

The problem turned out to be in ifconfig, not routes. When binding an address to an interface, ifconfig for some reason in FreeBSD 13.0-RELEASE-p4 ignores the current routing table (fib 1) and uses (fib 0) in the dhclient-script.
As a result, I changed dhclient-script and added the definition of the current fib to the beginning of the code

FIB="fib `sysctl net.my_fibnum | awk '{print $2}'`"

and then added $FIB to the end of every ifconfig call. For example,
$IFCONFIG $interface inet -alias $alias_ip_address $FIB > /dev/null 2>&1

In the end, everything started to register and work normally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question