iptablesCentOS 7 以下的系统版本防火墙均使用iptables,所以要进行端口操作,请需要输入iptables命令开放端口(80为例):
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT关闭端口(80为例):
/sbin/iptables -I INPUT -p tcp --dport 80 -j DROP保存更改:
/etc/rc.d/init.d/iptables save查看开放端口:
/etc/init.d/iptables statusfirewallCentOS 7 及以上的系统版本防火墙均使用firewall,所以要进行端口操作,请需要输入firewall命令1.查看已经开放的端口:
firewall-cmd --list-ports2.添加端口(80端口为例):
firewall-cmd --zone=public --add-port=80/tcp --permanent 3.重新载入:
firewall-cmd --reload4.检查端口:
firewall-cmd --zone= public --query-port=80/tcp5.关闭端口(80为例):
firewall-cmd --zone= public --remove-port=80/tcp --permanent6.重启防火墙:
firewall-cmd --reload #重启firewallsystemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)7.命令含义:
–zone #作用域–add-port=80/tcp #添加端口,格式为:端口/通讯协议–permanent #永久生效,没有此参数重启后失效关闭firewall,安装iptablesCentOS 7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下1.关闭防火墙,禁止开启启动
systemctl stop firewalld.servicesystemctl disable firewalld.service2.安装 iptables service
yum -y install iptables-services3.后续即可使用iptable命令操作来管理防火墙
免责声明:本站发布的内容(图片、视频和文字)以原创、来自互联网转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系QQ:712375056 进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
Copyright © 2009-2021 56dr.com. All Rights Reserved. 特网科技 特网云 版权所有 珠海市特网科技有限公司 粤ICP备16109289号
域名注册服务机构:阿里云计算有限公司(万网) 域名服务机构:烟台帝思普网络科技有限公司(DNSPod) CDN服务:阿里云计算有限公司 中国互联网举报中心 增值电信业务经营许可证B2
建议您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流浏览器浏览本网站