首页 > 代码库 > 宿主机mac os无法连接到虚拟机centos

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

宿主机:

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启动的

端口映射已经在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 ]