IPv6 in VM does not work

Joined
May 25, 2023
Messages
3
I am new to IPv6, but finally got it working on my LAN. My iPhone and Mac have IPv6 Addresses and the IPv6 test sites work fine.

I run a PiHole as a VM on my Truenas and would like to set it up to do ipv6 DNS requests too now.

However, I am running into issues as the VM seems to get an IPv6 address.. but does not have connectivity.

if I run the command 'netplan apply' in the vm, and immediately ping6 google.com, then it will correctly ping it 1 time with about 6ms latency.. and then stop working. So the VM must be getting the address correctly, I think there is an issue with the KVM stack.

Versions:
TrueNAS-SCALE-22.12.3.1

`ip a` output on truenas:

Code:
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether d8:5e:d3:20:0c:e5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic enp2s0
       valid_lft 6709sec preferred_lft 6709sec
    inet6 2a05:XXX:1:YYY:da5e:d3ff:fe20:ce5/64 scope global dynamic mngtmpaddr
       valid_lft 86017sec preferred_lft 14017sec
    inet6 fe80::da5e:d3ff:fe20:ce5/64 scope link
       valid_lft forever preferred_lft forever


`ping6 google.com` truenas


Code:
root@truenas[~]# ping6 google.com
PING google.com(lhr48s27-in-x0e.1e100.net (2a00:1450:4009:815::200e)) 56 data bytes
64 bytes from lhr48s27-in-x0e.1e100.net (2a00:1450:4009:815::200e): icmp_seq=1 ttl=119 time=5.97 ms
64 bytes from lhr48s27-in-x0e.1e100.net (2a00:1450:4009:815::200e): icmp_seq=2 ttl=119 time=6.66 ms
64 bytes from lhr48s27-in-x0e.1e100.net (2a00:1450:4009:815::200e): icmp_seq=3 ttl=119 time=5.76 ms
64 bytes from lhr48s27-in-x0e.1e100.net (2a00:1450:4009:815::200e): icmp_seq=4 ttl=119 time=6.85 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 5.758/6.308/6.849/0.456 ms


`ip a` VM:

Code:
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:a0:98:39:21:1b brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 192.168.1.4/24 metric 100 brd 192.168.1.255 scope global dynamic ens3
       valid_lft 6540sec preferred_lft 6540sec
    inet6 ABCD:EFGH:1:ABCD::1:180e/128 scope global dynamic noprefixroute
       valid_lft 5455sec preferred_lft 2755sec
    inet6 ABCD:EFGH:1:ABCD:2a0:98ff:fe39:211b/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 86231sec preferred_lft 14231sec
    inet6 fe80::2a0:98ff:fe39:211b/64 scope link
       valid_lft forever preferred_lft forever


Ping VM:


Code:
root@pihole:~# ping6 google.com
PING google.com(lhr25s33-in-x0e.1e100.net (2a00:1450:4009:81f::200e)) 56 data bytes
^C
--- google.com ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4104ms

root@pihole:~# 



Interestingly, it seems the VM can resolve google.com but not ping it's IPv6
 

klasemann

Cadet
Joined
Jul 13, 2023
Messages
1
I had the exact same problem when setting up a VM with debian today. After a longer research I at least found a fix to prefer IPv4 addresses over IPV6 adresses by doing the following:

sudo nano /etc/gai.conf

Uncomment the line
precedence ::ffff:0:0/96 100

Hope this helps
 
Top