关于macOS:使用virtualbox仅主机网络的vagrant private_network与osx主机/centos客户机

关于macOS:使用virtualbox仅主机网络的vagrant private_network与osx主机/centos客户机

我无法使用 ping、netcat 或 ssh 等方式使主机到客户机或客户机到主机的仅主机网络正常工作。Sshing 超时失败。在主机接口 vboxnet0 上启动 wireshark 时看不到任何数据包。我可以从客户机 ping 我的客户机 ip (192.168.33.10),但无法从主机 ping 我主机 vboxnet0 ip (192.168.33.1)。我应该怎么做才能调试这个问题?

主机配置

$ VBoxManage --version
4.3.14r95030

$ vagrant --version
Vagrant 1.6.3

$ grep -v '#' Vagrantfile 
VAGRANTFILE_API_VERSION = "2"    
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|    
  config.vm.box = "puppetlabs/centos-6.5-64-puppet"
  config.vm.network "private_network", ip: "192.168.33.10"
end

$ VBoxManage list hostonlyifs
Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       192.168.33.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

$ ifconfig vboxnet0
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00 
    inet 192.168.33.1 netmask 0xffffff00 broadcast 192.168.33.255

$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              5   338845     lo0
129.55.201.50      192.168.1.1        UGHWIi          1    26649     en0
192.168.1          link#5             UCS             0        0     en0
192.168.33         link#13            UCS             0        0 vboxnet
224.0.0/4          lo0                UmCS            0        0     lo0

来宾配置

$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 08:00:27:84:29:25  
          inet addr:192.168.33.10  Bcast:192.168.33.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe84:2925/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:552 (552.0 b)

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
192.168.33.0    *               255.255.255.0   U     0      0        0 eth1
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1003   0        0 eth1
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

主机和客户机防火墙已关闭。

相关内容