在Windows PC上创建流浪公共网络

时间:2015-10-18 02:50:47

标签: vagrant vagrantfile vagrant-windows

我正在尝试为流浪者设置公共网络设置并且我使用Windows 10.如果我没有设置接口名称,vagrant要求接口名称并且没有放置什么样的流浪者它将无法工作。

所以我的问题是如何从我的Windows 10 PC获取确切的界面名称以用于流浪汉?

OR

我如何让vagrant要求我从它可以检测到的界面名称列表中进行选择?

我已经搜索并搜索了如何实现这一目标但却无法实现。

config.vm.network "public_network", bridge: "???"

Window ipconfig无效

由于

1 个答案:

答案 0 :(得分:3)

您可以使用VBoxManage工具找出您的界面。

所以你可以运行 - 如果VBoxManage不在你的PATH中,你需要从你的VBoxManage目录运行它

VBoxManage.exe list bridgedifs

Name:            en0: Wi-Fi (AirPort)
GUID:            00306e65-0000-4000-8000-b8f6b1126bcf
DHCP:            Disabled
IPAddress:       192.168.1.33
NetworkMask:     255.255.255.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: b8:f6:b1:12:6b:cf
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-en0

Name:            en1: 1 Thunderbolt
GUID:            00316e65-0000-4000-8000-3200139bff20
DHCP:            Disabled
IPAddress:       0.0.0.0
NetworkMask:     0.0.0.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 32:00:13:9b:ff:20
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-en1

Name:            en2: 2 Thunderbolt
GUID:            00326e65-0000-4000-8000-3200139bff21
DHCP:            Disabled
IPAddress:       0.0.0.0
NetworkMask:     0.0.0.0
IPV6Address:
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 32:00:13:9b:ff:21
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-en2

etc etc

如果您有cygwin或其他什么,您甚至可以运行VBoxManage list bridgedifs | grep -e "^Name:*",并且您将获得在Vagrantfile中使用的确切名称。

运行VirtualBox 5.0.6的Windows框上的

C:\Program Files\Oracle\VirtualBox>vboxmanage list
Oracle VM VirtualBox Command Line Management Interface Version 5.0.6
(C) 2005-2015 Oracle Corporation
All rights reserved.

Usage:

VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|
                            intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|
                            hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|
                            usbhost|usbfilters|systemproperties|extpacks|
                            groups|webcams|screenshotformats


C:\Program Files\Oracle\VirtualBox>vboxmanage list bridgedifs
Name:            Intel(R) PRO/1000 MT Network Connection
GUID:            754f0866-bd85-43bc-b403-3c85945b3226
DHCP:            Enabled
IPAddress:       172.16.42.165
NetworkMask:     255.255.255.0
IPV6Address:     fe80:0000:0000:0000:64b8:b1cf:962f:7aa1
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 00:0c:29:64:09:f3
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-Intel(R) PRO/1000 MT Network Connection


Name:            Juniper Network Connect Virtual Adapter
GUID:            ed9c3519-e796-42ce-b782-14ec6819b743
DHCP:            Enabled
IPAddress:       169.254.251.149
NetworkMask:     15.0.0.0
IPV6Address:     fe80:0000:0000:0000:5525:2e65:10a8:fb95
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 00:ff:10:e0:06:1a
MediumType:      Ethernet
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-Juniper Network Connect Virtual Adapter