tl;dr - Second NIC doesn't get a def router via DHCP breaking multiple routing table setup
Hello,
I need to setup a VM with 2 NICs on DHCP, we need a separate routing table (fib) per NIC, but I'm not getting the default router for the second one.
What I've done so far:
In /boot/loader.conf:
In /etc/sysctl.conf:
And in /etc/rc.conf the following:
However, when I check the routing tables, fib 1 is missing the default gateway.
I thought it odd, definitely not what I needed or expected.. Initially I thought it was a fib bug, but then thought to check dhclient, so I added an exit hook looking like this:
Output here https://pastebin.com/raw/uScDH15u
..And sure enough, looking into /tmp/dhcplog reveals em1 is not sent a "new_routers" option at all, only em0 gets it. I can confirm the network on em1 does work correctly and when reversing the NICs it does supply a valid router.
I even tried to "force" dhclient to request a router for em1 by configuring the interfaces expressly and _required_ the "routers" option as per this example ... without success.
Any more suggestions?
Hello,
I need to setup a VM with 2 NICs on DHCP, we need a separate routing table (fib) per NIC, but I'm not getting the default router for the second one.
What I've done so far:
In /boot/loader.conf:
Code:
net.fibs=8
In /etc/sysctl.conf:
Code:
net.add_addr_allfibs=0
And in /etc/rc.conf the following:
Code:
ifconfig_em0="SYNCDHCP fib 0"
ifconfig_em1="SYNCDHCP fib 1"
However, when I check the routing tables, fib 1 is missing the default gateway.
Code:
[root@freebsd-13_1 ~]# setfib 0 netstat -rn
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 10.2.1.1 UGS em0
10.2.1.0/24 link#1 U em0
10.2.1.70 link#1 UHS lo0
[root@freebsd-13_1 ~]# setfib 1 netstat -rn
Routing tables (fib: 1)
Internet:
Destination Gateway Flags Netif Expire
10.13.13.0/24 link#2 U em1
10.13.13.88 link#2 UHS lo0
Code:
printenv >> /tmp/dhcplog
Output here https://pastebin.com/raw/uScDH15u
..And sure enough, looking into /tmp/dhcplog reveals em1 is not sent a "new_routers" option at all, only em0 gets it. I can confirm the network on em1 does work correctly and when reversing the NICs it does supply a valid router.
I even tried to "force" dhclient to request a router for em1 by configuring the interfaces expressly and _required_ the "routers" option as per this example ... without success.
Any more suggestions?