echo "block out quick proto tcp/udp from any to 202.104.129.251 #不能连接QQ" >> /etc/ipf.rules
echo "block out quick proto tcp/udp from any to 202.104.129.252 #不能连接QQ" >> /etc/ipf.rules
echo "block out quick proto tcp/udp from any to 202.104.129.254 #不能连接QQ" >> /etc/ipf.rules
echo "block out quick proto tcp/udp from any to 204.134.15.1 #不能连接QQ" >> /etc/ipf.rules
echo "" >> /etc/ipf.rules
echo "#内部网络可以访问外部网络" >> /etc/ipf.rules
echo "pass out log on "$ADSLDEV" proto icmp all keep state" >> /etc/ipf.rules
echo "pass out log on "$ADSLDEV" proto tcp/udp from any to any keep state" >> /etc/ipf.rules
echo "" >> /etc/ipf.rules
echo "#阻塞外部网络的其它请求" >> /etc/ipf.rules
echo "block return-rst in log on "$ADSLDEV" proto tcp from any to "$ADSLIP" flags S/SA" >> /etc/ipf.rules
echo "block return-icmp(net-unr) in log on "$ADSLDEV" proto udp from any to "$ADSLIP"" >> /etc/ipf.rules
echo "block in log on "$ADSLDEV" all" >> /etc/ipf.rules
echo "" >> /etc/ipf.rules
echo "#阻塞内部网络访问以下指定IP地址" >> /etc/ipf.rules
echo "#block in log quick on rl1 proto tcp from any to 202.106.185.77 flags S/SA #不能连接163.com" >> /etc/ipf.rules
echo "" >> /etc/ipf.rules
echo "#内部网络的数据全部可以通过防火墙" >> /etc/ipf.rules
echo "pass in on "$INTARNDEV" all" >> /etc/ipf.rules
echo "pass out on "$INTARNDEV" all" >> /etc/ipf.rules
echo "pass in on lo0 all" >> /etc/ipf.rules
echo "pass out on lo0 all" >> /etc/ipf.rules
echo "" >> /etc/ipf.rules
echo "#让VPN能通过防火墙" >> /etc/ipf.rules
echo "pass in quick on "$ADSLDEV" proto tcp from any to any port = 47 keep state" >> /etc/ipf.rules
echo "pass out quick on "$ADSLDEV" proto tcp from any port = 47 to any keep state" >> /etc/ipf.rules
echo "pass in quick on "$ADSLDEV" proto tcp from any to any port = 1723 keep state" >> /etc/ipf.rules
echo "pass out quick on "$ADSLDEV" proto tcp from any port = 1723 to any keep state" >> /etc/ipf.rules
echo "pass in proto gre from any to any keep state" >> /etc/ipf.rules
echo "pass out proto gre from any to any keep state" >> /etc/ipf.rules
echo "pass in on ng0 all" >> /etc/ipf.rules
echo "pass out on ng0 all" >> /etc/ipf.rules
/sbin/ipf -Fa -f /etc/ipf.rules
/sbin/ipnat -CF -f /etc/ipnat.rules
############################## END ADSLIP.SH #################################
最后我们还要在/etc/rc.conf中加入以下命令行:
gateway_enable="YES"
到这里我们就完成了基于ADSL的VPN防火墙(IPFILTER)网关的安装和配置,至于如何做你的防火墙规则就看你自己了以上只是一个样板而已 。
推荐阅读
- 小C使用三月有感
- 一 FreeBSD kernel 编译大法
- opporeno中打开开发者选项的使用教程
- FreeBSD 新软件安装
- FreeBSD MRTG-Packet Count
- 小车防冻液的作用与正确使用方法 小车防冻液的作用有哪些
- FreeBSD 文件和目录查找
- 滑动离合器使用技巧 滑动离合器使用方法
- 使用夏新M6三天————修机经历
- 有道词典中使用离线翻译功能具体操作方法