I have two interfaces wan0
and wg0
. The routing table looks like this:
::1 dev lo proto kernel metric 256 pref medium
2a0c:xxx:yyy:zz00::/56 dev wg0 proto static metric 20 pref medium
2a0c:xxx::/32 dev wan0 proto kernel metric 256 pref medium
2a0c:xxx::/32 dev wan0 proto ra metric 1024 expires 2591957sec pref medium
fe80::/64 dev wan0 proto kernel metric 256 pref medium
default proto static metric 1024 pref medium
nexthop via 2a0c:xxx::1 dev wan0 weight 1
nexthop via fe80::****:****:****:3780 dev wan0 weight 1
When I try to ping dns.google
from the wg0
interface, the packets are not redirected to the wan0
interface. Why?
tcpdump on the wg0
interface gives something like this:
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, echo request, id 1, seq 5093, length 40
IP6 2a0c:xxx:yyy::1 > 2a0c:xxx:yyy:zz60::wwww: ICMP6, destination unreachable, unreachable address dns.google, length 88
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, echo request, id 1, seq 5094, length 40
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, neighbor solicitation, who has dns.google, length 26
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, neighbor solicitation, who has dns.google, length 26
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, neighbor solicitation, who has dns.google, length 26
IP6 2a0c:xxx:yyy::1 > 2a0c:xxx:yyy:zz60::wwww: ICMP6, destination unreachable, unreachable address dns.google, length 88
IP6 2a0c:xxx:yyy:zz60::wwww > dns.google: ICMP6, echo request, id 1, seq 5095, length 40
Checking the route via ip -6 r get shows the correct route (2001:4860:4860::8888 is dns.google):
❯ ip -6 r get to 2001:4860:4860::8888 from 2a0c:xxx:yyy:zz60::wwww iif wg0
2001:4860:4860::8888 from 2a0c:xxx:yyy:zz60::wwww via 2a0c:xxx::1 dev wan0 proto static metric 1024 iif wg0 pref medium
Sometimes packets are still redirected to the wan0 interface, but this happens very rarely.