Vagrant + Hyper V IPV6地址已分配

时间:2017-11-18 14:06:16

标签: vagrant ubuntu-16.04 hyper-v

我在使用Hyper V的Windows 10上遇到了很多关于Vagrant 2.0.1的麻烦。

当我做流浪汉时,我会收到一个ipv6地址。哪位厨师无法访问,也无法配置虚拟:

Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Configured startup memory is 2048
==> default: Configured cpus number is 2
==> default: Importing a Hyper-V instance
    default: Cloning virtual hard drive...
    default: Creating and registering the VM...
    default: Setting VM Integration Services
    default: Successfully imported a VM with name: vargrant-dev-source
==> default: Installing Chef cookbooks with Librarian-Chef...
==> default: Auto-generating node name for Chef...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: fe80::215:5dff:fe02:f5a
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: fe80::215:5dff:fe02:f5a:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    ... Eventually times out here ....

我使用以下命令设置NATed开关:

New-VMSwitch –SwitchName “NATSwitch” –SwitchType Internal
New-NetIPAddress –IPAddress 172.21.21.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNat –Name MyNATnetwork –InternalIPInterfaceAddressPrefix 172.21.21.0/24

有趣的是,一切都在我第一次设置VM交换机时工作,我得到一个有效的IPV4地址,一切正常。但重新启动后,虚拟机只会获得IPV6地址,我无法访问重启前创建的现有虚拟机。

我的流浪档案:

Vagrant.configure("2") do |config|

  config.vm.provider "hyperv"
  config.vm.box = "maxx/ubuntu16"
  config.vm.boot_timeout = 2000
  config.vm.network "private_network", ip: "172.21.21.2"

  ... general config omitted.

end

我尝试过DHCP和静态,但两者似乎都失败了。静态IP似乎完全被忽略了。

任何想法我错过了什么或做错了什么? (如果相关,我正在使用wifi连接)

1 个答案:

答案 0 :(得分:0)

我通过在我的wifi和虚拟超级v网络之间使用互联网连接共享找到了解决方法。但是目前,Windows build 1607中存在一个错误,每次重启后都需要重新启动Internet连接。

MS论坛上有一个大线程: https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/ics-internet-connection-sharing-dosent-work-in/a203c90f-1214-4e5e-ae90-9832ae5ceb55