CentOS 防火墙配置 80端口

看了好几个页面内容都有错,下面是正确方法:
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

然后保存:
#/etc/rc.d/init.d/iptables save

 

这样重启计算机后,防火墙默认已经开放了80和22端口

这里应该也可以不重启计算机:
#/etc/init.d/iptables restart

防火墙的关闭,关闭其服务即可:

查看防火墙信息:
#/etc/init.d/iptables status

关闭防火墙服务:
#/etc/init.d/iptables stop

永久关闭?不知道怎么个永久法:
#chkconfig –level 35 iptables off 

再查看是否已经有了:
[root@vcentos ~]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination        
1    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:80
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80
3    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0          

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination        
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值