IPv6 ping guest from host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
j0k4b0
Posts: 2
Joined: 7. Nov 2022, 20:38

IPv6 ping guest from host

Post by j0k4b0 »

Hello,

I use vagrant to provision some virtual machines to deploy kubernetes locally. Now I am working IPv6 functionality and have some issues.

Host: Ubuntu 22.04 with VirtualBox 6.1
Guest: Oracle Linux 8

I create 6 virtual machines via vagrant with 1 NAT network and 1 private network. The private Network is defined as eth1 in guest.
Then I add IPv6 via ifconfig:

Code: Select all

ifconfig eth1 inet6 add #{ip6}/64
My addess-ranges are:
  • v6prefix = "192.168.59."
  • v6prefix = "fddd:0:0:1ff::"

Ping-Status:
  • ipv4 from host to guest => not working
  • ipv6 from guest to guest => working
  • ipv6 from guest to hist => seems not to work because answer comes from guest, not host I think
With IPv4, everything is working.

On my host the route table looks like this:

Code: Select all

$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
2a01:4f8:173:1728::/64 dev enp6s0 proto kernel metric 256 pref medium
fddd:0:0:1ff::/64 dev vboxnet3 proto kernel metric 256 pref medium
fe80::/64 dev enp6s0 proto kernel metric 256 pref medium
fe80::/64 dev tun0 proto kernel metric 256 pref medium
fe80::/64 dev vboxnet3 proto kernel metric 256 pref medium
fe80::/64 dev veth2d637d7 proto kernel metric 256 pref medium
fe80::/64 dev docker0 proto kernel metric 256 pref medium
default via fe80::1 dev enp6s0 proto static metric 1024 pref medium
What do I want?
I want to access my guest via browser from host via IPv6 and IPv6 (is working currently). And I want to use a private address range, not public addresses.

I also tested with link-local, but because of the missing implementation of interface specification "ipv6:interface" in the browser, this does not work for me.

Vagrant file:

Code: Select all

VAGRANTFILE_API_VERSION = "2"

v4prefix = "192.168.59."
v6prefix = "fddd:0:0:1ff::"
$num_instances = 6
$vm_memory ||= 4096
$vm_cpus ||= 2

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "generic/oracle8"
  config.ssh.insert_key = false

  (1..$num_instances).each do |i|

    config.vm.define vm_name = "k8s-%01d" % [i] do |node|
        node.vm.hostname = vm_name

        node.vm.provider :virtualbox do |vb|
            vb.memory = $vm_memory
            vb.cpus = $vm_cpus
            vb.gui = false
            vb.linked_clone = true
            vb.customize ["modifyvm", :id, "--vram", "8"] # ubuntu defaults to 256 MB which is a waste of precious RAM
            vb.customize ["modifyvm", :id, "--audio", "none"]
        end


        ip = "#{v4prefix}#{i+100}"
        ip6 = "#{v6prefix}#{i+100}"

        node.vm.network "private_network", ip: ip

        node.vm.provision "shell", inline: "systemctl stop firewalld; systemctl disable firewalld"
        node.vm.provision "shell", run: "always", inline: "sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0"
        node.vm.provision "shell", run: "always", inline: "sudo sysctl -w net.ipv6.conf.eth1.disable_ipv6=0"
        node.vm.provision "shell", run: "always", inline: "echo 0 > /proc/sys/net/ipv6/conf/eth1/disable_ipv6"
       
        # manual ipv6
        node.vm.provision "shell",
            run: "always",
            inline: "ifconfig eth1 inet6 add #{ip6}/64 || true"
    end
  end
end
Any idea?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: IPv6 ping guest from host

Post by scottgus1 »

I'm not too certain how to troubleshoot IPv6, but perhaps one of the forum gurus will.

However, we do not support Vagrant-driven VMs here. Vagrant has their own support channels.

If you can demonstrate this using Virtualbox-only VMs not controlled by Vagrant, then we may be able to help.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: IPv6 ping guest from host

Post by fth0 »

Since VirtualBox 6.1.28, Host-Only Networking is limited to specific IP address ranges by default. While your chosen IPv4 network is within those limits, your chosen IPv6 network is not. See 6.7. Host-Only Networking for details on how to allow other network ranges.

AFAIK, Vagrant adapted to the new rules a few weeks later. It's possible that they only addressed IPv4.
j0k4b0
Posts: 2
Joined: 7. Nov 2022, 20:38

Re: IPv6 ping guest from host

Post by j0k4b0 »

Hello,

I was able to reproduce the same issue with a plain OracleLinux VM in Virtualbox without Vagrant.

I added the additional IPv6 range to networks.conf:

/etc/vbox/networks.conf

Code: Select all

* 192.168.51.0/21
* FDDD::/16
Thanks for supporting.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: IPv6 ping guest from host

Post by scottgus1 »

j0k4b0 wrote:FDDD::/16
j0k4b0 wrote:v6prefix = "fddd:0:0:1ff::"
I'm not certain if case is important, but I'd standardize to lower case, make things as identical as can be. :wink:

Another idea, from the manual:
Next example allows any addresses, effectively disabling range control:
* 0.0.0.0/0 ::/0
Try this line to open up the filter completely, see if your Host-Only works.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: IPv6 ping guest from host

Post by fth0 »

To investigate further, you could use Wireshark on the host and in the guests to analyze the network traffic.
Post Reply