Score:1

How can i bind a network interface to an entire /48 subnet of IPv6 addresses without having to enumerate each and every individual address?

mx flag

Context

I need to know how to setup an entirely /48 IPv6 block in my server to perform outgoing requests with any of these IPv6 addresses without setting up each one individually.

My ISP provides this subnet via an DHCP6 server connected directly to my machine on their data center.

The machine runs Ubuntu Server 20.04.

I've arleady tried this:

  • ip addr add 0000:000:00::/48 dev lo, works really well with IPv4 adresses, i already get an /26 IPv4 block working this way for outgoing requests, but i can't with IPv6;

  • ip route add local 0000:000:00::/48 dev lo, i can ping any IP locally using ping6, but i can't bind any TCP socket to the IP and perform outgoing requests, I receive EADDRNOTAVAIL;

Question

Am I missing something? How i can get this working?

Resourses

Netplan config

network:
  version: 2
  renderer: networkd
  ethernets:
    enp132s0:
      dhcp4: yes
      dhcp6: yes
    enp6s0:
      dhcp4: yes
      dhcp6: yes

Other Serverfault questions

Score:2
cn flag

Your second Server Fault link outlines what is required. Routed prefix to you, local route on that host, and allow non local IP in socket also known as IP_FREEBIND. EADDRNOTAVAIL implies step three is incomplete.

Confirm your routed prefix and local route works by pinging an IP in it from a different IPv6 network.

On Linux, allow bind to other IPs by creating /etc/sysctl.d/freebind.conf containing

net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1

Applications should bind to a desired IP address. Otherwise if not provided, the usual source address selection would pick some local IP assigned to an interface. Also possible to set IP_FREEBIND option on a per socket level.

Note that even without this routed prefix trick, a large number of IP addresses can be assigned to a host. Possibly several thousand before neighbor discovery becomes a problem.


IPv6 subnets should be /64 in size. Standardizing on lower half interface ID, upper half aggregation for routing. As router, this host might still be routed a /48, but only needs a /64 on the loopback route to itself.

Number of IP addresses is not important, as 2^64 is already effectively unlimited in size. Perfectly fine to only use one or two /64s out of a /48, leave room in the address plan for other things.

João Scheuermann avatar
mx flag
I can successfully ping only the DHCP assigned IPV6.
John Mahowald avatar
cn flag
Do you mean an echo reply from the one IA_NA IP address, or something in a IA_PD delegated prefix? Try getting a single IP address from your prefix working first, assigned to an interface and routed.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.