Openwrt路由器上常用的操作

换了好些固件,大体上都差不多。

只能用opkg下载安装,不能用apt-get安装。

1.tcpdump和nano是我必备的,个人觉得nano比vi好用

opkg install tcpdump
opkg install nano

2.利用samba共享文件,所有固件都预装了这个

/etc/config/samba

config sambashare
optionname 'root' #网络显示的共享目录名字
optionpath '/' #共享目录
optionusers 'root'
optionread_only 'no'
optionguest_ok 'no'
optioncreate_mask '0700'
optiondir_mask '0700'

使用samba来共享,需要把用户密码加入smbpasswd
smbpasswd root
 
修改好后启动

/etc/init.d/samba start

3.修改root密码
passwd
Changing password for root
New password:
Retype password:
4.查看空间
df

5.ip地址
ifconfig
 
查询到wan口的名字使用tcpdump
tcpdump -i wlan1 -w /mnt/sda1/test.cap

6.查看CPU

cat /proc/cpuinfo

system type : MediaTek MT7620
machine : Xiaomi mini Board
processor : 0
cpu model : MIPS 24KEc V5.0
BogoMIPS : 385.84
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r2
ASEs implemented : mips16 dsp
shadow register sets : 1
kscratch registers : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

7. 查看内存

free -m

cat /proc/meminfo

8.软链接
在安装mysql的时候,因为都装U盘上,经常找不到文件,又不想占用路由器宝贵的空间,我就用软链接,好歹错误能miss掉,然而到后来也还是运行不了。。。

ln –s 源文件 目标文件


9.查看卸载opkg

opkg list_installed

opkg remove

10.查看网络配置

cat /etc/config/network
 
重启后生效
/etc/init.d/networking restart 

11.启动脚本

快速查询所有服务的自启动状态, 可以使用以下命令
root@OpenWrt:~# for F in /etc/init.d/* ; do $F enabled && echo $F on || echo $F **disabled**; done

12.搜索文件

find / -name libpthread*

13.删除拷贝文件夹

rm -rf  fileName

cp -r foldera folderc  
 
14.动态域名设置
cat /etc/config/ddns

原文地址:https://www.cnblogs.com/sui84/p/7795197.html