如何在Vagrant和VirtualBox中使用ipv6?


9

我有一个Vagrant安装程序,在VirtualBox中运行Ubuntu。我正在尝试创建一个可以从主机访问的公共虚拟网络接口。我用ipv4没问题。使用ipv6,我将接口设置为:

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

界面如下:

        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)

从主机上,我似乎无法在接口上ping这一个地址。

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

我想可能需要配置Vagrant或VirtualBox来接受ipv6连接。

还有一点。我当前的ISP不支持ipv6。我不认为这与它有任何关系,因为这都应该是本地请求。

更新:作为一种很好的措施,我为接口提供了一个ipv4地址,例如:

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)

而且我可以ping到主机形式没有问题:

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

更新:主机界面如下所示:

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

这表明VirtualBox接口都没有inet6,这可能是问题所在,但是我不确定如何启用它。


需要明确的是,这是FreeBSD主机上的VirtualBox吗?
迈克尔·汉普顿

这是OSX主机
kevzettler 2014年

Answers:


3

看起来,使用vagrants public_network选项将桥接virtualbox接口到主机接口,支持IPV6

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.