Chinaunix首页 | 论坛 | 博客
  • 博客访问: 959677
  • 博文数量: 99
  • 博客积分: 3306
  • 博客等级: 中校
  • 技术积分: 1238
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-21 10:14
文章分类

全部博文(99)

文章存档

2012年(37)

2011年(56)

2010年(6)

分类: LINUX

2012-01-07 17:27:51

之前用过一段时间openwrt,不过后来工作忙了有时觉得麻烦就没有去搞了。
想想Qos还是有必要上的,所有就把路由器拿出来刷了一下。

安装usb驱动
  1. opks install kmod-usb-ohci kmod-usb2 kmod-usb-storage-extras
安装磁盘管理工
  1. opkg install fdisk e2fsprogs tune2fs
安装block-mount,方便自动挂u盘,配置/etc/config/fstab
  1. config global automount
  2.     option from_fstab 1
  3.     option anon_mount 1
  4.     
  5. config global autoswap
  6.     option from_fstab 1
  7.     option anon_swap 0
  8.     
  9. config mount
  10.     option target    /mnt/usb
  11.     option device    /dev/sda1
  12.     option fstype    ext4
  13.     option options    rw
  14.     option enabled    1
  15.     option enabled_fsck 0


  1. /etc/init.d/fstab enable
  2. /etc/init.d/fstab restart

安装 qos-scripts 就用默认配置,把里面的option download改成自己的带宽(单位是Mbps)把里面option enable改为1

动态域名解析
  1. root@OpenWrt:/mnt/usb/svn/conf# cat /usr/sbin/ipup
  2. #!/bin/ash
  3. wget -q -O- ''
  4. root@OpenWrt:/mnt/usb/svn/conf# crontab -l
  5. */5 * * * * /bin/a
配置SVN

  1. auth :

  2. [groups]
  3. admin=pm
  4. co=read

  5. pass:

  6. [users]
  7. pm=xxxx
  8. read=xxxx

  9. root@OpenWrt:/mnt/usb/svn/conf# grep -v "#" svnserve.conf


  10. [general]
  11. anon-access = none
  12. auth-access = write
  13. password-db = passwd
  14. authz-db = authz
  15. realm  = welcome to pm's repository
为svn开启端口转发
  1. 为svn开启端口转发和访问规则

  2. config rule
  3.         option src wan
  4.         option dest lan
  5.         option dest_ip 192.168.1.1
  6.         option dest_port 3690
  7.         option proto tcp
  8.         option target ACCEPT
  9.         option '_name' 'svn'
  10.                                                        
  11. config redirect
  12.         option src wan
  13.         option src_dport 3690
  14.         option dest lan
  15.         option dest_ip 192.168.1.1
  16.         option dest_port 3690
  17.         option proto tcp
  18.         option '_name' 'svn'
安装usbip-server,共享USB设备
  1. Usage: bind-driver [OPTION]
  2. Change driver binding for USB/IP.
  3.   --usbip busid make a device exportable
  4.   --other busid use a device by a local driver
  5.   --list print usb devices and their drivers
  6.   --allusbip make all devices exportable
  7. root@OpenWrt:~# usbip_bind_driver --list
安装一下ttransmission-web
  1. config transmission
  2.     option enabled 1
  3.     option config_dir '/mnt/usb/btdown'
  4.     option run_daemon_as_user root
  5.     option alt_speed_down 50
  6.     option alt_speed_enabled false
  7.     option alt_speed_time_begin 540
  8.     option alt_speed_time_day 127
  9.     option alt_speed_time_enabled false
  10.     option alt_speed_time_end 1020
  11.     option alt_speed_up 50
  12.     option bind_address_ipv4 '0.0.0.0'
  13.     option bind_address_ipv6 '::'
  14.     option blocklist_enabled false
  15.     option blocklist_url ''
  16.     option cache_size_mb 2
  17.     option dht_enabled true
  18.     option download_dir '/mnt/usb/btdown/done'
  19.     option encryption 1
  20.     option idle_seeding_limit 30
  21.     option idle_seeding_limit_enabled false
  22.     option incomplete_dir '/mnt/usb/btdown/incomplete'
  23.     option incomplete_dir_enabled false
  24.     option lazy_bitfield_enabled true
  25.     option lpd_enabled false
  26.     option message_level 1
  27.     option open_file_limit 32
  28.     option peer_congestion_algorithm ''
  29.     option peer_limit_global 240
  30.     option peer_limit_per_torrent 60
  31.     option peer_port 51413
  32.     option peer_port_random_high 65535
  33.     option peer_port_random_low 49152
  34.     option peer_port_random_on_start false
  35.     option peer_socket_tos 0
  36.     option pex_enabled true
  37.     option port_forwarding_enabled true
  38.     option preallocation 1
  39.     option prefetch_enabled 1
  40.     option ratio_limit 2.0000
  41.     option ratio_limit_enabled false
  42.     option rename_partial_files true
  43.     option rpc_authentication_required true
  44.     option rpc_bind_address '0.0.0.0'
  45.     option rpc_enabled true
  46.     option rpc_password 'password'
  47.     option rpc_port 9091
  48.     option rpc_url '/transmission/'
  49.     option rpc_username 'username'
  50.     option rpc_whitelist '127.0.0.1,192.168.1.*'
  51.     option rpc_whitelist_enabled false
  52.     option script_torrent_done_enabled false
  53.     option script_torrent_done_filename ''
  54.     option speed_limit_down 100
  55.     option speed_limit_down_enabled false
  56.     option speed_limit_up 20
  57.     option speed_limit_up_enabled false
  58.     option start_added_torrents true
  59.     option trash_original_torrent_files false
  60.     option umask 18
  61.     option upload_slots_per_torrent 14
  62.     option utp_enabled true
  63.     option scrape_paused_torrents true
  64.     option watch_dir_enabled false
  65.     option watch_dir ''
然后防火墙上也做好端口映射方便在公司的时候远程控制。






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