您现在的位置是:网站首页> 编程资料编程资料
CentOS防火墙开启80端口_资源网
2022-04-11
856人已围观
简介 CentOS防火墙开启80端口_资源网
我们以添加80端口为例操作如下:
[root@centos httpd]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
保存
[root@centos httpd]# /etc/rc.d/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]
如果上面的步骤还没好的话,可能是这个iptables文件使用的是包含调用。
一般的在/etc/sysconfig/iptables这个路径上
或者使用vi打开这个文件修改手动添加
[root@centos httpd]# vi /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Tue Feb 14 07:32:18 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [7:640]
-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Feb 14 07:32:18 2012
重新启动服务
[root@centos httpd]# service iptables restart
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则: [确定]
查看端口是否生效:
[root@centos httpd]# /etc/init.d/iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:10000
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,
4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp
7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with ic
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with ic
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
点击排行
本栏推荐
-
魔兽世界9.0圣所怎么升级 wow9.0圣所详细升级攻略_网络游戏_游戏攻略_
-
魔兽世界9.0薇茜弗涅的邪恶暮钟任务怎么做 薇茜弗涅的邪恶暮钟任务攻略_网络游戏_游戏攻略_
-
魔兽世界9.0通灵战潮大秘境路线、BOSS技能解析及打法 通灵战潮大秘境攻略_网络游戏_游戏攻略_
-
魔兽世界9.0各职业盟约怎么选 全职业全天赋盟约选择超详细指南攻略_网络游戏_游戏攻略_
-
魔兽世界9.0最终赎罪任务在哪接 RT博学者成就攻略_网络游戏_游戏攻略_
-
魔兽世界见证守魂者的信条哪里刷 wow9.0见证守魂者的信条刷新位置_网络游戏_游戏攻略_
-
魔兽世界9.0法夜圣所指挥台在哪 法夜圣所指挥台位置坐标_网络游戏_游戏攻略_
猜你喜欢
- 魔兽世界9.0圣所怎么升级 wow9.0圣所详细升级攻略_网络游戏_游戏攻略_
- 魔兽世界9.0薇茜弗涅的邪恶暮钟任务怎么做 薇茜弗涅的邪恶暮钟任务攻略_网络游戏_游戏攻略_
- 魔兽世界9.0通灵战潮大秘境路线、BOSS技能解析及打法 通灵战潮大秘境攻略_网络游戏_游戏攻略_
- 魔兽世界9.0各职业盟约怎么选 全职业全天赋盟约选择超详细指南攻略_网络游戏_游戏攻略_
- 魔兽世界9.0最终赎罪任务在哪接 RT博学者成就攻略_网络游戏_游戏攻略_
- 魔兽世界见证守魂者的信条哪里刷 wow9.0见证守魂者的信条刷新位置_网络游戏_游戏攻略_
- 魔兽世界9.0法夜圣所指挥台在哪 法夜圣所指挥台位置坐标_网络游戏_游戏攻略_