Why does my ubuntu-server have 4 ipv6 addresses?
It's especially strange to me because my netplan has a single ipv4 static set.
Code:
ifconfig And my netplan Code:
cat /etc/netplan/00-installer-config.yaml I actually want to also set a static ipv6 in my netplan, but I'm not sure why this computer even has ipv6 addresses to begin with. My router which comes from my ISP doesn't even have any options it's web gui to setup ipv6 dhcp addresses. What gives? |
This is all done by the IPv6 stack itself and the IPv6 autoconfig mechanism.
This is the link-local address: Quote:
All interfaces participating in an IPv6 network must have a link-local address, as it's used by a number of core IPv6 services, like Neighbor Discovery and routing. It's auto-generated, either from the interface's MAC address, or if privacy extensions are enabled, by an algorithm ensuring the address will be unique. Then there's the automatically generated global routable address: Quote:
Note how the last 16 digits (the "host" part) are identical to those of the link-local address. This tells you that the IPv6 autoconfig mechanism is active and has detected a router on the network. IPv6 routers advertise their presence on the network using the Router Advertisement mechanism of the Neighbor Discovery protocol (part of ICMPv6), allowing clients to determine the IPv6 prefix of the local network. Using this information, the autoconfig mechanism has generated the host part of the address and assigned it to the interface. Then there's the second, global address: Quote:
As for how and why this happens: Unlike with IPv4, where your ISP assigns a single, global IPv4 address to your router which masks your entire LAN behind it using private IPv4 addresses, with IPv6 you're actually supposed to use routable addresses everywhere. Since the addresses technically belong to your ISP, they need to tell your router which addresses to use on its LAN interface as well as the WAN side. This is done using a mechanism called "Prefix Delegation" (PD): When the router asks for an IPv6 address for its WAN interface via DHCPv6, it also receives a PD parameter telling it which IPv6 prefix the ISP will now be routing to the WAN interface. A router with IPv6 support will then automatically configure its LAN interface as well, start sending out Router Solicitation (RA) messages periodically, and possibly also configure and start a DHCPv6 service to assign addresses within this prefix to hosts on the LAN. It seems your router and/or your computer uses both autoconfiguration/RA and DHCPv6. As a result, you end up with at least two globally routable addresses. This is normal and is unlikely to cause any issues. Finally, there's the third, global IPv6 address: Quote:
|
Incredible. Thank you so much.
So if I wanted to set a static ipv6 address, can I just use one of the publicly routable addresses it already has? |
Quote:
There is a question regarding what might happen if your ISP decides to allocate a different prefix to your router, but unless the router goes offline for a non-trivial length of time, that's not a very likely scenario. Worst case, you'll have to change the IPv6 address of the server after an outage. |
All times are GMT -5. The time now is 09:00 AM. |