iptables,ebtables,arptables
2009-04-26 17:30
169 查看
还有多少tables可以来一下。
话说还是把本机防火墙配起来了,经历两次把自己关在门外后,开始小心翼翼了。
1 #!/bin/sh -e
2 IPTABLES="/sbin/iptables"
3 ARPTABLES="/sbin/arptables"
4
5 echo 1 > /proc/sys/net/ipv4/ip_forward
6 start(){
7 # flush
8 $IPTABLES -F
9
# set default policy
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
# input chain
# state allow
$IPTABLES -A OUTPUT -m state --state INVALID -j REJECT
$IPTABLES -A INPUT -m state --state INVALID -j REJECT
$IPTABLES -A INPUT -p icmp -m limit --limit 20/minute --limit-burst 5 --icmp-type 8 -j ACCEPT
$IPTABLES -A INPUT -p icmp -m limit --limit 20/minute --limit-burst 5 --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p icmp -j REJECT --reject-with icmp-host-unreachable
#reject arping
$ARPTABLES -P INPUT DROP
$ARPTABLES -P OUTPUT DROP
$ARPTABLES -P FORWARD ACCEPT
$ARPTABLES -A INPUT --source-mac 00:d0:xx:xx:xx:xx -j ACCEPT
$ARPTABLES -A OUTPUT --destination-mac 00:d0:xx:xx:xx:xx -j ACCEPT
$ARPTABLES -A INPUT --opcode 2 -j ACCEPT
$ARPTABLES -A OUTPUT --opcode 1 -j ACCEPT
}
stop(){
$IPTABLES -F
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$ARPTABLES -F
$ARPTABLES -P INPUT ACCEPT
$ARPTABLES -P OUTPUT ACCEPT
$ARPTABLES -P FORWARD ACCEPT
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "$0 {start|stop}"
exit 1
;;
esac
exit 0
话说还是把本机防火墙配起来了,经历两次把自己关在门外后,开始小心翼翼了。
1 #!/bin/sh -e
2 IPTABLES="/sbin/iptables"
3 ARPTABLES="/sbin/arptables"
4
5 echo 1 > /proc/sys/net/ipv4/ip_forward
6 start(){
7 # flush
8 $IPTABLES -F
9
# set default policy
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
# input chain
# state allow
$IPTABLES -A OUTPUT -m state --state INVALID -j REJECT
$IPTABLES -A INPUT -m state --state INVALID -j REJECT
$IPTABLES -A INPUT -p icmp -m limit --limit 20/minute --limit-burst 5 --icmp-type 8 -j ACCEPT
$IPTABLES -A INPUT -p icmp -m limit --limit 20/minute --limit-burst 5 --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p icmp -j REJECT --reject-with icmp-host-unreachable
#reject arping
$ARPTABLES -P INPUT DROP
$ARPTABLES -P OUTPUT DROP
$ARPTABLES -P FORWARD ACCEPT
$ARPTABLES -A INPUT --source-mac 00:d0:xx:xx:xx:xx -j ACCEPT
$ARPTABLES -A OUTPUT --destination-mac 00:d0:xx:xx:xx:xx -j ACCEPT
$ARPTABLES -A INPUT --opcode 2 -j ACCEPT
$ARPTABLES -A OUTPUT --opcode 1 -j ACCEPT
}
stop(){
$IPTABLES -F
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$ARPTABLES -F
$ARPTABLES -P INPUT ACCEPT
$ARPTABLES -P OUTPUT ACCEPT
$ARPTABLES -P FORWARD ACCEPT
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "$0 {start|stop}"
exit 1
;;
esac
exit 0
![](http://img.zemanta.com/pixy.gif?x-id=fc4460e4-05d7-89fc-ba29-5b2cdca9b3a8)
相关文章推荐
- iptables、ebtables、arptables
- iptables、ebtables、arptables
- ebtables/iptables
- 【Linux】iptables&ebtables
- ebtables/iptables interaction on a Linux-based bridge
- Linux网络路由表处理及钩子(Iptables and Ebtables)
- Ebtables/Iptables分析
- ebtables arptables的安装
- ebtables与iptables的区别(ebtables的简单应用)
- ebtables/iptables interaction on a Linux-based bridge
- iptables & ebtables 默认表名
- Linux上iptables防火墙的基本应用教程
- Linux下的iptables详解及配置
- (转载)Linux上iptables防火墙的基本应用教程
- iptables默认安全规则脚本
- 策略路由以及使用 ip route , ip rule , iptables 配置策略路由实例
- CentOS / Redhat Iptables Firewall Configuration Tutorial
- linux用iptables实现网站访问重定向
- 11gR2 RAC启用iptables导致节点宕机问题处理
- iptables日志维护