和朋友交换了台路由,将自己的LINKSYS大胖子换成了贝尔金7231-4P
机器配置:BCM4712 200MHZ ROM:4M RAM:64M
刷的DD-WRT固件: ›
下载地址:
RESET路由后,一切设置还原成默认.内存自动识别16M,要将其手动修改成64M,并超频到300MHZ(在路由WEB里设置)
设置内存为64M
nvram set sdram_init=0x0008
nvram set sdram_config=0x0033
nvram set sdram_ncdl=0x0000
nvram commit
将CPU频率超频至300HMZ,将120设置为150
nvram get clkfreq
nvram set clkfreq=300,150
nvram commit
reboot
因为是MINI版的,所以要在路由中开启JFFS和SSH.并上传一系列驱动文件
启动:
insmod /jffs/usb/usbcore.o
insmod /jffs/usb/usb-ohci.o
insmod /jffs/usb/scsi_mod.o
insmod /jffs/usb/sd_mod.o
insmod /jffs/usb/usb-storage.o
insmod /jffs/usb/jbd.o
insmod /jffs/usb/ext3.o
insmod /jffs/usb/videodev.o
insmod /jffs/usb/pwc.o
insmod /jffs/usb/pwcx.o
insmod /jffs/usb/usbserial.o
insmod /jffs/usb/ftdi.o
#insmod /jffs/usb/spca5xx.o
sleep 3
mount /dev/scsi/host0/bus0/target0/lun0/part1 /jffs -t ext3
mount /dev/mtdblock/4 /mnt
mount -o bind /jffs/opt /opt
sleep 3
/opt/sbin/openvpn --config /opt/etc/openvpn/openvpn.conf --cd /opt/etc/openvpn&
sleep 3
/opt/etc/init.d/S80lighttpd start
sleep 10
/opt/etc/init.d/S08samba
sleep 15
/opt/bin/screen -d -m /opt/bin/rtorrent -n -o import=/opt/etc/rtorrent.conf
cp -a /dev/v4l/* /dev
#/opt/spcaview/servfox -d /dev/video0 -s 320x240 -f jpg -g -w 192.168.1.1:7070&
/opt/bin/palantir -s 640x480 -T 18000
防火墙:
iptables -I INPUT -p udp --dport 3000 -j ACCEPT
iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
iptables -I INPUT -p udp --dport 6881 -j ACCEPT
iptables -I INPUT -p tcp --dport 6881 -j ACCEPT
iptables -I INPUT -p udp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p udp --dport 51777 -j ACCEPT
iptables -I INPUT -p tcp --dport 51777 -j ACCEPT
iptables -I INPUT -p udp --dport 1194 -j ACCEPT
iptables -I INPUT -p tcp --dport 1194 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o br0 -j SNAT --to-source 192.168.1.1
iptables
iptables -F
安装ipkg-opt和optware运行库
wget -O - | tr -d '\r' > /tmp/optware-install.sh
sh /tmp/optware-install.sh
(参考:)
更新ipkg软件列表
/opt/bin/ipkg update
安装SAMBA3
/opt/bin/ipkg install samba
/opt/etc/samba/smb.conf:
[global]
bind interfaces only = yes
interfaces = 192.168.1.1/24
workgroup = WORKGROUP
server string = Linyin's Route
guest account = root
only guest = yes
security = share
load printers = no
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE
browseable = yes
dns proxy = no
log level = 1
max log size = 20
encrypt passwords = yes
preserve case = yes
short preserve case = yes
dos charset = UTF-8
unix charset = UTF-8
display charset = UTF-8
wins support = yes
time server = yes
os level = 255
local master = yes
domain master = yes
preferred master = yes
smb passwd file = /opt/etc/samba/smbpasswd
[linyin's home]
comment = Linyin's Home Directories
path=/opt/share/data
browseable = yes
writable = yes
修改/opt/etc/init.d/S08samba,将samba_active=0修改成1
# set samba_active=1 to activate samba
samba_active=1
为samba访问添加密码:
smbpasswd -a root
安装lighttpd和php支持:
/opt/bin/ipkg install lighttpd php php-fcgi xmlrpc-c
配置lighttpd:
修改/opt/etc/lighttpd/lighttpd.conf文件
server.document-root = "/opt/share/data/www"
server.port = 8080
将下列配置从FreeBSD修改为poll,不然lighttpd无法正常启动
server.event-handler = "poll" # needed on OS X
下载rtwi安装至lighttpd的web目录下.
设置rtwi目录下includes/rtwi.conf,
base = (172.16.0.1是路由IP,8008是访问端口)
user_conf = /opt/etc/users.conf (user.conf是rtwi目录下的users.conf.sample的文件)
安装screen和rtorrent
/opt/bin/ipkg install screen rtorrent
修改user.conf文件:
在rtorrent.conf里添加:
scgi_port = :5000
umask = 0000
encoding_list = UTF-8
user.conf中
[linyin]
address = :5000
pass = 19245a7ea3175527553b79ace1b19fbe22232125
密码是sha1加密,网页生成可以在:
rtorrent配置 (/opt/etc/rtorrent.conf)
min_peers = 100
max_peers = 500
max_uploads = 15
download_rate = 0
upload_rate = 3
directory = /opt/share/data/Downloads
session = /opt/share/BT/.session
schedule = watch_directory,5,5,load_start=/opt/share/BT/torrent/*.torrent
use_udp_trackers = yes
encryption = allow_incoming,enable_retry,prefer_plaintext
encoding_list = UTF-8
umask = 0000
dht = on
dht_port = 6881
check_hash = no
port_range = 51777-51777
peer_exchange = yes
scgi_port = :5000
on_start = link1,"create_link=tied,,.started"
#on_stop = link1,"delete_link=tied,,.started"
on_finished = link1,"create_link=tied,,.finished"
#on_erase = link1,"delete_link=tied,,.finished"
解释最后这四句话的含义:
当开始下载的时候,在监视目录下建立一个指向下载目录的链接,此链接以torrent文件名命名,并添加.started后缀;
当停止下载时,删除以上链接;
当完成下载时,在监视目录下建立一个指向下载目录的链接,此链接以torrent文件名命名,并添加.finished后缀;
当删除任务时,删除以上链接.
建立/opt/etc/init.d/mvtorrent,fs为同时下载的任务数:
#!/bin/sh
fs=3
source="/opt/share/data/Downloads"
target="/opt/share/BT/torrent"
session="/opt/share/BT/.session"
del="auto"
num=`ls ${target} | grep -c started`
if [ $num -lt $fs ] ; then
cd ${source}
#ls | sed 's/^.*/mv "&" \`echo & \| sed "s\/ \/\/g"\`/g' | sh >/dev/null 2>&1
find . -name "*.?orrent" | sed 's/^.*/mv "&" \`echo & \| sed "s\/ \/\/g"\`/g' | sh >/dev/null 2>&1
for file in ${source}/*.?orrent
do
if [ $file = "${source}/*.torrent" ] ; then
break
fi
mv "$file" ${target}
num=$(($num+1))
if [ $num -eq $fs ] ; then
break
fi
done
fi
if [ $del = "auto" ] ; then
for file in ${target}/*.finished
do
if [ $file = "${target}/*.finished" ] ; then
break
fi
fname=`basename $file .finished`
rm ${target}/${fname}*
done
num=`ls ${target} | grep -c torrent`
if [ $num -eq 0 ] ; then
num=`ls ${session} | grep -c torrent`
if [ $num -gt 2 ] ; then
rm ${session}/*.torrent
fi
fi
fi
防止RTORRENT运行段时间出错,建立个/opt/etc/init.d/rmlock,内容为:
#/bin/sh
rm -rf /opt/share/BT/.session/rtorrent.lock
DD-WRT网页的管理界面里有一栏cron,在这一栏里添加以下内容:
*/5 * * * * root /opt/etc/init.d/mvtorrent
*/5 * * * * root /opt/etc/init.d/rmlock
OpenVPN:
手动安装
/opt/bin/ipkg install openvpn
OpenVPN服务器的配置文件
:~# more /opt/etc/openvpn/openvpn.conf
port 1194
proto tcp
dev tun0
ca /opt/etc/openvpn/keys/ca.crt
cert /opt/etc/openvpn/keys/server.crt
key /opt/etc/openvpn/keys/server.key
dh /opt/etc/openvpn/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
push "dhcp-option DNS 61.177.7.1"
push "dhcp-option DNS 211.103.55.51"
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
client-to-client
keepalive 10 120
tls-auth /opt/etc/openvpn/keys/ta.key 0
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
注意,路由名字一定要设置为DD-WRT;如果SCREEN下rtorrent启动失败,可以尝试使用/opt/etc/init.d/S99rtorrent启动,其中将user="p2p"修改为user="root"
|
文件: |
DDUSB驱动.rar |
大小: |
339KB |
下载: |
下载 | |