I am using an 22.04 server instance as a router for my home network. I have working IPv4 & IPv6 service, but my public IPv6 address is assigned to my LAN interface, which is unexpected to me. My WAN interface only has link-local addresses assigned to it. This doesn't seem to affect my connectivity at all, which makes even less sense to my IPv4-only brain. Downstream devices successfully get public and unique IPv6 addresses, and I'm even reachable at the LAN interface's global IPv6 address (!?), but shouldn't it be assigned to the WAN interface instead? Other examples found online seem to suggest so, but those are scarce.
Addresses
I am using systemd-networkd without netplan. I have two interfaces:
enp4s0: WAN linkenx3c18a041307a: LAN link
Relevant output from ip with addresses redacted:
user@router:~$ ip -6 addr show enp4s0
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
valid_lft forever preferred_lft forever
user@router:~$ ip -6 addr show enx3c18a041307a
3: enx3c18a041307a: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet6 2600:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 scope global dynamic mngtmpaddr
valid_lft 5285sec preferred_lft 5285sec
inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
valid_lft forever preferred_lft forever
When inspecting IPv4 addresses, enp4s0 has my public address and enx3c18a041307a has a self-assigned private address.
Configuration
This is my systemd.network configuration for the enp4s0 interface:
[Match]
MACAddress=bc:xx:xx:xx:xx:xx
[Link]
# This is the WAN link, so is required to be considered online
RequiredForOnline=yes
ActivationPolicy=up
[Network]
Description=The motherboard ethernet device used as a WAN link.
# Enable DHCPv4 and v6 on this link
DHCP=yes
# Enable link-local addressing
LinkLocalAddressing=ipv6
# Forward IPv4 and IPv6 addresses
IPForward=yes
# Accept router advertisements
IPv6AcceptRA=yes
[DHCPv6]
ForceDHCPv6PDOtherInformation=yes
Then for the enx3c18a041307a interface:
[Match]
MACAddress=3c:xx:xx:xx:xx:xx
[Link]
RequiredForOnline=no
ActivationPolicy=up
[Network]
Description=The USB ethernet device used as a LAN link.
DHCP=no
LinkLocalAddressing=ipv6
IPForward=yes
IPv6AcceptRA=no
IPv6SendRA=yes
DHCPv6PrefixDelegation=yes
Address=192.168.1.1/24
# Enable the built-in dhcp server
DHCPServer=yes
[DHCPv6PrefixDelegation]
SubnetId=0x1
This follows the examples set in the systemd.network man page, as well as some examples found online.