第一步how怎么使用iptables
第二步why
iptables -nvxL
这个命令可以用来查看有多少包(包这个网络概念至今对我来说还是抽象的2016.8.19)被iptables截住了
方法:iptables -h ;man page
iptabes下的几个概念
1.tables
filter,nat,mangle,raw,security
2.chains
INPUT,OUTPUT,FORWARD, PREROUTING,POSTROUTING
3.rules
每一条规则包括match和target,如果match符合就执行 target否则执行下一条规则
rule-specification = [matches…] [target]
match = -m matchname [per-match-options]
target = -j targetname [per-target-options]
ACCEPT means to let the packet through
DROP means to drop the packet on the floor
QUEUE
RETURN
规则的作用顺序是从前往后的
比如
执行下面两个命令
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
iptables -A INPUT -p tcp –dport 22 -j DROP
利用iptables实现下面功能
1、不让远端机器通过ssh登陆
2、不允许外面的机器ping通本机