宿主机mac os无法连接到虚拟机centos

时间:2024-01-21 09:20:57

宿主机:

Mac OS 10.9.2

虚拟机:

[root@localhost ~]# cat /etc/redhat-release

CentOS release 6.4 (Final)

[root@localhost ~]# uname -a

Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

虚拟机是通过vagrant up启动的

port映射已经在Vagrantfile里配置

config.vm.network :forwarded_port, guest: 80, host: 9098


而且打开局域网内能够訪问

config.vm.network :public_network

问题:

宿主机无法连接到虚拟机。


解决方法:
关闭虚拟机的防火墙

[root@localhost ~]# service iptables stop

iptables: Flushing firewall rules:                         [  OK 
]

iptables: Setting chains to policy ACCEPT: filter          [  OK 
]

iptables: Unloading modules:                               [  OK 
]