今天出现了能ping通,却连不上虚拟机中的服务器的问题。
有两种原因,①ssh服务未启动 ②防火墙没关闭
经查,是防火墙的问题,在centos7上关闭防火墙的命令是: sudo systemctl stop firewalld.service
查看防火墙状态的命令是: sudo systemctl status firewalld.service
详细的可以参考:http://www.centoscn.com/CentOS/Intermediate/2015/0313/4879.html
注:CentOS7用firewall命令“替代”了iptables。在这里我们需要区分“iptables服务”和“iptables命令”。虽然firewalld是替代提供的防火墙管理iptables服务,但是它仍然使用iptables对内核命令动态通信包过滤。所以它只是iptables服务代替,而不是iptables命令。参考:http://www.centoscn.com/CentOS/Intermediate/2015/0911/6160.html