码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 防火墙开放特定端口 (iptables)

时间:2017-07-21 10:36:40      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:保存   编辑   inpu   rc.d   lin   添加   cep   input   table   

查看状态:
iptables -L -n
下面添加对特定端口开放的方法:
使用iptables开放如下端口
/sbin/iptables -I INPUT -p tcp --dport 8000 -j ACCEPT
保存
/etc/rc.d/init.d/iptables save
重启服务
service iptables restart
查看需要打开的端口是否生效?
/etc/init.d/iptables status

法2:
或直接编辑/etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 4000 -j ACCEPT
保存在前面部分
再重启:
service iptables restart

Linux 防火墙开放特定端口 (iptables)

标签:保存   编辑   inpu   rc.d   lin   添加   cep   input   table   

原文地址:http://www.cnblogs.com/wangluochong/p/7215509.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!