Linux安全防火墙iptables
Centos为例,iptables命令相关
iptables配置文件路径:/etc/sysconfig/iptables
iptables常用命令:
iptables -L -vn
service iptables save
service iptables reload
service iptables status
service iptables start
iptables配置文件示例:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p icmp --icmp-type any -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -s localhost -d localhost -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Ping洪水攻击
-A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
# HTTPS
-A INPUT -p tcp --dport 443 -j ACCEPT
# POP3
-A INPUT -p tcp --dport 110 -j ACCEPT
# SMTP
-A INPUT -p tcp --dport 25 -j ACCEPT
# FTP
-A INPUT -p tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 20 -j ACCEPT
# DNS
-A INPUT -p tcp --dport 53 -j ACCEPT
# 端口白名单
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9271 -j ACCEPT
# ip白名单
-A INPUT -s 183.63.90.55/32 -j ACCEPT