主机访问虚拟机时出现的问题

yum list iptables-services

yum remove iptables-services

今天想用主机访问一下虚拟机。找了教程:



1.配置httpd

虚拟机内部安装httpd,没安的话yum install httpd

启动 service httpd start(查看httpd服务状态  service httpd status  启动服务  service httpd start)

*********************************************************************************************************

关掉防火墙 (此处参考https://blog.csdn.net/qq_15030351/article/details/79733806)

CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下

1、直接关闭防火墙

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

2、设置 iptables service

yum-yinstalliptables-services

如果要修改防火墙配置,如增加防火墙端口3306

vi/etc/sysconfig/iptables

增加规则

-A INPUT -m state --state NEW -m tcp -p tcp --dport3306-j ACCEPT

保存退出后

systemctl restart iptables.service #重启防火墙使配置生效

systemctl enable iptables.service #设置防火墙开机启动

最后重启系统使设置生效即可。


然后发现不管虚拟机还是主机都访问不了了。。。

最后只好卸载掉安装的iptables-services才可以

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容