3

In my Linux system, it has three interfaces each of which got assigned an ipv6 address. The route table is:

fe80::/64 dev enx000ec6ac911b proto kernel metric 256 pref medium
fe80::/64 dev enx000ec6aca81e proto kernel metric 256 pref medium
fe80::/64 dev wlp59s0 proto kernel metric 600 pref medium

Now I have another device attached to enx000ec6ac9111b. I can ping it:

ping -6 fe80::224:28ff:fe00:b6e4
PING fe80::224:28ff:fe00:b6e4(fe80::224:28ff:fe00:b6e4) 56 data bytes
64 bytes from fe80::224:28ff:fe00:b6e4%enx000ec6ac911b: icmp_seq=1 ttl=64 time=0.585 ms
64 bytes from fe80::224:28ff:fe00:b6e4%enx000ec6ac911b: icmp_seq=2 ttl=64 time=0.522 ms

I can see, the target address of the ping command cannot be explicitly distinguished from route table (there are three fe80::/64 in the route table). My question is, how Linux can correctly send the packet to the correct interface and get the reply? I feel the way how the routing work in ipv6 case seems not same as IPv4.

Please someone give a little explanation. Thanks!

- woody

1
  • What Linux distribution do you have where ping doesn't require a scope ID when pinging an IPv6 link-local address? I'm on Arch and as far as I can tell, the scope ID is not optional. May 18, 2022 at 21:49

1 Answer 1

2

Layer 2, not layer 3

ip neighbor will show your NDP discovered IPv6 neighbors along with your ARP discovered IPv4 neighbors. And the interface in question. This is at the link layer, it is not routing.

Zone index is necessary to send to a link-local on the correct interface. As unique addresses are common due to the size of the address space, it does the convenient thing of not requiring you to type it.

4
  • Does it mean, in ipv6, when need to find route to a destination address, the kernel will firstly look at the neighbor table, if found the route table will not be checked? Otherwise, I cannot understand why the route looking up can be right even when the route table is duplicated.
    – Woody Wu
    Jan 18, 2019 at 11:56
  • Not really, layer 3 is absolutely a thing for IPv6. Think of a link-local address as an IP wrapper for an Ethernet MAC address. It is IP, so you can use ICMP or TCP over it. But it needs no routing protocol, NDP is a layer 2 thing, switching not routing. What looks like multiple paths is resolved because the network stack knows which interface to a neighbor. (Multiple paths is not a problem in general, but ECMP is a different topic.) Jan 18, 2019 at 18:37
  • Thanks John! So I can think, when I ping a link local addr A, because it is link local, then the kernel will treat it a bit like Ethernet MAC addr and try to find out a match one in it's lay 2 neighbor table which could resulted from NDP. If this understanding is correct, just one more question: if at that moment the addr A was not yet in the neighbor table, what the kernel will do?
    – Woody Wu
    Jan 19, 2019 at 6:47
  • Neighbor discovery. Read the NDP wiki I linked, and the relevant RFCs. Jan 19, 2019 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.