# log # iptables -A INPUT -p tcp -d 0.0.0.0/24 -j LOG --log-prefix "DROP_AAA__ " --log-level info # iptables -A INPUT -p tcp --dport 1:65535 -j LOG --log-prefix "DROP_BBB__ " --log-level info
# allow old connection and deny new connection iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP
如果用 iptables -L ,会得到以下结果
Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED DROP all -- anywhere anywhere state INVALID,NEW
# allow old connection and deny new connection iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP iptables -A INPUT -i eth1 -m state --state NEW,INVALID -j DROP