TP-LINK WR 703 NブラシOpenWrtとpppoeネットワークの設定、LUCIのインストール、新しいユーザーの追加、USBデバイスのマウント、ftpサービスの構成、transmissionによるオフラインダウンロードの実現(続き)


説明


このブログは前のブログの続きで、完成した後のUSBデバイスのマウント、ftpサービスの構成、オフラインダウンロードのサポートです.

USBデバイスのマウント


くだらないことは言わないで、直接手順を話します.
まずwr 703 nのusbポートにUディスクを挿入し、puttyを使用してルータにログインし、コマンドを入力します.
ls/dev
sda、sda 1という名前のファイルを検索します.ここでsdaはUディスク全体を指し、sda 1は最初のパーティションを指す.検索後、Uディスクがシステムに認識されていることを示します.次に、Uディスクをフォーマットしてパーティション化し、私たちのニーズを満たす必要があります.
まずツールソフトウェアをインストールします.コマンドは次のとおりです.
opkg update
opkg install fdisk swap-utils
fdiskはUディスクのフォーマットおよびパーティション化に使用され、swap-utilsはswap(メモリ交換空間)の作成に使用されます.
次のコマンドを入力します.
fdisk/dev/sda//sda、すなわち我々のUディスクに対して、関連パーティション、フォーマット操作を行う
p//USBパーティションの表示
d//パーティションを削除し、削除したパーティション番号を入力する必要があります.このコマンドを使用してすべてのパーティションを削除し、再パーティション化することをお勧めします.
n//パーティションの追加
最後に+4 Gを入力し、4 Gのパーティションsda 1をシステムマウントポイントとして作成する
nを入力し、最後に+256 Mを入力して256 Mのswapを作成します.
tを入力し、sda 2のパーティションフォーマットの変更を選択し、ID、82を入力し、swapフォーマットに変更します.
その後、wを入力してパーティションテーブルを更新します.
freeを入力してメモリの使用状況を確認します.swapが表示されません.
入力:mkswap/dev/sda 2//swapフォーマットの構築
swapon/dev/sda 2//swapを起動
次にfreeを使用してメモリの使用状況を確認すると、swapが有効になっていることがわかります.
次に興味深いのは、OpenWrtをUディスクにコピーし、Uディスクからシステムを起動するように設定することです.
まず、次のソフトウェアをインストールします.
opkg update
opkg install block-mount kmod-usb-storage kmod-fs-ext4 e2fsprogs
Uディスクを一度にext 4形式にフォーマットするには、mkfsを用いることができる.ext 4/dev/sda 1、もちろんこれは前述の相補的です.
その後、OpenWrtシステム全体を私たちのUディスクにコピーし、いくつかの設定を行います.コマンドは次のとおりです.
mount/dev/sda 1/mnt//Uディスクの最初のパーティションを/mnt mkdir/tmp/root///////tmpディレクトリの下にrootというディレクトリmount-o bind///tmp/root//////////////////////////////////////////////root cp/tmp/root/*mnt-a////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////nt
以上のコマンドにより、OpenWrtシステムを起動できるUディスクを作成し、/etc/config/fstabファイルを以下のように変更します.
config mount          option target   /mnt          option device   /dev/sda1          option fstype   ext4          option options  rw,sync          option enabled  1          option enabled_fsck 1          option is_rootfs 1
rebootを入力し、再起動が完了したらdfを入力し、マウントポイントを表示します.OK
ヒント:/etc/bannerを変更することで、USBから起動したことをヒントにすることもできます.たとえば、最後にヒントを追加します.
Boot From USB!
同様にファイル/etc/config/fstabを変更し、自動ロードswapを設定し、
config swap
device/dev/sda2
enabled 1
その後、fstabサービスを再起動し、自己起動を設定します.
/etc/init.d/fstab restart
/etc/init.d/fstab enable
swapファイルを作成することでメモリ交換スペースを確立することもできます.まず、コマンドを使用します.
dd if=/dev/zero of=/tmp/swap bs=1M count=128
tmpの下に128 Mのファイルを追加します.
そして、このファイルをswapファイルフォーマットにフォーマットし、
mkswap/tmp/swap
最後にswapを起動し、
swapon/tmp/swap
では、UディスクからOpenWrtを起動し、メモリ交換領域を確立する方法です.このステップを経て、OpenWrtアプリケーションの範囲が大幅に向上し、より多くのことをすることができます.

ftpサービスの構成


vsftpdを使用してftpサポートを実現します.
1,vsftpdのインストール
opkg update
opkg install vsftpd
2、プロファイル/etc/vsftpdを変更する.conf
background=YES listen=YES#匿名ユーザーのanonymousへのログインは許可されていません.enable=NO#ローカルユーザーがlocalにログインできるようにするenable=YES#write_のアップロードを許可enable=YES local_umask=022 check_shell=NO#ローカルユーザーホームlocal_root=/ftp/test#ユーザーがホームディレクトリchrootにしかアクセスできないことを制限local_user=YES accept_timeout=60 idle_session_timeout=300 max_clients=600 max_per_ip=5 #dirmessage_enable=YES#レスポンス文ftpd_を設定banner=Welcome to blah FTP service.qp session_support=NO #syslog_enable=YES #userlist_enable=YES #userlist_deny=NO #userlist_file=/etc/vsftpd.users #xferlog_enable=YES #xferlog_file=/var/log/vsftpd.log #xferlog_std_format=YES
3、ftpサービスを再起動し、自己起動を設定する
/etc/init.d/vsftpd restart
/etc/init.d/vsftpd enable
これでftpサーバにアクセスできます.ftp://192.168.1.1を選択します.
rootアカウントを使用してchroot機能を起動できないftpサーバにログインするには、ルートディレクトリの書き込み権限を削除してもだめです.ペンを残してsolve.

Transmissionによるオフラインダウンロード


1,transmissionとtransmission-daemonのインストール
opkg update
opkg install transmission transmission-daemon
2,プロファイル/etc/config/transmissionと/root/.config/transmission-daemon/settings.json
例は次のとおりです.
/etc/config/transmission
config transmission
	option enabled 1
	option config_dir '/mnt/sda3/transmission'
	#option user 'nobody'
	#    
	#         ,            
	#       web         
	option alt_speed_down 250
	option alt_speed_enabled true
	option alt_speed_time_begin  930
	option alt_speed_time_day 127
	option alt_speed_time_enabled true
	option alt_speed_time_end 1410
	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 '/mnt/sda3/transmission/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 '/mnt/sda3/transmission/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 80
	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 true
	option rpc_bind_address '0.0.0.0'
	option rpc_enabled true
	option rpc_password 'qinpeng'
	option rpc_port 9091
	option rpc_url '/transmission/'
	option rpc_username 'qp'
	#----------------
	option rpc_whitelist '127.0.0.1,192.168.1.*'
	option rpc_whitelist_enabled false
	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 260
	option speed_limit_down_enabled true #          
	option speed_limit_up 30 #  TCP  ,  40   
	option speed_limit_up_enabled true
	#----------------
	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 ''

/root/.config/transmission-daemon/settings.json
{
    "alt-speed-down": 50, 
    "alt-speed-enabled": false, 
    "alt-speed-time-begin": 540, 
    "alt-speed-time-day": 127, 
    "alt-speed-time-enabled": false, 
    "alt-speed-time-end": 1020, 
    "alt-speed-up": 50, 
    "bind-address-ipv4": "0.0.0.0", 
    "bind-address-ipv6": "::", 
    "blocklist-enabled": false, 
    "blocklist-url": "http://www.example.com/blocklist", 
    "cache-size-mb": 2, 
    "dht-enabled": true, 
    "download-dir": "/root/Downloads", 
    "download-queue-enabled": true, 
    "download-queue-size": 5, 
    "encryption": 0, 
    "idle-seeding-limit": 30, 
    "idle-seeding-limit-enabled": false, 
    "incomplete-dir": "/root/Downloads", 
    "incomplete-dir-enabled": false, 
    "lpd-enabled": false, 
    "message-level": 2, 
    "peer-congestion-algorithm": "", 
    "peer-limit-global": 240, 
    "peer-limit-per-torrent": 60, 
    "peer-port": 51413, 
    "peer-port-random-high": 65535, 
    "peer-port-random-low": 49152, 
    "peer-port-random-on-start": false, 
    "peer-socket-tos": "default", 
    "pex-enabled": true, 
    "port-forwarding-enabled": true, 
    "preallocation": 1, 
    "prefetch-enabled": 0, 
    "queue-stalled-enabled": true, 
    "queue-stalled-minutes": 30, 
    "ratio-limit": 2, 
    "ratio-limit-enabled": false, 
    "rename-partial-files": true, 
    "rpc-authentication-required": false, 
    "rpc-bind-address": "0.0.0.0", 
    "rpc-enabled": true, 
    "rpc-password": "{273bb11b4ab7f9e9180fa9d3d2fca9ad41f18c2ed1zmxIkB", 
    "rpc-port": 9091, 
    "rpc-url": "/transmission/", 
    "rpc-username": "", 
    "rpc-whitelist": "0.0.0.0", 
    "rpc-whitelist-enabled": true, 
    "scrape-paused-torrents-enabled": true, 
    "script-torrent-done-enabled": false, 
    "script-torrent-done-filename": "", 
    "seed-queue-enabled": false, 
    "seed-queue-size": 10, 
    "speed-limit-down": 100, 
    "speed-limit-down-enabled": false, 
    "speed-limit-up": 100, 
    "speed-limit-up-enabled": false, 
    "start-added-torrents": true, 
    "trash-original-torrent-files": false, 
    "umask": 18, 
    "upload-slots-per-torrent": 14, 
    "utp-enabled": true
}

補足説明:上記のパスのsda 3は、ダウンロード専用のUディスクの3番目のパーティションです.3、完了後、次のコマンドを入力します.
/etc/init.d/transmission start
/etc/init.d/transmission enable#電源投入自起動の設定
transmission-daemon
4、ダウンロード速度を上げる方法:
①最初は少し遅かったので、辛抱強く待つ必要があります.
②ファイアウォール(アップロード速度のみ)を閉じ、51413ポートを開きます.
③アップロード速度を適切に向上させ、ダウンロード速度の向上に寄与する.
④スタートホワイトデッドをキャンセルすることで、途中でダウンロードを停止してから再ダウンロードする際の検証時間を節約できるという.
5.192.168.1.1:9091ポートにアクセスしてTransmissionのWebページを開くことができます.
以上は前学期OpenWrtに作ったもので、あとはまとめ続けます.