9-07 2,608
目录
一、刷机
二、设置SSH登录
三、WAN/LAN网络设置
四、Wifi设置
五、支持USB
六、支持extroot
七、安装luci
八、安装samba
九、安装Transmission
十、DLNA
一、刷机
Openwrt针对每种路由器提供两个固件文件,factory.bin用于路由器原厂固件初次改刷为Openwrt使用,sysupgrade.bin用于从旧版本Openwrt升级到新版使用。
Openwrt基于WR720N的固件位于http://downloads.openwrt.org/snapshots/trunk/ar71xx/,固件文件:openw71xx-generic-tl-wr720n-v3-squashfs-factory.bin用于初次改刷,openwrt-ar71xx-generic-tl-wr720n-v3-squashfs-sysupgrade.bin在升级时使用。
TL-WR720N初次刷Openwrt方法:选择系统工具 -> 软件升级,在如下图中选择Openwrt固件文件,点击升级即可。
二、设置SSH登录
使用telent客户端登陆,初始IP地址为192.168.1.1
telnet 192.168.1.1
设置密码
[email protected]:/# passwd
以后再登录就需要用ssh客户端了,我用putty。
login as: root
[email protected]’s password:
BusyBox v1.19.4 (2013-11-23 22:58:54 UTC) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.
_______ ________ __
| |.—–.—–.—–.| | | |.—-.| |_
| – || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
—————————————————–
BARRIER BREAKER (Bleeding Edge, r38896)
—————————————————–
* 1/2 oz Galliano Pour all ingredients into
* 4 oz cold Coffee an irish coffee mug filled
* 1 1/2 oz Dark Rum with crushed ice. Stir.
* 2 tsp. Creme de Cacao
—————————————————–
三、WAN/LAN网络设置
网络配置文件为/etc/config/network,修改参考如下(红色为修改行,蓝色为添加行):
[email protected]:~# vi /etc/config/network
config interface ‘loopback’
option ifname ‘lo’
option proto ‘static’
option ipaddr ‘127.0.0.1’
option netmask ‘255.0.0.0’
config globals ‘globals’
option ula_prefix ‘fd0f:5d48:301c::/48′
### LAN口设置修改,基本不用修改 ###
config interface ‘lan’
option ifname ‘eth1′
option type ‘bridge’
option proto ‘static’
option ipaddr ‘192.169.1.1’
option netmask ‘255.255.255.0’
option ip6assign ’60’
### WAN口PPPoE ###
config interface ‘wan’
option ifname ‘eth0′
##### option proto ‘dhcp’
option proto ‘pppoe’
option ‘username’ ‘user’
option ‘password’ ‘password’
config interface ‘wan6′
option ifname ‘@wan’
option proto ‘dhcpv6′
四、Wifi设置
Wifi配置文件为/etc/config/wireless,下面是设置wifi名称为wr-ow,采用psk2认证方式、密码123456。
[email protected]:~# vi /etc/config/wireless
config wifi-device radio0
option type mac80211
option channel 11
option hwmode 11ng
option path ‘platform/ar933x_wmac’
option htmode HT20
list ht_capab SHORT-GI-20
list ht_capab SHORT-GI-40
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
# REMOVE THIS LINE TO ENABLE WIFI:
##### option disabled 1
config wifi-iface
option device radio0
option network lan
option mode ap
option ssid wr-ow
##### option encryption none
option encryption psk2
option key 123456
五、支持USB
WR720有一个USB接口,可以接入USB存储设备。USB要先格式化Openwrt可识别分区,我是在Ubuntu下面格式化为ext4分区格式的。
先查询接入系统的USB硬盘,使用dmesg显示信息
[ 242.090000] usb 1-1: new high-speed USB device number 2 using ehci-platform
说明是接口是USB2.0,需要kmod-usb2模块,固件缺省已安装
接下来只需安装kmod-usg-storage、kmod-fs-ext4内核模块,其他模块已缺省安装,执行:
[email protected]:~# opkg install kmod-usb-storage
[email protected]:~# opkg install kmod-fs-ext4
[email protected]:~#reboot
启动后,查看是否已经支持:
[email protected]:~# ls /dev/sda*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3
参考:http://wiki.openwrt.org/doc/howto/usb.storage
http://wiki.openwrt.org/doc/howto/usb.essentials
六、支持extroot
WR720N只有4MB Flash存储,根分区放到flash上很小,没有空间安装多个软件;并且大部分软件缺省安装到根分区、安装到其他分区很困难,解决办法就是把根分区加载外部(usb)存储上。处理如下。
安装block-mount
[email protected]:~# opkg update
[email protected]:~# opkg install block-mount
[email protected]:~# reboot
复制flash根分区文件到外部存储
[email protected]:~# mkdir /mnt/sda1
[email protected]:~# mount /dev/sda1 /mnt/sda1
[email protected]:~# mkdir -p /tmp/cproot
[email protected]:~# mount –bind / /tmp/cproot/
[email protected]:/# tar -C /tmp/cproot/ -cvf – . | tar -C /mnt/sda1 -xf –
[email protected]:/# umount /dev/sda1
修改fstab
[email protected]:~# vi /etc/config/fstab
config ‘global’
option anon_swap ‘0’
option anon_mount ‘0’
option auto_swap ‘1’
option auto_mount ‘1’
option delay_root ‘5’
option check_fs ‘0’
### USB硬盘的第一个分区用作根分区###
config ‘mount’
option target ‘/’
option device /dev/sda1
option fstype ext4
option options rw,sync
option enabled ‘1’
option enabled_fsck 0
### USB硬盘的第二个分区用作交换分区 ###
config ‘swap’
option device ‘/dev/sda2′
option enabled ‘1’
### USB硬盘的第三个分区用作home分区 ###
config ‘mount’
option target ‘/home’
option device /dev/sda3
option fstype ext4
option options rw,sync
option enabled ‘1’
option enabled_fsck 0
参考: http://wiki.openwrt.org/doc/howto/extroot
七、安装luci
[email protected]:/# opkg update
[email protected]:~# opkg install luci
[email protected]:~# /etc/init.d/uhttpd enable
[email protected]:~# /etc/init.d/uhttpd start
[email protected]:~#
参考: http://wiki.openwrt.org/doc/howto/luci.essentials
八、安装samba
先查询当前可用的samba版本号和包名
[email protected]:/# opkg update
[email protected]:~# opkg list | grep samba
luci-app-samba – svn-r9834-1 – Network Shares – Samba SMB/CIFS module
samba36-client – 3.6.11-2 – Samba 3.6 SMB/CIFS client
samba36-server – 3.6.11-2 – The Samba software suite is a collection of programs that implements the SMB protocol for UNIX systems, allowing you to serve files and printers to Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred to as the LanManager or Netbios protocol.
然后安装
[email protected]:~# opkg install samba36-server
[email protected]:~# opkg install luci-app-samba
[email protected]:~# /etc/init.d/samba enable
[email protected]:~# /etc/init.d/samba start
[email protected]:~# reboot
配置过程如下:
先增加samba用户root
[email protected]:~# smbpasswd -a root
可以使用luci通过Web进行配置
修改root用户可以访问samba,编辑template里面的invalid users = root为下图:
增加共享目录
参考: http://wiki.openwrt.org/doc/uci/samba
九、安装Transmission
安装Transmission支持BT下载,以后再BT下载就不用开电脑了,省电。
[email protected]:/# opkg update?
[email protected]:~# opkg install transmission-daemon
[email protected]:~# opkg install transmission-cli
[email protected]:~# opkg install transmission-web
[email protected]:~# opkg install transmission-remote
[email protected]:~# /etc/init.d/transmission enable
[email protected]:~# /etc/init.d/transmission start
配置如下:
[email protected]: /# vi /etc/config/transmission
config transmission
option enabled 1
option config_dir ‘/home/trans’
#option user ‘nobody’
option alt_speed_down 50
option alt_speed_enabled false
option alt_speed_time_begin 540
option alt_speed_time_day 127
option alt_speed_time_enabled false
option alt_speed_time_end 1020
option alt_speed_up 50
option bind_address_ipv4 ‘0.0.0.0’
option bind_address_ipv6 ‘::’
option blocklist_enabled false
option blocklist_url ”
option cache_size_mb 2
option dht_enabled true
option download_dir ‘/home/trans/done’
option download_queue_enabled true
option download_queue_size 4
option encryption 1
option idle_seeding_limit 30
option idle_seeding_limit_enabled false
option incomplete_dir ‘/home/trans/incomplete’
option incomplete_dir_enabled false
option lazy_bitfield_enabled true
option lpd_enabled false
option message_level 1
option peer_congestion_algorithm ”
option peer_limit_global 240
option peer_limit_per_torrent 60
option peer_port 51413
option peer_port_random_high 65535
option peer_port_random_low 49152
option peer_port_random_on_start false
option peer_socket_tos ‘default’
option pex_enabled true
option port_forwarding_enabled true
option preallocation 1
option prefetch_enabled true
option queue_stalled_enabled true
option queue_stalled_minutes 30
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 ‘12345678’
option rpc_port 9091
option rpc_url ‘/transmission/’
option rpc_username ‘zp’
option rpc_whitelist ‘127.0.0.1,192.169.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 10
option speed_limit_down 100
option speed_limit_down_enabled false
option speed_limit_up 20
option speed_limit_up_enabled false
option start_added_torrents true
option trash_original_torrent_files false
option umask 18
option upload_slots_per_torrent 14
option utp_enabled true
option scrape_paused_torrents true
option watch_dir_enabled false
option watch_dir ”
参考: http://wiki.openwrt.org/doc/uci/transmission
十、DLNA
支持DLNA后,内容在网络上,就相当于云路由器了。
[email protected]:/# opkg update
[email protected]:/# opkg install minidlna
[email protected]:/# /etc/init.d/minidlna enable
[email protected]:/# /etc/init.d/minidlna start
配置如下:
[email protected]:~# cat /etc/config/minidlna
config minidlna config
option ‘enabled’ ‘1’
option port ‘8200’
option interface ‘br-lan’
option friendly_name ‘OpenWrt DLNA Server’
option db_dir ‘/home/dlna/run/minidlna’
option log_dir ‘/var/log’
option inotify ‘1’
option enable_tivo ‘0’
option strict_dlna ‘0’
option presentation_url ”
#option notify_interval ‘900’
option notify_interval ’60’
option serial ‘12345678’
option model_number ‘1’
option root_container ‘.’
list media_dir ‘/home/dlna’
option album_art_names ‘Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg’
当前Openwrt固件版本有个Bug,就是往DLNA目录下添加文件,不能自动更新。经验证可以用下面方法解决:
修改/etc/init.d/minidlna在minidlna启动时添加-R参数
start() {
……
service_start /usr/bin/minidlna -R -f “$MINIDLNA_CONFIG_FILE”
}
参考:http://wiki.openwrt.org/doc/uci/minidlna
<完>
Pingback: payday loan canada
Pingback: direct payday loans for bad credit instant cash lender
Pingback: drugrehabcentershotline.com drug rehabilitation
Pingback: Blue Coaster33