How to use ipv6 with Vagrant and VirtualBox?

5,190

It looks like using vagrants public_network option will bridge the virtualbox interface to the host interface piggy backing IPV6

Share:
5,190
kevzettler
Author by

kevzettler

Updated on September 18, 2022

Comments

  • kevzettler
    kevzettler over 1 year

    I have a Vagrant setup running Ubuntu in VirtualBox. I'm trying to create a public virtual network interface that I can access from the host. I have had no problem doing this with ipv4. Using ipv6 I set the interface up like:

    guest$ ip link add derpcraft link eth1 type macvlan mode bridge;    
    guest$ ip -6 addr add fdfe:dcba:9876:ffff::/64 dev derpcraft
    guest$ ip link set derpcraft up
    

    The interface looks like:

            derpcraft Link encap:Ethernet  HWaddr 26:22:d5:54:95:00  
                      inet6 addr: fe80::2422:d5ff:fe54:9500/64 Scope:Link
                      inet6 addr: fdfe:dcba:9876:ffff::/64 Scope:Global
                      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                      RX packets:264 errors:0 dropped:0 overruns:0 frame:0
                      TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
                      collisions:0 txqueuelen:0 
                      RX bytes:52989 (52.9 KB)  TX bytes:2040 (2.0 KB)
    

    From the host machine I can't seem to ping this either address on the interface.

    host$ ping6 fe80::2422:d5ff:fe54:9500
    ping6: UDP connect: No route to host
    host$ ping6 fe80::2422:d5ff:fe54:9500%::1
    ping6: UDP connect: No route to host
    host$ ping6 fdfe:dcba:9876:ffff::
    ping6: UDP connect: No route to host
    host$ ping6 fdfe:dcba:9876:ffff::%::1
    ping6: UDP connect: No route to host
    

    I think I may need to configure Vagrant or VirtualBox to accept ipv6 connections.

    Another point. My current ISP is not ipv6 friendly yet. I don't suspect that has anything to do with it because this should all be a local request.

    Update: For good measure I gave the interface an ipv4 address like:

    guest$ ip address add 192.168.33.11/24 broadcast 192.168.33.255 dev derpcraft
    guest$ ifconfig
    derpcraft Link encap:Ethernet  HWaddr 26:22:d5:54:95:00  
              inet addr:192.168.33.11  Bcast:192.168.33.255  Mask:255.255.255.0
              inet6 addr: fe80::2422:d5ff:fe54:9500/64 Scope:Link
              inet6 addr: fdfe:dcba:9876:ffff::/64 Scope:Global
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1736 errors:0 dropped:0 overruns:0 frame:0
              TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:418224 (418.2 KB)  TX bytes:2040 (2.0 KB)
    

    And I can ping that form the host no problem:

    host$ ping 192.168.33.11
    PING 192.168.33.11 (192.168.33.11): 56 data bytes
    64 bytes from 192.168.33.11: icmp_seq=0 ttl=64 time=0.497 ms
    64 bytes from 192.168.33.11: icmp_seq=1 ttl=64 time=0.426 ms
    64 bytes from 192.168.33.11: icmp_seq=2 ttl=64 time=0.388 ms
    ^C
    --- 192.168.33.11 ping statistics ---
    3 packets transmitted, 3 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.388/0.437/0.497/0.045 ms
    

    Update: The host interface looks like:

    host$ ifconfig
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
        inet 127.0.0.1 netmask 0xff000000 
        inet6 ::1 prefixlen 128 
    gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
    stf0: flags=0<> mtu 1280
    en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 04:0c:ce:e4:1f:be 
        inet6 fe80::60c:ceff:fee4:1fbe%en0 prefixlen 64 scopeid 0x4 
        inet 192.168.1.72 netmask 0xffffff00 broadcast 192.168.1.255
        media: autoselect
        status: active
    p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
        ether 06:0c:ce:e4:1f:be 
        media: autoselect
        status: inactive
    vboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 0a:00:27:00:00:00 
    vboxnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 0a:00:27:00:00:01 
        inet 192.168.33.1 netmask 0xffffff00 broadcast 192.168.33.255
    

    Which shows neither of the VirtualBox interfaces have inet6, and this is probably the issue, but i'm not sure how to enable it.

    • Admin
      Admin about 10 years
      Just to be clear, this is VirtualBox on a FreeBSD host?
    • Admin
      Admin about 10 years
      this is a OSX host