Re: fib 1 DHCP and RA default route

From: Lee Brown <leeb_at_ratnaling.org>
Date: Tue, 21 Jun 2022 17:26:22 UTC
On Tue, Jun 21, 2022 at 10:11 AM Stefan Bethke <stb@lassitu.de> wrote:

> I'm setting up a new router that has both an ADSL/PPPoE and a cable modem
> upstream. I've configured mpd5 for the PPPoE connection, and I'd like to
> have the cable modem provide a second, independent connection through FIB 1
> over igb2.
>
> rc.conf (partially):
> ifconfig_igb2_descr="Cable Modem"
> ifconfig_igb2="DHCP fib 1"
> ifconfig_igb2_ipv6="inet6 accept_rtadv defaultif"
>
> gateway_enable="YES"
> ipv6_gateway_enable="YES"
> pf_enable="YES"
>
> dhclient_flags="-b"
> dhcp6c_enable="YES"
> dhcp6c_interfaces="igb2"
> dhcp6c_fib=1
>
> I think this should be sufficient to receive both an IPv4 and IPv6 address
> and a default route, however, neither one is added. When I manually add
> them, they are removed after a while.
>
> $ ifconfig igb2
> igb2: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>         description: Cable Modem
>
> options=4e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
>         ether 00:0d:b9:xx:xx:62
>         inet6 fe80::20d:b9ff:fe58:5262%igb2 prefixlen 64 scopeid 0x3
>         inet6 2a02:8108:0:90:xxxx:8eb4:28c2:6315 prefixlen 128
>         inet 31.16.xxx.4 netmask 0xffffff00 broadcast 31.16.xxx.255
>         fib: 1
>         media: Ethernet autoselect (1000baseT <full-duplex>)
>         status: active
>         nd6 options=8023<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL,DEFAULTIF>
>
> $ setfib 1 netstat -rnfinet
> Routing tables (fib: 1)
>
> Internet:
> Destination        Gateway            Flags     Netif Expire
> 31.16.xxx.0/24     link#3             U          igb2
> 31.16.xxx.4        link#3             UHS         lo0
> 127.0.0.1          link#4             UHS         lo0
>
> $ setfib 1 netstat -rnfinet6
> Routing tables (fib: 1)
>
> Internet6:
> Destination                       Gateway                       Flags
>  Netif Expire
> ::/96                             ::1                           UGRS
>   lo0
> ::1                               link#4                        UHS
>  lo0
> ::ffff:0.0.0.0/96                 ::1                           UGRS
>   lo0
> 2a02:8108:0:90:xxxx:8eb4:28c2:6315 link#3                       UHS
>  lo0
> 2a02:8108:xxxx:9d00::/64          link#17                       U
>  br103
> 2a02:8108:xxxx:9d00:0:ff:fe00:367 link#17                       UHS
>  lo0
> fe80::/10                         ::1                           UGRS
>   lo0
> fe80::%igb2/64                    link#3                        U
> igb2
> fe80::20d:b9ff:fe58:5262%igb2     link#3                        UHS
>  lo0
> ff02::/16                         ::1                           UGRS
>   lo0
>
>
> For IPv6, I thought that setting defaultif would make the kernel add the
> default route when an appropriate RA is received, and on my old router,
> that was working; I can't seem to see what difference I have in the config,
> apart from using FIB 1 instead of the default.
>
> And for IPv4, I see that I get the default router through DHCP, but
> somehow /sbin/dhclient-script is not adding a default route. If I add it
> manually, it will be removed eventually.
>
> Any suggestions?
>
>
> Stefan
>
> --
> Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811
>
> I had a similar issue, no IPv6, but wanted DHCP to populate FIB 1 as FIB 0
was being adjusted by quagga.

I just hacked the /etc/dhclient-enter-hooks and /etc/dhclient-exit-hooks to
do the work as I couldn't find the correct place to place "fib 1" and have
it work.
The enter hook is looking for the interface and REBOOT or BOUND and
${old_routers} != ${new_routers} to delete the route with -fib 1.  The exit
hook is the same but adds the route with -fib 1