Portál AbcLinuxu, 10. května 2025 08:56
Řešení dotazu:
Překlad z IPv6 na linkovou adresu se vždy provádí protokolem NDP. Nikdo totiž nemůže vědět, jak daná IPv6 adresa vznikla, a především se na to nemůže spoléhat.
I link-scope adresy se překládájí. Stačí se podívat do vyrovnávací paměti:
$ /sbin/ip -6 ne fe80::20e:2eff:fec8:c5b3 dev eth0 lladdr 00:0e:2e:c8:c5:b3 router REACHABLE
Důkaz to není, ale přesvědčivé to je. Pokud se bavíme o Linuxu, tak Linux v současnosti neumí ručně měnit cache NDP.
Jestli ale trváte na tcpdumpu, tak tady je (ping na neexistující link-scope adresu):
$ ping6 -I eth0 fe80::20e:2eff:fec8:c5b4 PING fe80::20e:2eff:fec8:c5b4(fe80::20e:2eff:fec8:c5b4) from fe80::4e00:10ff:fe60:7ca6 eth0: 56 data bytes From fe80::4e00:10ff:fe60:7ca6 icmp_seq=1 Destination unreachable: Address unreachable From fe80::4e00:10ff:fe60:7ca6 icmp_seq=2 Destination unreachable: Address unreachable From fe80::4e00:10ff:fe60:7ca6 icmp_seq=3 Destination unreachable: Address unreachable ^C --- fe80::20e:2eff:fec8:c5b4 ping statistics --- 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3012ms # tcpdump -i eth0 -e -np icmp6 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 09:03:22.496517 4c:00:10:60:7c:a6 > 33:33:ff:c8:c5:b4, ethertype IPv6 (0x86dd), length 86: fe80::4e00:10ff:fe60:7ca6 > ff02::1:ffc8:c5b4: ICMP6, neighbor solicitation, who has fe80::20e:2eff:fec8:c5b4, length 32 09:03:23.496571 4c:00:10:60:7c:a6 > 33:33:ff:c8:c5:b4, ethertype IPv6 (0x86dd), length 86: fe80::4e00:10ff:fe60:7ca6 > ff02::1:ffc8:c5b4: ICMP6, neighbor solicitation, who has fe80::20e:2eff:fec8:c5b4, length 32 09:03:24.493650 4c:00:10:60:7c:a6 > 33:33:ff:c8:c5:b4, ethertype IPv6 (0x86dd), length 86: fe80::4e00:10ff:fe60:7ca6 > ff02::1:ffc8:c5b4: ICMP6, neighbor solicitation, who has fe80::20e:2eff:fec8:c5b4, length 32 ^C 3 packets captured 3 packets received by filter 0 packets dropped by kernel
Takže máte pravdu, že při překladu link-scope adresy, která je odvozena z ethernetové, se dotaz posílá přímo na danou ethernetovou adresu. Ale NDP se dělá i tak.
Takhle to vypadá na existující adresu, které chybí záznam v cache:
# tcpdump -i eth0 -e -np icmp6 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 09:02:11.548090 4c:00:10:60:7c:a6 > 33:33:ff:c8:c5:b3, ethertype IPv6 (0x86dd), length 86: fe80::4e00:10ff:fe60:7ca6 > ff02::1:ffc8:c5b3: ICMP6, neighbor solicitation, who has fe80::20e:2eff:fec8:c5b3, length 32 09:02:11.548549 00:0e:2e:c8:c5:b3 > 4c:00:10:60:7c:a6, ethertype IPv6 (0x86dd), length 86: fe80::20e:2eff:fec8:c5b3 > fe80::4e00:10ff:fe60:7ca6: ICMP6, neighbor advertisement, tgt is fe80::20e:2eff:fec8:c5b3, length 32 09:02:11.548625 4c:00:10:60:7c:a6 > 00:0e:2e:c8:c5:b3, ethertype IPv6 (0x86dd), length 118: fe80::4e00:10ff:fe60:7ca6 > fe80::20e:2eff:fec8:c5b3: ICMP6, echo request, seq 1, length 64 09:02:11.548944 00:0e:2e:c8:c5:b3 > 4c:00:10:60:7c:a6, ethertype IPv6 (0x86dd), length 118: fe80::20e:2eff:fec8:c5b3 > fe80::4e00:10ff:fe60:7ca6: ICMP6, echo reply, seq 1, length 64
Takže máte pravdu, že při překladu link-scope adresy, která je odvozena z ethernetové, se dotaz posílá přímo na danou ethernetovou adresu. Ale NDP se dělá i tak.Spíš to vypadá, že NDP se pošle jen na multicast odvozený z té lokální adresy...
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.