3

我正在尝试为正在设置的 vagrant box 设置公共网络,并且我使用 Windows 10。如果我没有输入接口名称,vagrant 会询问接口名称,并且如果没有输入 vagrant 想要的内容,它将无法工作。

所以我的问题是如何从我的 Windows 10 PC 中获取确切的接口名称以用于 vagrant?

或者

我怎样才能让 vagrant 要求我从它可以检测到的接口名称列表中进行选择?

我已经搜索并搜索如何实现这一目标,但就是不能。

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

窗口ipconfig没有帮助

谢谢

4

1 回答 1

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
于 2015-10-18T19:36:32.693 回答