OpenWRT on Asus WL-500gP: Command and Path Reference

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 10:48, 29 July 2007 by Admin (Talk | contribs)

Jump to: navigation, search

console commands

COMMAND                                     DESCRIPTION
ipkg package manager (update list status install)
logread display entries from log files
nvram show display nvram values
nvram set wl0_radio=0; wifi turn radio off
nvram set wl0_radio=1; wifi turn radio on
logread view system log, all logs

perform basic tasks by command path reference

restart network

/etc/init.d/S40network restart

search for files or folders

find / -name $1 -print

view dhcp leases

cat /tmp/dhcp.leases

system logs

syslogd is started on startup. You can read it with 'logread'.

logread
logread -f

There are two options for where to send the logging output: (1) to a local file stored in RAM, (2) to a remote system. The local file option is very easy but because it is stored in RAM it will go away whenever the router reboots.

Enable remote logging:

nvram set log_ipaddr=<your syslogd ip>
nvram commit

To run syslogd and klogd

vi /etc/inittab

add the following lines:

::respawn:/sbin/syslogd -n
::respawn:/sbin/klogd -n

Tells syslogd to write the log file to /var/log/messages

/var is linked to /tmp but we may need to create /var/log at boot time

vi /etc/init.d/rcS

add the following line:

mkdir /var/log

which computers are connected and at what signal strength

Response is in dBm's and a less negative number is better. Put this script in /bin

ipkg install wl
#!/bin/sh
for MAC in `wl assoclist | cut -d ' ' -f 2` ; do
  echo -n 'Computer: ';
  echo -n `cat /tmp/dhcp.leases | awk '{x=toupper($0); print x}' | grep $MAC | cut -d ' ' -f 4`;
  echo -n ' IP: ';
  echo -n `cat /tmp/dhcp.leases | awk '{x=toupper($0); print x}' | grep $MAC | cut -d ' ' -f 3`;
  echo -n ' Signal Strength: ' ;
  echo -n `wl rssi $MAC | cut -d ' ' -f 3`;
  echo ' dBm'
done

better version

#!/bin/sh
for MAC in `wl assoclist | awk '{print $2}'`
do
  echo -n "Computer: `grep -i ${MAC} /tmp/dhcp.leases | awk '{print $4}'`";
  echo -n " IP: `grep -i ${MAC} /tmp/dhcp.leases | awk '{print $3}'`";
  echo -n " Expires: `grep -i ${MAC} /tmp/dhcp.leases | awk '{print $1}' | awk '{print strftime("%x %X",$1)}'`" ;
  echo -n " Signal Strength: `wl rssi $MAC | awk '{print $3}'` dBm" ;
  echo " "
done