kaeru


"Stuff I'm working on ..."

IPv6 ULA with multiple interfaces and Link Aggregation (LAGG)

by kaeru published 2024/10/11 21:14:00 GMT+8, last modified 2024-10-13T08:54:36+08:00
Setting up additional ipv6 ULA addresses on multiple network interfaces on same FreeBSD server / router.
DSC04264.JPG
8 port Gigabit Switch

The home server has multiple network interfaces. One onboard Realtek, and 2 Intel gigabit network adapters, one of them a dual ethernet RJ45 port card. Technically I could connect everything from the PPPoE device and LAN on one interface, but since I have them, might as well use them. Separating my workstation NFS traffic to a separate network card would also be a good thing to avoid saturating one link for heavy file transfers. BTW you can find second hand refurbished enterprise / data center equipment like multi port network cards for cheap.

In previous article, I cover setting up a standard ipv6 dual stack home network with global and local (ULA) addresses on FreeBSD.

network.png
Home Network with multiple switches and ULA/GUA addresses

On a single network interface everything works as it should. However when I tried to setup a second interface by with manually assigned ULA address on the same subnet, it was not reachable from the network.

In IPv4 world, 192.168.0.1 on first interface and 192.168.0.2/32 would still work. For IPv6 on FreeBSD at least it's a bit stricter, and you're not supposed to have 2 network interfaces on same server broadcasting on the same subnet.

The solution and correct way to do it, is to simply assign a static ULA address on the second network on a different subnet. Subnets are cheap on IPv6, ULA /48 gives you possibility of 65536 subnets.

So the solution is to use fdd5:674c:9795:0::1 as before for first interface, and fdd5:674c:9795:1::1 for second network interface on another subnet.

The route for the second subnet is advertised to all via the first interface, and all devices on the network now find and connect to the second IP address and subnet on the second network interface.

Link Aggregation

One of the network cards on the server has 2 ports. So why not link aggregate them using FreeBSD's lagg(4)? And see if it works.

It is straightforward on FreeBSD:

ifconfig em1 up
ifconfig em2 up
ifconfig lagg0 create
ifconfig lagg0 laggproto lacp laggport em1 laggport em2
ifconfig inet6 fdd5:674c:9795:1::1 prefixlen 64

And that's it, I can now mount NFS on my workstation to this lagg0 address and interface. The total bandwidth 2 x 1Gbe, so in theory two devices on the switch can now both have 1 gigibits/s of throughput at same time instead of half that through a single interface on the server. For now having a separate network interface for NFS separate from the main network interface for the whole LAN network is a win, even though I don't really need lagg0 the way the home network is setup.

To have it automatically setup in rc.conf:

cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto lacp laggport em1 laggport em2"
ifconfig_em1="up"
ifconfig_em2="up"
ifconfig_lagg0_ipv6="inet6 fdd5:674c:9795:1::1 prefixlen 64"

lagg0 can work with ipv4, and following best practice assign it an address on a different subnet eg. 192.168.1.1/24 in addition to 192.168.1.0/24 and it should also work without any problems.