Chinaunix首页 | 论坛 | 博客
  • 博客访问: 433853
  • 博文数量: 65
  • 博客积分: 2461
  • 博客等级: 大尉
  • 技术积分: 730
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-19 12:26
文章分类

全部博文(65)

文章存档

2007年(40)

2006年(25)

我的朋友

分类: 网络与安全

2006-11-19 00:35:08

以下该段代码可自动生成防火墙规则文件ipf.rules
#!/bin/sh
wan="192.168.0.101"
lan="192.168.1.0/24"
proxyip="192.168.0.254"
caskyip="192.168.0.1"
ks="keep state"
fsk="flags S keep state"

cat > /etc/ipf.rules << EOF

pass in quick on lo0 all
pass out quick on lo0 all

pass in log quick on lnc0 proto icmp from $caskyip to $wan icmp-type 8 $ks
pass in log quick on lnc0 proto tcp from $caskyip to $wan port = 22 $fsk

pass out log quick on lnc0 proto icmp from $wan to any icmp-type 8 $ks
pass out log quick on lnc0 proto tcp from $proxyip to any port = 53 $fsk
pass out log quick on lnc0 proto udp from $proxyip to any port = 53 $ks

pass out log quick on lnc0 proto tcp from $proxyip to any port = 80 $fsk

pass out log quick on lnc0 proto tcp from $wan to $caskyip port = 21 $fsk
pass out log quick on lnc0 proto tcp from $wan to $caskyip port = 25 $fsk
pass out log quick on lnc0 proto tcp from $wan to $caskyip port = 110 $fsk

black out log quick on lnc0 all
black in log quick on lnc0 all

EOF
阅读(1405) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~