免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2840 | 回复: 0
打印 上一主题 下一主题

架设NAT服务器,系统为freebsd,使用pan限p2p分时段下载 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-11 19:30 |只看该作者 |倒序浏览
搬到有8万外来人口的TJL村租房,一进村有点在家乡赶集的感觉,印象就是人多,垃圾多,摆摊多,随便找了找,看了看选了一间采光不错的屋子,宽带还免费哈哈,可惜一到晚上就是没法用,问房东才知道是怎么回事;1M网通AD,一个TP路由带30个用户,可以想象问题所在了,,在运营商工作了快5年网维了,所以要解决网络资源合理利用是小菜了 哈哈 吹吹牛,,,所以去房东那边胡喷了一下,叫房东买了台PC解决房东一直困扰的问题,运行快一年了,一直很稳定!


系统bsd6.2,加PAN分时段限制p2p下载,4张网卡,

结构:

AD猫>>eth1--(eth2-pan桥-eth3)--eth4>>交换机>>住户


1,编译内核,加nat模块,ipfw

CP /usr/src/sys/i386/conf/GENERIC NAT

VI NAT

options IPFIREWALL
options IPDIVERT
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=100
options IPSTEALTH
options ACCEPT_FILTER_DATA
options ACCEPT_FILTER_HTTP
options ICMP_BANDLIM
options DUMMYNET
options IPFIREWALL_DEFAULT_TO_ACCETP
#IPFIREWALL_FORWARD

#make depend
#make
#make install
#reboot

2,配置rc.conf  拨号ppp.conf

NatRouter# cat /etc/rc.conf
# -- sysinstall generated deltas -- # Tue May 19 13:25:38 2009
# Created: Tue May 19 13:25:38 2009
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
usbd_enable="YES"
hostname="NatRouter"
sshd_enable="YES"
firewall_enable="YES"
firewall_type="OPEN"
ifconfig_rl0="inet 192.168.1.1/25"
ifconfig_rl3="inet 192.168.1.129/25"
gateway_enable="YES"
inetd_enable="YES"
pf_enable="YES"
sendmail_enable="NO"
dhcpd_enable="YES"
dhcpd_ifaces="rl0"
#ppp
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="YES"
ppp_profile="ad"

NatRouter# cat /etc/ppp/ppp.conf
#################################################################
# PPP  Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by
wself@cdrom.com
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.10 2004/11/19 17:12:56 obrien Exp $
#################################################################
default:
  set log Phase Chat LCP IPCP CCP tun command
  ident user-ppp VERSION (built COMPILATIONDATE)
  set log Phase tun command
#  set ctsrts off
#  set speed sync
#  set ifaddr 10.0.0.1/0 10.0.0.2/0
#  enable dns
#  set device PPPoE:re0
ad:
  set device PPPoE:rl3
  set authname 你的AD帐号
  set authkey  ad密码
  set dial
  set login
  add default HISADDR

3,安装pan...

4,安装dhcp-sever 放地址

cd  /usr/ports/net/isc-dhcp31-server

make install
rehash

vi /usr/local/etc/dhcpd.conf 编辑你要放的地址段

只放半个C够用
This is a very basic subnet declaration.
subnet 192.168.1.0 netmask 255.255.255.128 {
  range 192.168.1.2 192.168.1.125;
  option routers 192.168.1.126;
}

/usr/local/etc/rc.d/isc-dhcpd  start

5,查看进程情况

ps ax |grep dhcp
ps ax |grep pan

6,查看拨号情况

/etc/rc.d/ppp restart
tail  -f /var/log/ppp.log

ifconfig
pfsync0: flags=0 mtu 2020
        syncpeer: 224.0.0.240 maxupd: 128
tun0: flags=8051 mtu 1492
        inet 221.221.163.125 --> 221.221.160.1 netmask 0xffffffff
        Opened by PID 2138


http://blog.chinaunix.net/u2/89213/showart_2080340.html


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/63141/showart_2145977.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP