Why the default gateway of IPv6 is the router's local link address

The router obtains the public network IPv6-PD through PPPoE dial-up, and the router starts the IPv6 route advertisement service (server mode). The devices under the router can normally obtain IPv6 addresses through the SLAAC mode configuration, and everything on the Internet is normal! Why the default gateway of the device’s IPv6 is fe80:: A link-local address at the beginning, and this address is the link-local address of an interface of the router, and the device under the router can ping this address. But the router cannot ping the link-local address of other devices. Isn't the link-local address only available for the local machine? Why can it be pinged?

This is rrequired by RFC4861. Ref https://datatracker.ietf.org/doc/html/rfc4861#section-4.2

Source Address
MUST be the link-local address assigned to the
interface from which this message is sent.

Yes, it can. But you'll have to give the zone (i.e interface) as well when specifying a destination with a locally scoped address. For example

bjorn@idefix:~$ ip -6 route get ::
:: from :: via fe80::207:ff:fe01:1 dev eth0.102 proto ra src fe80::dea6:32ff:fe77:e55e metric 1024 hoplimit 64 pref medium
bjorn@idefix:~$ ping fe80::207:ff:fe01:1%eth0.102
PING fe80::207:ff:fe01:1%eth0.102(fe80::207:ff:fe01:1%eth0.102) 56 data bytes
64 bytes from fe80::207:ff:fe01:1%eth0.102: icmp_seq=1 ttl=64 time=4.05 ms
64 bytes from fe80::207:ff:fe01:1%eth0.102: icmp_seq=2 ttl=64 time=3.87 ms
64 bytes from fe80::207:ff:fe01:1%eth0.102: icmp_seq=3 ttl=64 time=4.01 ms
^C
--- fe80::207:ff:fe01:1%eth0.102 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 3.870/3.977/4.053/0.077 ms

No, that would be a host local address. Link local addresses cannot be routed, but they are perfectly reachable for any host on the same link, or L2 domain.

1 Like

This address is automatically generated according to the fe80:: + EUI-64 rule, so can I customize the suffix, such as: ip6ifaceid'::300' Through this parameter I can customize the public network IPv6 address in SLAAC mode but the local link Address this parameter is not effective

I have no idea what you're trying to say here, but there is nothing magic about link local addresses except the non-routability.

You can , and most often will, generate them based on a mac adress. But there is absolutely nothing preventing you from using a different interface identifier of your choice. You can also have more than one link local address on an interface. This can be useful if you want to support static default routes. For example like Bytemark do:

bjorn@louie:~$ ip route get ::
:: from :: via fe80::1 dev eth0 src fe80::fcff:ff:fe00:e5 metric 1024 pref medium
bjorn@louie:~$ ping -c3 fe80::1%eth0
PING fe80::1%eth0(fe80::1%eth0) 56 data bytes
64 bytes from fe80::1%eth0: icmp_seq=1 ttl=64 time=14.3 ms
64 bytes from fe80::1%eth0: icmp_seq=2 ttl=64 time=7.19 ms
64 bytes from fe80::1%eth0: icmp_seq=3 ttl=64 time=15.1 ms

--- fe80::1%eth0 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 5ms
rtt min/avg/max/mdev = 7.192/12.203/15.144/3.561 ms

Note that the interface identifier for PPP links is part of the IPV6CP negotiation. It's not necessarily related to the underlying ethernet mac address for PPPoE.

1 Like

I just want to make this link-local address simpler, for example: from such an address fe80::dea6:32ff:fe77:e55e to an address such as fe80::1 or fe80::020:1, I don’t know. no?

You can configure it like any other static address. Or for PPP, you can try to add hints to /etc/ppp/options. Something like
ipv6 ::a,::b

Completely untested and might not be the proper way to do this in OpenWrt...

And it is subject to IPV6CP negotiation, which means that the other end is free to reject any hint you provide. In which case the link probably won't come up at all with such a hint.