如果需要外界连接,记得在防火墙开放端口
vim /etc/sysconfig/iptables
防火墙的重启
service iptables restart
关闭
service iptables stop
查看状态
service iptables status
禁止防火墙关机自启动
chkconfig iptables off 或 on chkconfig iptables —list 查看自启动状态列表
检查防火墙是否开启:
firewall-cmd —state
开启防火墙:
systemctl start firewalld
防火墙开启8080端口
firewall-cmd —zone=public —add-port=8080/tcp —permanent
重启防火墙:
firewall-cmd —reload
查看8080端口是否添加成功
firewall-cmd —zone=public —query-port=8080/tcp
//开启端口 firewall-cmd —zone=public —add-port=11111/tcp —permanent //查询端口号11111是否开启: firewall-cmd —query-port=11111/tcp //重启防火墙: firewall-cmd —reload //查询有哪些端口是开启的: firewall-cmd —list-port //禁用端口 firewall-cmd —zone=public —remove-port=11111/tcp —permanent