首页 技术 正文
技术 2022年11月15日
0 收藏 356 点赞 2,726 浏览 4387 个字

参考文章
https://wiki.openwrt.org/doc/uci/transmission

1. 安装包

必装的 transmission-daemon-openssl (后台服务)
选装的 transmission-cli-openssl (命令行管理) transmission-remote-openssl (远程UI管理) transmission-web-openssl (web管理)
我选择的是 daemon 和 remote, 在编译OpenWrt的时候已经加入
另外需要安装一个客户端, 我在windows下使用的是 Transmission Remote GUI https://sourceforge.net/projects/transgui/

2. 挂载外置U盘
fdisk /dev/sda, 如果内存小于128M, 需要分一个64M~128M大小的primary区做swap, 剩下的格式化为ext4, 并挂载到/mnt/sda2 下
需要创建两个目录done, incomplete, 分别用于存放 完成/未完成的下载文件

3. 配置这是我的配置文件

config transmission
option enabled
option config_dir '/tmp/transmission'
#option user 'nobody'
option mem_percentage
option nice
option ionice_flags '-c 3'
option alt_speed_down
option alt_speed_enabled false
option alt_speed_time_begin
option alt_speed_time_day
option alt_speed_time_enabled false
option alt_speed_time_end
option alt_speed_up
option bind_address_ipv4 '0.0.0.0'
option bind_address_ipv6 '::'
option blocklist_enabled false
option blocklist_url ''
option cache_size_mb
option dht_enabled true
option download_dir '/mnt/sda2/done'
option download_queue_enabled true
option download_queue_size
option encryption
option idle_seeding_limit
option idle_seeding_limit_enabled false
option incomplete_dir '/mnt/sda2/incomplete'
option incomplete_dir_enabled true
option lazy_bitfield_enabled true
option lpd_enabled false
option message_level
option peer_congestion_algorithm ''
option peer_limit_global
option peer_limit_per_torrent
option peer_port
option peer_port_random_high
option peer_port_random_low
option peer_port_random_on_start false
option peer_socket_tos 'default'
option pex_enabled true
option port_forwarding_enabled true
option preallocation
option prefetch_enabled true
option queue_stalled_enabled true
option queue_stalled_minutes
option ratio_limit 2.0000
option ratio_limit_enabled false
option rename_partial_files true
option rpc_authentication_required false
option rpc_bind_address '0.0.0.0'
option rpc_enabled true
option rpc_password ''
option rpc_port
option rpc_url '/transmission/'
option rpc_username ''
option rpc_whitelist '192.168.1.*'
option rpc_whitelist_enabled true
option scrape_paused_torrents_enabled true
option script_torrent_done_enabled false
option script_torrent_done_filename ''
option seed_queue_enabled false
option seed_queue_size
option speed_limit_down
option speed_limit_down_enabled false
option speed_limit_up
option speed_limit_up_enabled false
option start_added_torrents true
option trash_original_torrent_files false
option umask
option upload_slots_per_torrent
option utp_enabled true
option scrape_paused_torrents true
option watch_dir_enabled false
option watch_dir ''

对各项参数的说明, 可以查看上面的参考页, 也可以查看Transmission项目的文档
https://github.com/transmission/transmission/wiki/Editing-Configuration-Files

对于设置的三个路径: config, incomplete, done, 要检查目录的owner是否与transmission daemon的用户一致. 程序运行用户默认是 transmission:transmission

OpenWrt重启后丢失下载列表

这是因为配置文件设置在了临时文件上, 重启后这个文件就被重置了. 请设置这个参数到实际的存储上

option config_dir '/mnt/sda1/transmission/.config'   #HDD is mounted on /mnt/sda1

Port Forward

如果transmission-daemon的端口不能被局域网外的设备连接, 下载性能就会打很大的折扣, 需要检查port forward是否已经打开.

设置port_forwarding_enabled为true, 开启port forwarding, 然后设置peer_port为一个非51413的端口(在4xxxx~6xxxx间随机),

1) 如果当前transmission运行在网关路由下级设备, 而此设备是直接连到此网关路由的lan里的, 需要在网关路由上打开此IP的port forward. 一个设置的例子:

Name: forward-for-bt1,
Match: IPv4-TCP, UDP, From any host in wan Via any router IP at port
Forward to: IP 192.168.10.100, port in lan

在/etc/config/firewall中是

config redirect
option target 'DNAT'
option src 'wan'
option dest 'lan'
option proto 'tcp udp'
option src_dport ''
option dest_ip '192.168.10.100'
option dest_port ''
option name 'forward-for-bt1'

测试: 通过外网口, telnet a.a.a.a 59456 能出现已连接提示即成功

2) 如果当前transmission运行在一个路由的lan里, 而这个路由的wan又连接到网关路由的lan, 则除了上面的设置外, 还需要在当前路由上打开端口, 允许外界通过wan访问此设备的端口

Name: Allow-for-bt, Any tcp, udp From any host in wan To any router IP at port  on this device

在/etc/config/firewall中是

config rule
option target 'ACCEPT'
option src 'wan'
option proto 'tcp udp'
option dest_port ''
option name 'Allow-for-bt'

测试同上

4. 启动
注意: 上面配置中的option enabled 必须为1, 否则不会启动

# 随路由器启动
/etc/init.d/transmission enable
# 启动服务
/etc/init.d/transmission start# 对应的停止和不随服务器启动
/etc/init.d/transmission stop
/etc/init.d/transmission disable

5. 查看日志
日志信息在 system log. 如果需要更多信息, 修改配置中的 message-level — (0 = None, 1 = Error, 2 = Info, 3 = Debug, default = 2)

6. 使用Transmission Remote GUI连接添加新服务地址192.168.1.1 9091后, 就可以连接, 并往上面添加bt任务了

Update 2017-02-07: 使用U盘和移动硬盘的下载性能差别

之前图方便, 一直是使用U盘作为Transmission的存储, 但是在下载过程中, 经常会发生Overheated(过热)现象, 不是说发热, 而是说当下载速度开始突然增大时, 路由器的负载会突然加大, 然后失去响应, 速度陡降到零, 然后过一段时间恢复后, 又来一次. 在种子数量较多时, 通过 top -d1可以观察到, 整个系统负载一直是在2.x~4.x之间, 非常高. 但是transmission-daemon本身所占的cpu并不高, 只有10%~20%, 这些额外的负载, 很大可能是在IO上.

这些问题在换成移动硬盘作为存储后就消失了. 此时系统负载最高不超过0.8, transmission-daemon占的cpu在5%~10%之间. 从上级路由中看到流量一直保持在一个比较平稳的曲线上, 而不像U盘做存储时那种尖锐的毛刺.

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,497
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,910
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,744
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,497
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,135
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,298