方法一:CentOS 6
0.防火墙操作
即时生效,重启后失效:
开启防火墙
/etc/rc.d/init.d/iptables start
关闭防火墙
/etc/rc.d/init.d/iptables stop
重启后永久性生效:
开启防火墙
chkconfig iptables on
关闭防火墙
chkconfig iptables off
1.开放指定端口
开放端口
/sbin/iptables -I INPUT -p tcp –dport 端口 -j ACCEPT
保存配置
/etc/init.d/iptables save
重启防火墙
/etc/rc.d/init.d/iptables restart
2.关闭指定端口
关闭端口
/sbin/iptables -I INPUT -p tcp –dport 端口 -j DROP
保存配置
/etc/init.d/iptables save
重启防火墙
/etc/rc.d/init.d/iptables restart
3.查看端口状态
查看
/etc/init.d/iptables status
4.清除防火墙规则
清除
iptables -F
若上面方面报错,则证明你服务器系统是Centos7以上,则用以下方法
方法二:CentOS 7
0.防火墙操作
查看防火墙
systemctl status firewalld
即时生效,重启后失效:
开启防火墙
systemctl start firewalld
关闭防火墙
systemctl stop firewalld
重启后永久性生效:
开启防火墙
systemctl enable firewalld
关闭防火墙
systemctl disable firewalld
1.开放指定端口
开放端口
firewall-cmd –zone=public –add-port=端口/tcp –permanent
重新载入
firewall-cmd –reload
2.关闭指定端口
关闭端口
firewall-cmd –zone=public –remove-port=端口/tcp –permanent
重新载入
firewall-cmd –reload
3.查看端口状态
查看端口
firewall-cmd –zone=public –query-port=端口/tcp
4.查询开放端口列表
查看列表
firewall-cmd –zone=public –list-ports
若开放了端口还是连接不上你想要的端口,注意:有可能是你服务器自带安全组策略限制的原因,这种情况需要在官方服务器管理控制台手动开放。
1.所有资源均搜集自互联网,版权归原作者!仅供测试使用,如有侵权请联系我们!
2.分享目的仅供大家学习和交流,您必须在下载后24小时内删除!本站不承担任何法律责任!
3.不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 仅对资源整理优化,不对资源内容负责!不免费包含技术服务!
5.若资源链接失效,请联系发帖作者,添加群联系管理员或添加客服!

软壳源码网 » centos6和centos7开放防火墙指定端口两种方法

常见问题FAQ

签到位置不知道?
头像旁边右上角三横按钮-点击出现个人信息-签到(任意页面最右侧跟随浮动栏)
解压密码?
www.ruankor.com或者ruankor.com

142 评论

  1. bupropion 150mg over the counter oral zyban 150 mg order quetiapine 50mg without prescription

  2. buy cialis 20mg online poker game quick hits free online slots

  3. Medscape Drugs & Diseases. Drug information.
    bph cialis dosage
    Get warning information here. Get information now.

  4. Everything information about medication. п»їMedicament prescribing information.
    cheapest tadalafil us
    earch our drug database. All trends of medicament.

  5. esomeprazole 20mg capsules nexium ca furosemide for sale online

  6. hello there
    i have learn several just right stuff here. Definitely value bookmarking for revisiting.Aspectmontage makes it easy as can be and affordable for you to upgrade your windows, doors, roofing, showers or baths. “강남오피” this is kind of off topic but I need some guidance from an established blog. I will be coming back to your website for Perfect piece of work you have done, this internet site is really cool with wonderful info.

  7. Can I show my graceful appreciation and show my appreciatation온라인바카라 really good stuff and if you want to have a checkout
    Let me tell you a brief about how to get connected to girls for free I am always here for yall you know that right?

  8. i have learn several just right stuff here. Definitely value bookmarking for revisiting Aspectmontage makes it easy as can be and affordable for you to upgrade your windows, doors, roofing, showers or baths“오피뷰”’m really impressed with your writing skills and also indow replacement Boston In addition to installing abode improvement products that compel your serene,

发表评论

提供最优质的资源集合

加入本群 联系客服
本站由免费云加速(FreeCDN)提供网站加速和攻击防御服务