首页 > 其他 > 详细

Centos 开放80端口

时间:2015-07-15 01:14:34      阅读:231      评论:0      收藏:0      [点我收藏+]


#/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

再查看是否已经有了:
[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
二.重启电脑。

1.CentOS操作系统防火墙默认已经开放了80和22端口

2.这里应该也可以不重启计算机:
#/etc/init.d/iptables restart
防火墙的关闭,关闭其服务即可:

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

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

三.永久关闭防火墙

我们也可以永久的关闭防火墙,但是我不建议大家这样做.永久关闭防火墙可以这样:
#chkconfig –level 35 iptables off
也可以直接修改
/etc/sysconfig/iptables
添加一条
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


来源:http://www.cnblogs.com/cnjava/p/3311950.html

Centos 开放80端口

原文:http://www.cnblogs.com/fengbohello/p/4647011.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!