iptables学习

第一步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通本机

转载于:https://www.cnblogs.com/lineuman/p/6776008.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值