You can assign two Unique Local Addresses (ULA) to a single network interface in Linux by using the ip command line tool or by configuring static network configuration files. This setup allows multiple subnets on one physical link, enabling flexible internal routing and segmentation without requiring additional hardware interfaces.
Understanding ULA Addressing
Unique Local Addresses (ULA) are defined in RFC 4193 and are designed for local communication within an organization. They use the prefixfc00::/7, though currently only fd00::/8 is actively used for dynamically assigned addresses. Unlike Global Unicast Addresses (GUA), ULAs are not routable on the public internet, making them ideal for internal services, testing environments, or isolated network segments.
When you need to configure two ULA addresses on one interface, such as eth0, you are essentially creating a secondary subnet on that same physical connection. This is common in scenarios where you have multiple VLANs trunked over a single link, or when you want to separate traffic streams logically while keeping them on the same wire. It is important to note that this differs from having multiple global IPv6 addresses, which might be generated via SLAAC or DHCPv6. For manual control over specific ULA prefixes, static assignment is often preferred.
For more details on resolving discrepancies between expected and actual IPv6 configurations, see Why is my public IPv6 address different from the one listed in Linux?.
Temporary Configuration Using the IP Command
The most immediate way to add a second ULA address is using theip addr command. This method is non-persistent; if the system reboots, the address will disappear unless scripted into a startup process. This approach is excellent for testing or temporary adjustments.
First, identify your interface name using ip link show. Assume the interface is eth0. To add a primary ULA, you might already have something like fd12:3456:789a::1/64. To add a secondary ULA, choose a different prefix, such as fd98:7654:3210::1/64.
Execute the following command to add the secondary address:
sudo ip addr add fd98:7654:3210::1/64 dev eth0
Verify the addition by running ip -6 addr show eth0. You should now see two inet6 entries with the scope global and type local. The kernel will automatically handle routing for both prefixes. If you need to remove it later, replace add with del in the command.
This method gives you instant feedback but requires manual intervention after every reboot. For persistent configurations, you must edit network manager files or Netplan YAML files depending on your distribution.
Persistent Configuration with Netplan
Modern Ubuntu systems use Netplan for network configuration. Netplan generates backend configurations for either NetworkManager or systemd-networkd. To assign two ULA addresses persistently, you edit the YAML file located in/etc/netplan/.
Open your configuration file, typically named 01-netcfg.yaml or similar. Inside the interface definition, under the addresses list, you can specify multiple IPv6 addresses. Each address is written in CIDR notation.
network:
version: 2
ethernets:
eth0:
dhcp6: no
addresses:
- fd12:3456:789a::1/64
- fd98:7654:3210::1/64
routes:
- to: default
via: fd12:3456:789a::ff
nameservers:
addresses:
- fd12:3456:789a::2
After saving the file, apply the changes with sudo netplan apply. If errors occur, check the syntax using sudo netplan try, which rolls back if the new configuration fails connectivity tests.
If you are assigning labels to these addresses for policy routing, refer to Netplan - Add Secondary IP Address and Assign a Label.
Persistent Configuration with Systemd-networkd
For distributions using systemd-networkd, such as Fedora or Arch Linux, you create a.network file in /etc/systemd/network/. Create a file named 10-eth0.network and define the addresses under the [Address] sections.
Each address gets its own section block. This structure makes it clear which IP belongs to which logical segment.
[Match]
Name=eth0
[Network]
DNS=fd12:3456:789a::2
[Address]
Address=fd12:3456:789a::1/64
[Address]
Address=fd98:7654:3210::1/64
Reload the daemon and restart the network service:
sudo systemctl reload systemd-networkd
sudo systemctl restart systemd-networkd
Check status with systemctl status systemd-networkd to ensure no errors were logged during startup.
Routing Considerations
Adding multiple ULA addresses does not automatically create complex routing tables. By default, the Linux kernel uses the source address selection algorithm (RFC 6724) to pick the best source IP for outgoing connections. When communicating with a destination, it prefers a source address from the same prefix as the destination. If you have two ULAs, sayfd12::/64 and fd98::/64, and you ping a host in fd12::/64, the kernel will likely use fd12::1 as the source. For hosts in fd98::/64, it will use fd98::1. This behavior is usually desirable.
However, if you need specific traffic to exit via a specific ULA regardless of the destination, you must set up policy routing. This involves creating separate routing tables and rules based on the source IP. Without policy routing, both addresses share the main routing table, and reachability depends on the upstream router knowing how to route those specific ULA prefixes. Ensure your switch or router has static routes pointing to your Linux host's MAC address for both prefixes if they are on different VLANs or subnets at the layer 3 boundary.
Be aware that some applications may bind to only one IPv6 address by default. If you experience issues connecting to services, check which address the service is listening on using ss -tuln | grep ipv6.
For deeper insights into debugging routing issues with multiple interfaces, consult Debugging IPv6 Routing with Multiple Interfaces on a Linux Server with IPSec (Libreswan) Installed.
Troubleshooting Common Issues
One common issue is the "ADDRCONF" messages repeating in logs. This often indicates that the link state is flapping or that there is a conflict in address assignment. Check your journal logs for repeated warnings about duplicate address detection (DAD). Another issue arises when external IPv6 connectivity works but internal ULA communication fails. This is often due to firewall rules blocking the specific ULA ports or incorrect subnet masks. Verify that your iptables or nftables rules allow traffic on the new ULA prefix. Also, ensure that your default gateway is correctly configured for the primary ULA, as secondary ULAs do not automatically inherit the default route unless explicitly added. Finally, remember that ULA addresses are not globally unique. If you merge networks from different sites, you risk prefix collisions. Always document your ULA prefixes and use a consistent generation method, such as hashing the MAC address, to minimize collision risks.Frequently Asked Questions
Can I use the same ULA prefix for both addresses?
No, each address must belong to a distinct subnet to avoid routing conflicts. While you can technically assign two IPs from the same /64 to one interface, it provides no logical separation and complicates routing decisions unnecessarily. Use different /64 prefixes within thefd00::/8 range for true segmentation.
Does adding a second ULA affect performance?
Adding a second address has negligible impact on CPU or memory usage. The kernel handles multiple addresses efficiently. The only slight overhead comes from increased Duplicate Address Detection (DAD) processes during initialization and slightly larger neighbor cache entries, which are insignificant for modern systems.How do I verify which ULA is being used for outbound traffic?
You can use theip -6 route get command followed by a target IP. For example, ip -6 route get fd98:7654:3210::1 will show the selected source address. Alternatively, use tcpdump or wireshark on the sending machine to inspect the source IP in the IPv6 header of outgoing packets.