Freebsd, Vlan, IPv6 and FIB

From: Pierre Dupond <76nemo76_at_gmx.ch>
Date: Mon, 24 Jan 2022 17:35:03 UTC
Hi All,
     I want to configure a network interface with two vlans. Each VLAN is connected to a different router.
The first vlan has the interface name "igb1.10" the second the interface name "igb1.40".

Two IPv4 address and at least 2 IPv6 address should be set on each VLAN interface.
One IPv6 address is in a non routable network with prefix "fd4f:bd4e:6d27:cafe" or "fd4f:bd4e:6d27:40"
depending on the interface and the second address use an IPv6 public routable prefix (from two different
providers).

No automatic distribution of IPv6 address is used in these networks (all the address are static).
After that, I plan to add two more temporary public address with a random suffix (and with privacy extension).

Since I should specify a default router for each interface, I have envisaged
to use the "fib" functionality of the "ifconfig" command.

So far so good but I have not succeeded to configure a such scheme in the file "/etc/rc.conf"
and my trials to configure it in the file "/etc/rc.local" were more or less unsuccessful.

Does somebody has an idea on how to achieve a such configuration?

Thanks for your help,

Best regards

Here is an attempt to start a configuration in the file "/etc/rc.conf"
--------------------------------------------rc.conf file------------------------------------------------
cat rc.conf
# minimal rc.conf
# please set hostname and ip configuration
#

hostname="xxxx"

rtsold_enable="YES"

defaultrouter="172.16.0.5"
ifconfig_igb0="inet 192.168.88.11/24"
ifconfig_igb0_ipv6="inet6 accept_rtadv"

#Define the VLAN were the Sourire machine are located.
ifconfig_igb1="up"
vlans_igb1="10 40"
ifconfig_igb1_10="inet 172.16.0.11/23"
ifconfig_igb1_40="inet 192.168.40.11/24"
#
#IPv6
#
#ipv6_defaultrouter="fd4f:bd4e:6d27:cafe::f003"
ifconfig_igb1_40_ipv6="inet6 aaaa:aaaa:aaaa:cafe:19e5::12 prefixlen 64"
ifconfig_igb1_10_ipv6="inet6 aaaa:aaaa:bbbb:cafe:19e5::12 prefixlen 64"
#The use of an alias on the VLAN interface name does not work!
#ifconfig_igb1_10_ipv6_alias0="inet6 fd4f:bd4e:6d27:cafe:19e5::12 prefixlen 64"

zfs_enable="YES"
sshd_enable="YES"
sendmail_enable="NONE"

# existing rc.conf
#sendmail_enable="NONE"
#hostid_enable="NO"

--------------------------------------------------------sysctl.conf---------------------------------------------
# $FreeBSD$
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0

# enable the privacy extensions
net.inet6.ip6.use_tempaddr=1
# prefer the privacy addresses
net.inet6.ip6.prefer_tempaddr=1