Linux配置防火墙 开启80端口
编辑配置文件/etc/sysconfig/iptables
[root@weixinht ~]# vim /etc/sysconfig/iptables
1 # Firewall configuration written by system-config-firewall
2 # Manual customization of this file is not recommended. 3 *filter 4 :INPUT ACCEPT [0:0] 5 :FORWARD ACCEPT [0:0] 6 :OUTPUT ACCEPT [0:0] 7 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 8 -A INPUT -p icmp -j ACCEPT 9 -A INPUT -i lo -j ACCEPT 10 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 11 12 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 13 14 -A INPUT -j REJECT --reject-with icmp-host-prohibited 15 -A INPUT -j REJECT --reject-with icmp-host-prohibited 16 -A FORWARD -j REJECT --reject-with icmp-host-prohibited 17 COMMIT
修改的部分:
在第10行22端口规则的下面增加 80端口规则
编辑时直接y复制一行再p粘贴, 22改为80
/etc/init.d/iptables restart
重启防火墙使配置生效