Commands and Scripts for v2 and v3 Routers

Commands and Scripts for v2 and v3 Routers
Commands and Scripts
for v2 and v3 Routers
APPLICATION NOTE
USED SYMBOLS
Used symbols
Danger – important notice, which may have an influence on the user’s safety or the function
of the device.
Attention – notice on possible problems, which can arise in specific cases.
Information, notice – information, which contains useful advice or special interest.
Example – example of function, command or script.
GPL license
Source codes under GPL license are available free of charge by sending an email to:
info@conel.cz.
Conel s.r.o., Sokolska 71, 562 04 Usti nad Orlici, Czech Republic
Manual issued in CZ, December 16, 2014
i
CONTENTS
Contents
1 Commands
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
1.10
1.11
1.12
1.13
1.14
1.15
1.16
1.17
1.18
1.19
1.20
1.21
1.22
1.23
1.24
1.25
1.26
1.27
1.28
1.29
1.30
1.31
1.32
1.33
1.34
1.35
1.36
1.37
1.38
arp . . . .
awk . . .
brctl . . .
cat . . . .
cd . . . .
cdmaat .
cdmapwr
chmod . .
conntrack
cp . . . .
curl . . . .
date . . .
defaults .
df . . . . .
dmesg . .
echo . . .
email . . .
ethtool . .
find . . . .
free . . .
fwupdate
grep . . .
gsmat . .
gsmat2 .
gsminfo .
gsmpwr .
gsmpwr2
gsmsms .
gunzip . .
gzip . . .
hwclock .
ifconfig . .
io . . . . .
ip . . . . .
iptables .
kill . . . .
killall . . .
led . . . .
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.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.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
2
3
4
4
5
5
5
6
8
8
9
9
10
10
11
12
12
13
13
14
15
16
16
16
17
17
17
18
18
19
20
21
22
24
24
25
25
CONTENTS
1.39
1.40
1.41
1.42
1.43
1.44
1.45
1.46
1.47
1.48
1.49
1.50
1.51
1.52
1.53
1.54
1.55
1.56
1.57
1.58
1.59
1.60
1.61
1.62
1.63
1.64
1.65
1.66
1.67
1.68
1.69
1.70
1.71
1.72
1.73
1.74
1.75
1.76
1.77
ln . . . . .
logger . .
lpm . . . .
ls . . . . .
mac . . .
mkdir . . .
mount . .
mv . . . .
nc . . . .
netstat . .
ntpdate .
openssl .
passwd .
pidof . . .
ping . . .
portd . . .
ps . . . .
pwd . . .
reboot . .
restore . .
rm . . . .
rmdir . . .
route . . .
sed . . . .
service . .
sleep . . .
slog . . .
snmptrap
status . .
tail . . . .
tar . . . .
tc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.
.
.
.
.
.
.
.
.
2 Examples of scripts
26
27
28
29
30
30
31
32
32
33
33
34
35
35
35
36
36
37
37
37
38
38
39
40
40
41
41
42
43
44
44
45
45
46
46
47
48
48
49
50
2.1 Send SMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 SMS command 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 SMS command 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iii
50
50
51
CONTENTS
2.4
2.5
2.6
2.7
2.8
2.9
2.10
Send information email 1 . . . . . . . . . . . . . . . .
Send information SMNP trap 1 . . . . . . . . . . . . .
Send information email 2 . . . . . . . . . . . . . . . .
Send information SMNP trap 2 . . . . . . . . . . . . .
Automatic reboot . . . . . . . . . . . . . . . . . . . . .
Switch between WAN and PPP . . . . . . . . . . . . .
Add more MAC addresses reservation to DHCP server
iv
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
52
52
52
53
53
54
55
LIST OF TABLES
List of Tables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
arp options . . . . . . . . . . . . .
awk options . . . . . . . . . . . . .
brctl commands . . . . . . . . . . .
cat options . . . . . . . . . . . . .
cd options . . . . . . . . . . . . . .
chmod options . . . . . . . . . . .
conntrack comands . . . . . . . .
conntrack tables . . . . . . . . . .
conntrack options . . . . . . . . . .
expectation options . . . . . . . . .
conntrack and expectation options
cp options . . . . . . . . . . . . . .
date options . . . . . . . . . . . . .
df options . . . . . . . . . . . . . .
dmesg options . . . . . . . . . . .
echo options . . . . . . . . . . . .
email options . . . . . . . . . . . .
find expressions . . . . . . . . . .
fwupdate options . . . . . . . . . .
grep options . . . . . . . . . . . . .
Description of GSM information . .
gunzip options . . . . . . . . . . .
gzip options . . . . . . . . . . . . .
hwclock options . . . . . . . . . . .
ifconfig options . . . . . . . . . . .
io options . . . . . . . . . . . . . .
ip options . . . . . . . . . . . . . .
ip objects . . . . . . . . . . . . . .
kill options . . . . . . . . . . . . . .
killall options . . . . . . . . . . . .
led options . . . . . . . . . . . . .
ln options . . . . . . . . . . . . . .
logger options . . . . . . . . . . . .
lpm options . . . . . . . . . . . . .
ls options . . . . . . . . . . . . . .
mkdir options . . . . . . . . . . . .
mount flags . . . . . . . . . . . . .
mount options . . . . . . . . . . . .
mv options . . . . . . . . . . . . .
nc options . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
v
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.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
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
2
3
4
4
5
6
6
6
7
7
8
9
10
10
11
12
13
14
15
16
18
18
19
20
21
22
22
24
25
25
26
27
28
29
30
31
31
32
32
LIST OF TABLES
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
netstat options . .
ntpdate options . .
pidof options . . .
ping options . . . .
portd options . . .
reboot options . . .
rm options . . . . .
route options . . .
sed options . . . .
slog options . . . .
snmptrap options .
status options . . .
tail options . . . . .
tar options . . . . .
touch options . . .
traceroute options
umount options . .
vi options . . . . .
wget options . . .
xargs options . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
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
48
48
49
1. COMMANDS
1. Commands
1.1
arp
The arp program displays and modifies the Internet-to-Ethernet address translation tables
used by the address resolution protocol.
Synopsis:
arp [-a <hostname>] [-s <hostname> <hw_addr>] [-d <hostname>] [-v] [-n] [-i <if>]
[-D <hostname>] [-A ] [-f <filename>]
Options:
Option
-a
-s
-d
-v
-n
-i
-D
-f
Description
The entries will be displayed in alternate (BSD) style.
Manually create an ARP address mapping entry for host hostname with hardware address set to hw_addr.
Remove any entry for the specified host.
Tell the user what is going on by being verbose.
Shows numerical addresses instead of trying to determine symbolic host, port
or user names.
Select an interface.
Use the interface ifa’s hardware address.
Similar to the -s option, only this time the address info is taken from file filename set up. The name of the data file is very often /etc/ethers, but this is
not official. If no filename is specified /etc/ethers is used as default.
The format of the file is simple; it only contains ASCII text lines with a hardware address and a hostname separated by whitespace. Additionally the pub,
temp and netmask flags can be used.
Table 1: arp options
With no flags, the program displays the current ARP entry for hostname. The host may
be specified by name or by number, using Internet dot notation. For detail description of this
command, visit Linux manual pages.
Examples:
View arp table without translating IP addresses to domain names
arp -n
1
1. COMMANDS
1.2
awk
Awk scans each input file for lines that match any of a set of patterns specified literally in
program-text or in one or more files specified as -f progfile.
Synopsis:
awk [-v] [-F] [-f] ...[<program-text>] [<file> ...]
Options:
Option
-v
-F
-f
Description
Assign the value val to the variable var, before execution of the program begins. Such variable values are available to the BEGIN block of an AWK program.
Use for the input field separator (the value of the FS predefined variable).
Read the AWK program source from the file program-file, instead of from the
first command line argument. Multiple -f (or --file) options may be used.
Table 2: awk options
Examples:
Show IP address of Gateway
route -n | awk ’/ˆ0\.0\.0\.0/ { print $2 }’
2
1. COMMANDS
1.3
brctl
Brctl command is used to set up, maintain, and inspect the Ethernet bridge configuration
in the Linux kernel.
An Ethernet bridge is a device commonly used to connect different networks of Ethernets
together, so that these Ethernets will appear as one Ethernet to the participants.
Each of the Ethernets being connected corresponds to one physical interface in the bridge.
These individual Ethernets are bundled into one bigger (’logical’) Ethernet, this bigger Ethernet
corresponds to the bridge network interface.
Synopsis:
brctl [<commands>]
Options:
Command
addbr
delbr
addif
delif
setageing
setbridgepri
setfd
sethello
setmaxage
setpathcost
setportrpio
show
showmacs
showstp
stp
Parameters
<bridge>
<bridge>
<bridge> <device>
<bridge> <device>
<bridge> <time>
<bridge> <prio>
<bridge> <time>
<bridge> <time>
<bridge> <time>
<bridge> <port> <cost>
<bridge> <port> <prio>
<bridge>
<bridge>
<bridge> {on | off}
Description
Add bridge
Delete bridge
Add interface to bridge
Delete interface from bridge
Set ageing time
Set bridge priority
Set bridge forward delay
Set hello time
Set max message age
Set path cost
Set port prioriy
Show list of bridges
Show list of mac address
Show bridge stp info
Turn stp on/off
Table 3: brctl commands
Examples:
Create bridge between eth0 and eth1.
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
3
1. COMMANDS
1.4
cat
This command concatenates files and print on the standard output.
Synopsis:
cat [-u] [<file>] ...
Options:
Option
-u
Description
Ignored since unbuffered I/O is always used.
Table 4: cat options
Examples:
View the contents of file /proc/tty/driver/spear_serial (info about serial ports of v2 routers).
cat /proc/tty/driver/spear_serial
Copy the contents of the router configuration files in /tmp/my.cfg.
cat /etc/settings.* > /tmp/my.cfg
1.5
cd
This command is used to change the current working directory.
Synopsis:
cd [-P] [-L] [<directory>]
Options:
Option
-P
-L
Description
Do not follow symbolic links
Follow symbolic links (default)
Table 5: cd options
Examples:
Move to home directory (/root).
cd
Move to directory /mnt.
cd /mmt
4
1. COMMANDS
1.6
cdmaat
The program used for sending AT command to CDMA module if available (equivalent of
the gsmat command, see 1.23).
Synopsis:
cdmaat <AT command>
1.7
cdmapwr
The program used to control the supply of CDMA module if available (equivalent of the
gsmpwr command, see 1.26).
Synopsis:
cdmapwr [on | off]
1.8
chmod
This command is used to change file mode bits.
Synopsis:
chmod [-R] <mode> <filename>
Options:
Option
-R
Description
Change files and directories recursively
Table 6: chmod options
Examples:
Settings rights (permit execution) of script /tmp/script.
chmod 755 /tmp/script
5
1. COMMANDS
1.9
conntrack
This program is user interface to netfilter connection tracking system.
Synopsis:
conntrack [commands] [option]
Options:
Command
-L [table] [option]
-G [table]
-D [table]
-I [table]
-U [table]
-E [table]
-F [table]
Description
List conntrack or expectation table
Get conntrack or expectation
Delete conntrack or expectation
Create a conntrack or expectation
Update a conntrack
Show events
Flush table
Table 7: conntrack comands
Table
conntrack
expect
Description
This is the default table. It contains a list of all currently tracked
connections through the system.
This is the table of expectations. Connection tracking expectations are the mechanism used to "expect" RELATED connections
to existing ones.
Table 8: conntrack tables
Option
-n <ip>
-g <ip>
-m <mark>
-e <eventmask>
-z
-o <type[...]>
Description
Source NAT ip
Destination NAT ip
Set mark
Event mask, eg. NEW,DESTROY
Zero counters while listing
Output format, eg. xml
Table 9: conntrack options
6
1. COMMANDS
Option
--tuple-src <ip>
--tuple-dst <ip>
--mask-src <ip>
--mask-dst <ip>
Description
Source address in expect tuple
Destination address in expect tuple
Source mask address
Destination mask address
Table 10: expectation options
Option
-s <ip>
-d <ip>
-r <ip>
-q <ip>
-p <proto>
-f <proto>
-t <timeout>
-u <status>
Description
Source address from original direction
Destination address from original direction
Source addres from reply direction
Destination address from reply direction
Layer 4 Protocol, eg. ’tcp’
Layer 3 Protocol, eg. ’ipv6’
Set timeout
Set status, eg. ASSURED
Table 11: conntrack and expectation options
Examples:
Display content of conntrack table.
conntrack -L
Delete content of contrack table.
conntrack -F
7
1. COMMANDS
1.10
cp
This command is used to copy files and directories.
Synopsis:
cp [<option>] <source> <dest>
Options:
Option
-a
-d, -P
-H, -L
-p
-f
-i
-R, -r
Description
Preserve the all attributes
Never follow symbolic links
Follow command-line symbolic links
Preserve the mode, ownership, timestamps attributes
If an existing destination file cannot be opened, remove it and try again
Prompt before overwrite
Copy directories recursively
Table 12: cp options
Examples:
Copy the system log to directory /mnt.
cp /var/log/messages* /mnt
Copy configuration profile "Alternative 1" to profile "Standard".
cp -r /etc/alt1/* /etc
1.11
curl
Curl (transfer a URL) is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP,
LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). It is
an alternative to wget (see 1.76).
Synopsis:
curl [options...]
<url>
Options:
Type curl --help for options to show in the command line or visit online manual page at
http://curl.haxx.se/docs/manpage.html
8
1. COMMANDS
1.12
date
This command is used to display the current time in the given FORMAT, or set the system
date (and time).
Synopsis:
date [-R] [-d <string>] [-s] [-r <file>] [-u] [MMDDhhmm[[CC]YY][.ss]]
Options:
Option
-R
-d <string>
-s
-r <file>
-u
Description
Output date and time in RFC 2822 format
Display time described by STRING, not ’now’
Set time described by STRING
Display the last modification time of FILE
Print or set Coordinated Universal Time
Table 13: date options
Examples:
Display the current date and time.
date
Setting the date and time on December 24, 2011 20:00.
date 122420002011
1.13
defaults
The script is used to restore the default configuration.
Synopsis:
defaults
9
1. COMMANDS
1.14
df
This command is used to view report file system disk space usage.
Synopsis:
df [-k] [<filesystem> ...]
Options:
Option
-k
Description
Print sizes in kilobytes
Table 14: df options
1.15
dmesg
This command is used to print or control the kernel ring buffer.
Synopsis:
dmesg [-c] [-n <level>] [-s <size>]
Options:
Option
-c
-n <level>
-s <size>
Description
Clears the ring buffer’s contents after printing
Set the level at which logging of messages is done to the console
Use a buffer of size SIZE to query the kernel ring buffer. This is 16392 by
default.
Table 15: dmesg options
Examples:
View the latest news and subsequent deletion of the kernel ring buffer.
dmesg -c
10
1. COMMANDS
1.16
echo
This command prints the strings to standard output.
Synopsis:
echo [-n] [-e] [-E] [<string> ...]
Options:
Option
-n
-e <level>
-E <size>
Description
Do not output the trailing newline
Enable interpretation of backslash escapes
Disable interpretation of backslash escapes (default)
Table 16: echo options
Examples:
Switch profile to "Standard".
echo "PROFILE=" > /etc/settings
reboot
Switch profile to "Alternative 1".
echo "PROFILE=alt1" > /etc/settings
reboot
Send a sequence of bytes 0x41,0x54,0x0D,0x0A to serial line (write data in octal).
echo -n -e "\101\124\015\012" > /dev/ttyS0
11
1. COMMANDS
1.17
email
The program used for sending email.
Synopsis:
email -t <to> [-s <subject>] [-m <message>] [-a <attachment>] [-r <retries>]
Options:
Option
-t
-s
-m
-a
-r
Description
Email of recipient
Subject of email
Message of email
Attachment of email
Number of retries
Table 17: email options
Examples:
Send system logs to the address john.doe@email.com.
email -t john.doe@email.com -s "System Log" -a /var/log/messages
1.18
ethtool
This command is used to display or change Ethernet card settings.
Synopsis:
ethtool [<option> ...]
<devname> [<commands>]
Options:
For detail description this command, visit Linux manual pages.
Examples:
View the status of the interface eth0.
ethtool eth0
Switch interface eth0 to mode 10 Mbit/s, half duplex.
ethtool -s eth0 speed 10 duplex half autoneg off
Turn on autonegacion on the interface eth0.
ethtool -s eth0 autoneg on
12
1. COMMANDS
1.19
find
Command to search for files in a directory hierarchy.
Synopsis:
find [<path> ...]
[<expression>]
Options:
The default path is the current directory, default expression is ’-print’. Type find --help for
help or look up online man page for more detailed description. Expression may consist of:
Option
-follow
-name <pattern>
-print
-type X
-perm <perms>
-mtime <days>
-mmin <mins>
-exec <cmd>
Description
Dereference symbolic links
File name (leading directories removed) matches <pattern>
Print (default and assumed)
Filetype matches X (where X is one of: f,d,l,b,c,...)
Permissions match any of (+NNN); all of (-NNN); or exactly (NNN)
Modified time is greater than (+N); less than (-N); or exactly (N) days
Modified time is greater than (+N); less than (-N); or exactly (N) minutes
Execute command with all instances of {} replaced by the files matching <expression>
Table 18: find expressions
Examples:
Search for files in your home directory which have been modified in the last twenty-four hours.
find $HOME -mtime 0
Search for files which have read and write permission for their owner, and group, but which
other users can read but not write to.
find . -perm 664
1.20
free
This command is used to display information about free and used memory.
Synopsis:
free
13
1. COMMANDS
1.21
fwupdate
The program used for router’s firmware update.
Synopsis:
fwupdate [-i <filename> [-h] [-n]] [-f]
Options:
Option
-i
-h
-n
-f
Description
File of the new firmware, filename has to be specified
HTML output (used when called from web configuration)
Do not reboot after firmware update
finish update procedures, called by default
Table 19: fwupdate options
14
1. COMMANDS
1.22
grep
Grep searches the named input FILEs (or standard input if no files are named, or the file
name – is given) for lines containing a match to the given PATTERN. By default, grep prints
the matching lines.
Synopsis:
grep [<options> ...]
<pattern> [<file> ...]
Options:
Option
-H
-h
-i
-l
-L
-n
-q
-v
-s
-c
-f
-e
-F
Description
Print the filename for each match
Suppress the prefixing of filenames on output when multiple files are
searched
Ignore case distinctions
Suppress normal output; instead print the name of each input file from which
output would normally have been printed
Suppress normal output; instead print the name of each input file from which
no output would normally have been printed
Prefix each line of output with the line number within its input file
Quiet; do not write anything to standard output. Exit immediately with zero
status if any match is found, even if an error was detected. Also see the -s or
--no-messages option.
Invert the sense of matching, to select non-matching lines
Suppress error messages about nonexistent or unreadable files
Suppress normal output; instead print a count of matching lines for each input
file
Obtain patterns from FILE, one per line
Use PATTERN as the pattern; useful to protect patterns beginning with –
Interpret PATTERN as a list of fixed strings, separated by new lines, any of
which is to be matched
Table 20: grep options
Examples:
See all lines of system log in which occurs the word "error".
grep error /var/log/messages
View all processes whose name the contents of the string "ppp".
ps | grep ppp
15
1. COMMANDS
1.23
gsmat
The program used for sending AT command to GSM module.
Synopsis:
gsmat <AT command>
Examples:
Determine the type and firmware version of GSM module.
gsmat ATI
Determine the IMEI code of module.
gsmat "AT+GSN"
1.24
gsmat2
The program used for sending AT command to second GSM module if available.
Synopsis:
gsmat2 <AT command>
1.25
gsminfo
The program used to display information about the signal quality.
Synopsis:
gsminfo
Options:
Option
PLMN
Cell
Channel
Level
Neighbours
Uptime
Description
Code of operator
The cell to which the router is connected
The channel on which the router communicates
The signal quality of the selected cell
Signal quality of neighboring hearing cells
Time to establish PPP connection
Table 21: Description of GSM information
16
1. COMMANDS
1.26
gsmpwr
The program used to control the supply of GSM module.
Synopsis:
gsmpwr [on | off]
Examples:
Power of GSM module is turning on.
gsmpwr on
Power of GSM module is turning off.
gsmpwr off
1.27
gsmpwr2
The program used to control the supply of second GSM module if available.
Synopsis:
gsmpwr2 [on | off]
1.28
gsmsms
The program used to send SMS message.
Synopsis:
gsmsms <phone number> <text>
Examples:
Send SMS "Hello word" on telephone number +420123456789.
gsmsms +420123456789 "Hello word"
17
1. COMMANDS
1.29
gunzip
This program is used to decompress FILE (or standard input if filename is ’–’).
Synopsis:
gunzip [-c] [-f] [-t] <filename>
Options:
Option
-c
-f
-t
Description
Write output on standard output
Force decompression even if the file has multiple links or the corresp. file
already exists, or if the compressed data is read from or written to a terminal.
Test. Check the compressed file integrity.
Table 22: gunzip options
Examples:
Decompression of file test.tar.gz (creates file test.tar).
gunzip test.tar.gz
1.30
gzip
This program is used to compress FILE with maximum compression.
Synopsis:
gzip [-c] [-d] [-f] <filename>
Options:
Option
-c
-d
-f
Description
Write output on standard output
Decompress
Force compression even if the file has multiple links or the corresponding file
already exists, or if the compressed data is read from or written to a terminal
Table 23: gzip options
Examples:
Compression of file test.tar (creates file test.tar.gz).
gzip test.tar
18
1. COMMANDS
1.31
hwclock
This program is used to query and set the hardware clock (RTC).
Synopsis:
hwclock [-r] [-s] [-w] [-u] [-l]
Options:
Option
-r
-s
-w
-u
-l
Description
Read hardware clock a print result
Set the System Time from the Hardware Clock
Set the Hardware Clock to the current System Time
The hardware clock is kept in coordinated universal time
The hardware clock is kept in local time
Table 24: hwclock options
Examples:
Set the hardware clock to the current system time.
hwclock -w -u
19
1. COMMANDS
1.32
ifconfig
This command is used to configure a network interface.
Synopsis:
ifconfig [-a] <interface> [<option> ...]
Options:
Option
broadcast <addr.>
pointtopoint <ad.>
netmask <address>
dstaddr <address>
metric <NN>
mtu <NN>
trailers
arp
allmulti
multicast
promisc
txqueuelen <NN>
up | down
Description
If the address argument is given, set the protocol broadcast address for this interface.
This keyword enables the point-to-point mode of an interface,
meaning that it is a direct link between two machines with nobody
else listening on it.
Set the IP network mask for this interface.
Set the remote IP address for a point-to-point link (such as PPP).
This parameter sets the interface metric.
This parameter sets the Maximum Transfer Unit of an interface.
This flag used to cause a non-standard encapsulation of inet
packets on certain link levels.
Enable or disable the use of the ARP protocol on this interface.
Enable or disable all-multicast mode. If selected, all multicast
packets on the network will be received by the interface.
Set the multicast flag on the interface. This should not normally
be needed as the drivers set the flag correctly them-selves.
Enable or disable the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.
Set the length of the transmit queue of the device.
This flag causes the interface to be activated. | This flag causes
the driver for this interface to be shut down.
Table 25: ifconfig options
Examples:
View the status of all interfaces.
ifconfig
Activation of loopback with IP address 127.0.0.1/8.
ifconfig lo up
Activation of virtual interface eth0:0 with IP address 192.168.2.1/24.
ifconfig eth0:0 192.168.2.1 netmask 255.255.255.0 up
20
1. COMMANDS
1.33
io
The program is used to control outputs and read inputs. Supports reading state of binary
outputs and setting state of counters.
Synopsis:
io [get <pin>] | [set <pin> <value>]
Options:
Option
get
set
Description
Set output
Determine state of input
Table 26: io options
Examples:
Set the state of binary output OUT0 to 1.
io set out0 1
Determine the state of digital input BIN0.
io get bin0
Determine the state of analog input AN1 on expansion port XC-CNT.
io get an1
Determine the state of counter input CNT1 on expansion port XC-CNT.
io get cnt1
21
1. COMMANDS
1.34
ip
This command is used to configure a network interface or show the current configuration.
Type ip –help for help in the terminal.
The v3 routers support more ip options and commands (options: -d[etails], -t[imestamp,
-b[atch] <filename>, -rc[vbuf]; objects: addrlabel, ntable, tuntap, mrule, netns, l2tp,
tcp_metrics, token). For information how to use, type ip <object> help, for detailed description of all options, visit Linux manual pages or look up them online.
Synopsis:
ip [ <options> ] <object> { <command> | help }
Options:
Option
-V[ersion]
-s[tatistics]
-r[esolve]
-f[amily] <family>
-o[neline]
Description
Print the version of the ip utility and exit
Output more information. If the option appears twice or more, the
amount of information increases.
use the system’s name resolver to print DNS names instead of
host addresses
Specifies the protocol family to use. The protocol family identifier
can be one of inet, inet6, bridge , ipx, dnet or link.
output each record on a single line, replacing line feeds with the
’\’ character
Table 27: ip options
Object
link
addr
route
rule
neigh
tunnel
maddr
mroute
monitor
xfrm
Description
network device
protocol (IP or IPv6) address on a device
routing table entry
rule in routing policy database
manage ARP or NDISC cache entries
tunnel over IP
multicast address
multicast routing cache entry
watch for netlink messages
manage IPSec policies
Table 28: ip objects
22
1. COMMANDS
Examples:
View the status of all interfaces.
ip link show
View the route table.
ip route list
Add routing networks 192.168.3.0/24 through interface eth0.
ip route add 192.168.3.0/24 dev eth0
Add routing IP address 192.168.3.1 trough gateway 192.168.1.2.
ip route add 192.168.3.1 via 192.168.1.2
Add default gateway 192.168.1.2.
ip route add default via 192.168.1.2
23
1. COMMANDS
1.35
iptables
This command is used to administration tool for IP packet filtering and NAT.
Synopsis:
iptables [<options>]
Options:
For detail description of this command visit Linux manual pages.
Examples:
Redirect incoming TCP connections to port 8080 on IP address 192.168.1.2 and port 80.
iptables -t nat -A napt -p tcp –dport 8080 -j DNAT --to-destination 192.168.1.2:80
1.36
kill
This command is used to terminate process.
Synopsis:
kill [ -<signal> ] <process-id> [ <process-id> ...]
kill -l
Options:
Option
-l
Description
Print a list of signal names. These are found in /usr/include/linux/signal.h
Table 29: kill options
Examples:
End the process with PID 1234 by sending signal SIGTERM.
kill 1234
End the process with PID 1234 by sending signal SIGKILL.
kill -9 1234
24
1. COMMANDS
1.37
killall
This command is used to kill all process with process name.
Synopsis:
killall [ -q] [ -<signal> ] <process-name> [<process-name> ...]
Options:
Option
-l
-q
Description
Print a list of signal names. These are found in /usr/include/linux/signal.h
Do not complain if no processes were killed
Table 30: killall options
Examples:
End the all processes with name pppd by sending signal SIGTERM.
killall pppd
End the all processes with name pppd by sending signal SIGKILL.
killall -9 pppd
1.38
led
The program used to control the USR LED on the front panel of the router.
Synopsis:
led [on | off]
Options:
Option
on
off
Description
User LED is on
User LED is off
Table 31: led options
Examples:
Turn on USR LED.
led on
Turn off USR LED.
led off
25
1. COMMANDS
1.39
ln
The program used to make links between files.
Synopsis:
ln [ option ] < target > ...< link_name > | < directory >
Options:
Option
-s
-f
-n
-b
-S
Description
Make symbolic links instead of hard links
Remove existing destination files
No dereference symlinks – treat like normal file
Make a backup of the target (if exists) before link operation
Use suffix instead of ∼ when making backup files
Table 32: ln options
Examples:
Creating a symbolic link to file /var/log/messages called my.log.
ln -s /var/log/messages my.log
26
1. COMMANDS
1.40
logger
The program makes entries in the system log. It provides a shell command interface to the
system log module.
Synopsis:
logger [ option ] [ message ...]
Options:
Option
-i
-s
-f <file>
-p <priority>
-t <tag>
-u <socket>
-d
Description
Log the process id of the logger process with each line
Log the message to standard error, as well as the system log
Log the specified file
Enter the message with the specified priority. The priority may be specified numerically or as a facility.level pair.
Mark every line in the log with the specified tag
Write to socket as specified with socket instead of builtin syslog routines
Use a datagram instead of a stream connection to this socket
Table 33: logger options
Examples:
Send the message System rebooted to the syslogd daemon.
logger System rebooted
Send the message System going down immediately!!! to the syslog daemon, at the emerg
level and user facility.
logger -p user.emerg "System going down immediately!!!"
27
1. COMMANDS
1.41
lpm
Put the router into the low power mode and wake up on events specified by parameters
(binary input or time interval). Router will wake up on the first event coming when more
parameters specified.
This command works on v3 routers only due to hardware support.
Synopsis:
lpm [-b] [-i <interval>]
Options:
Option
-b
-i
Description
Wake up the router on binary input In1
Wake up the router after time interval specified in seconds
Table 34: lpm options
28
1. COMMANDS
1.42
ls
The program used to list directory contents.
Synopsis:
ls [ option ] < filename > ...
Options:
Option
-1
-A
-a
-C
-c
-d
-e
-i
-l
-n
-L
-r
-S
-s
-t
-u
-v
-x
-X
Description
List files in a single column
Do not list implied . and ..
Do not hide entries starting with .
List entries by columns
With -l: show ctime
List directory entries instead of contents
List both full date and full time
List the i-node for each file
Use a long listing form
List numeric UIDs and GIDs instead of names
List entries pointed to by symbolic links
Sort the listing in reverse order
Sort the listing by file size
List the size of each file, in blocks
With -l: show modification time
With -l: show access time
Sort the listing by version
List entries by lines instead of by columns
Sort the listing by extension
Table 35: ls options
Examples:
View detailed content of directory /mnt.
ls -l /mnt
View list contents of actually directory.
ls
29
1. COMMANDS
1.43
mac
The program used to display the MAC address of eth0.
Synopsis:
mac [<separator>]
Examples:
Display the MAC address of eth0. Will be used as the separator character "-" instead of ":".
mac -
1.44
mkdir
This program used to make directories.
Synopsis:
mkdir [<option>] directory ...
Options:
Option
-m
-p
Description
Set permission mode (as in chmod), not rwxrwxrwx – umask
No error if existing, make parent directories as needed
Table 36: mkdir options
Examples:
Create directory /tmp/test/example.
mkdir -p /tmp/test/example
30
1. COMMANDS
1.45
mount
This program used to mount a file system.
Synopsis:
mount [-a] [-o] [-r] [-t] [-w] <DEVICE> <NODE> [ -o <option>, ...]
Options:
Flag
-a
-o
-r
-t
-w
Description
Mount all filesystems in fstab
One of many filesystem options, listed below
Mount the filesystem read-only
Specify the filesystem type
Mount for reading and writing (default)
Table 37: mount flags
Option
async/sync
atime/noatime
dev/nodev
exec/noexec
suid/nosuid
remount
ro/rw
bind
move
Description
Writes are asynchronous / synchronous
Enable / disable updates to inode access times
Allow use of special device files / disallow them
Allow use of executable files / disallow them
Allow set-user-id-root programs / disallow them
Re-mount a mounted filesystem, changing its flags
Mount for read-only / read-write
Bind a directory to an additional location
Relocate an existing mount point
Table 38: mount options
For detail description this command, visit Linux manual pages.
Examples:
Connect a contents of USB flash drive to the directory /mnt.
mount -t vfat /dev/sda1 /mnt
31
1. COMMANDS
1.46
mv
This program is used to move or rename files.
Synopsis:
mv [-f] [-i] <source> ...<dest>
Options:
Option
-f
-i
Description
Don’t prompt before overwriting
Interactive, prompt before overwrite
Table 39: mv options
Examples:
Rename file abc.txt na def.txt.
mv abc.txt def.txt
Move all files with the extension txt to the directory /mnt.
mv *.txt /mnt
1.47
nc
This program Netcat opens a pipe to IP:port.
Synopsis:
nc [<options>] [<ip>] [<port>]
Options:
Option
-l
-p <port>
-i <secs>
-w <secs>
Description
listen mode, for inbound connects
local port number
delay interval for lines sent
timeout for connects and final net reads
Table 40: nc options
Example:
Open a TCP connection to port 42 of 192.168.3.1, using port 31337 as the source port, with
a timeout of 5 seconds:
nc -p 31337 -w 5 192.168.3.1 42
32
1. COMMANDS
1.48
netstat
The program Netstat displays the networking information.
Synopsis:
netstat [<options>]
Options:
Option
-l
-a
-e
-n
-r
-t
-u
-w
-x
Description
display listening server sockets
display all sockets (default: connected)
display other/more information
don’t resolve names
display routing table
tcp sockets
udp sockets
raw sockets
unix sockets
Table 41: netstat options
1.49
ntpdate
The program is used to set the system time from NTP server.
Synopsis:
ntpdate [-p <probes>] [-t <timeout>] <server>
Options:
Option
-p
-t
Description
Specify the number of samples to be acquired from each server as the integer
samples, with values from 1 to 8 inclusive.
Specify the maximum time waiting for a server response as the value timeout,
in seconds and fraction.
Table 42: ntpdate options
Examples:
Set the system time according to the NTP server time.windows.com.
ntpdate time.windows.com
33
1. COMMANDS
1.50
openssl
The openssl program is a command line tool for using the various cryptography functions
of OpenSSL’s crypto library from the shell. It can be used for:
• Creation of RSA, DH and DSA key parameters
• Creation of X.509 certificates, CSRs and CRLs
• Calculation of Message Digests
• Encryption and Decryption with Ciphers
• SSL/TLS Client and Server Tests
• Handling of S/MIME signed or encrypted mail
Synopsis:
openssl [<option> ...]
Options:
For detail description this command, visit Linux manual pages.
Examples:
Generate a new key for the SSH server.
openssl genrsa -out /etc/certs/ssh_rsa_key 512
Generate a new certificate for the HTTPS server.
openssl req -new -out /tmp/csr -newkey rsa:1024 -nodes -keyout /etc/certs/https_key
openssl x509 -req -setstart 700101000000Z -setend 400101000000Z -in /tmp/csr -signkey
/etc/certs/https_key -out /etc/certs/https_cert
34
1. COMMANDS
1.51
passwd
This program is used to change password for user root.
Synopsis:
passwd
1.52
pidof
This program lists the PIDs of all processes with names that match the names on the
command line.
Synopsis:
pidof <process-name> [<option>] [<process-name> ...]
Options:
Option
-s
Description
display only a single PID
Table 43: pidof options
1.53
ping
This program is used to send ICMP echo request to network host.
Synopsis:
ping [-c <count>] [-s <size>] [-q] <hosts>
Options:
Option
-c
-s
-q
-I
Description
Send only COUNT pings
Send SIZE data bytes in packets (default = 56)
Quiet mode, only displays output at start and when finished
Selects outgoing interface
Table 44: ping options
Examples:
Send one ICMP packet Echo Request with size 500 B on IP address 10.0.0.1.
ping -c 1 -s 500 10.0.0.1
35
1. COMMANDS
1.54
portd
The program is used for transparent transfer of data from the serial line by TCP or UDP.
Synopsis:
portd -c <device> [-b <baudrate>] [-d <databits>] [-p <parity>] [-s <stopbits>]
[-l <split timeout>] [-4] [-h <hostname>] [-o <proto>] -t <port> [-k <keepalive time>]
[-i <keepalive interval>] [-r <keepalive probes>] [-x] [-z]
Options:
Option
-c
-b
-d
-p
-s
-l
-4
-h
-o
-t
-k
-i
-r
-x
-z
Description
Serial line device
Baudrate
Number of data bits
Parity – even, odd or none
Number of stop bits
Split timeout
Forced detection Expansion port 485
Hostname
Protocol TCP or UDP
TCP or UDP port
Keepalive time
Keepalive interval
Keepalive probes
Use signal CD as indicator of the TCP connection
Use DTR as control TCP connection
Table 45: portd options
Examples:
Running a TCP server listening on port 1000th After a TCP connection, the program transparently transmit data from the serial port settings 115200 bit/s, 8N1.
portd -c /dev/ttyS0 -b 115200 -t 1000 &
1.55
ps
This program is used to view report process status.
Synopsis:
ps
36
1. COMMANDS
1.56
pwd
This program used to view current directory.
Synopsis:
pwd
1.57
reboot
This program is used to reboot the router.
Synopsis:
reboot [-d <delay>] [-n <nosync>] [-f <force>]
Options:
Option
-d
-n
-f
Description
Delay interval for rebooting
No call to sync()
Force reboot, do not call shutdown
Table 46: reboot options
Examples:
Reboot router after 10 second.
reboot -d 10
1.58
restore
This program is used to restore configuration from file.
Synopsis:
restore <filename>
Examples:
Restore configuration from file /tmp/my.cfg.
restore /tmp/my.cfg
37
1. COMMANDS
1.59
rm
This program is used to remove files or directories.
Synopsis:
rm [-i] [-f] [-r] <file> ...
Options:
Option
-i
-f
-r
Description
Always prompt before removing each destination
Remove existing destinations, never prompt
Remove the contents of directories recursively
Table 47: rm options
Examples:
Remove all files with extension txt in the current directory.
rm *.txt
Remove directory /tmp/test and all subdirectories.
rm -rf /tmp/test
1.60
rmdir
This program is used to remove empty directories.
Synopsis:
rmdir <filename>
Examples:
Remove empty directory /tmp/test.
rmdir /tmp/test
38
1. COMMANDS
1.61
route
This program is used to show and manipulate the IP routing table.
Synopsis:
route [ -n ] [ -e ] [ -A ] [ add | del | delete ]
Options:
Option
-n
-e
-A
Description
Don’t resolve names
Display other/more information
Select address family
Table 48: route options
For detail description this command, visit Linux manual pages.
Examples:
View the routing table without translating IP addresses to domain names.
route -n
Add routing networks 192.168.3.0/24 through eth0.
route add -net 192.168.3.0/24 dev eth0
Add routing IP addresses 192.168.3.1 through 192.168.1.2 gateway.
route add -host 192.168.3.1 gw 192.168.1.2
Add default gateway 192.168.1.2
route add default gw 192.168.1.2
39
1. COMMANDS
1.62
sed
This program is used for filtering and transforming text.
Synopsis:
sed [ -e ] [ -f ] [ -i ] [ -n ] [ -r ] pattern [ -files ]
Options:
Option
-e
-f
-i
-n
-r
Description
Add the script to the commands to be executed
Add script-file contents to the commands to be executed
Edit files in place (makes backup if extension supplied)
Suppress automatic printing of pattern space
Use extended regular expression syntax
Table 49: sed options
If no -e or -f is given, the first non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are specified, then the standard
input is read. Source files will not be modified unless -i option is given.
Examples:
Change parameter PPP_APN in file /etc/settings.ppp to value "internet".
sed -e "s/\(PPP_APN=\).*/\1internet/" -i /etc/settings.ppp
1.63
service
This program is used to start, stop or restart specified service.
Synopsis:
service < service name > <start | stop | restart>
Examples:
Start service cron.
service cron start
Restart service ppp.
service ppp restart
40
1. COMMANDS
1.64
sleep
This program is used to delay for a specified amount of time.
Synopsis:
sleep <time>
Examples:
Pause for 30 second.
pause 30
1.65
slog
This script used to show system log (file /var/log/message).
Synopsis:
slog [-n <number>] [-f]
Options:
Option
-n
-f
Description
Print last N lines instead of last 10
Output data as the file grows
Table 50: slog options
Examples:
Continuous listing the system log. Listing stops when reaching the maximum number of lines
of log.
slog -f
41
1. COMMANDS
1.66
snmptrap
This program is used to sending SNMP trap.
Synopsis:
snmptrap [-c <community>] [-g <generic>] [-s <specific>] <hostname>
[<oid> <type> <value>]
Options:
Option
-c
-g
-r
-s
Description
Community
Specifies generic trap types:
• 0 – coldStart
• 1 – warmStart
• 2 – linkDown
• 3 – linkUp
• 4 – authenticationFailure
• 5 – egpNeighborLoss
• 6 – enterpriseSpecific
Sends MAC address of eth0 interface
Specifies user definition trap types in the enterpriseSpecific
Table 51: snmptrap options
Examples:
Send TRAP with info about the status of a digital input BIN0 to the IP address 192.168.1.2.
snmptrap 192.168.1.2 1.3.6.1.4.1.30140.2.3.1.0 u ’io get bin0’
Send TRAP "warm start" to the IP address 192.168.1.2.
snmptrap -g 1 192.168.1.2
42
1. COMMANDS
1.67
status
This program writes out the status of router’s interfaces or system. It is equivalent to
General Status and Mobile WAN Status in router’s web administration.
Synopsis:
status [ -h ] [ -v ] [ lan | mobile | module | ports | ppp | sys | wifi ]
Options:
Option
-h
-v
lan
mobile
module
ports
ppp
sys
wifi
Description
Generates html output (used when called by web interface)
Verbose – writes out more detailed informations
Status of primary LAN. Can be lan 1, lan 2, etc. if available
Status of mobile WAN
Status of mobile module. Can be module 1, module 2, etc. if available
Status of available peripheral ports
Status of mobile connection
System information
Status of wlan interafce
Table 52: status options
Examples:
Show verbosed status of mobile connection:
status -v mobile
43
1. COMMANDS
1.68
tail
This program is used to output the last part of files.
Synopsis:
tail [ -n <number>] [ -f ]
Options:
Option
-n
-f
Description
Print last N lines instead of last 10
Output data as the file grows
Table 53: tail options
Examples:
Show last 30 lines of /var/log/messages.
tail -n 30 /var/log/messages
1.69
tar
This program is used to create, extract or list files from a tar file.
Synopsis:
tar -[czxtv0] [ -f tarfile ] [ -C dir ] [ file ] ...
Options:
Option
c
x
t
z
-f
0
-C
v
Description
Create
Extract
List
Filter the archive trough gzip
Name of TARFILE or "-" for stdin
Extract to stdout
Change to directory DIR before operation
Verbosely list files processed
Table 54: tar options
Examples:
Creating log.tar archive that contains files from the directory /var/log.
tar -cf log.tar /var/log
Extract files from the archive log.tar.
tar -xf log.tar
44
1. COMMANDS
1.70
tcpdump
This program is used to dump traffic on a network.
Synopsis:
tcpdump [-AdDeflLnNOpqRStuUvxX] [-c <count>] [-C <file size>] [-E algo:secret]
[-F <file>] [-i <interface>] [-r <file>] [-s <snaplen>] [-T type] [-w <file>]
[-y <datalinktype>] [expression]
Options:
For detail description this command, visit Linux manual pages.
Examples:
View traffic on interface ppp0.
tcpdump -n -i ppp0
View traffic on interface eth0 except protocol Telnet.
tcpdump -n not tcp port 23
View UDP traffic on interface eth0.
tcpdump -n udp
View HTTP traffic on interface eth0.
tcpdump -n tcp port 80
View all traffic from/to IP address 192.168.1.2.
tcpdump -n host 192.168.1.2
View traffic from/to IP address 192.168.1.2 except protocol Telnet.
tcpdump -n host 192.168.1.2 and not tcp port 23
1.71
telnet
This program is used to establish interactive communication with another computer over a
network using the TELNET protocol.
Synopsis:
telnet <host> [<port>]
Examples:
Connect to 192.168.1.2 by protocol Telnet.
telnet 192.168.1.2
45
1. COMMANDS
1.72
touch
This program used to update timestamp of file.
Synopsis:
touch [-c] <file> [<file> ...]
Options:
Option
-c
Description
Do not create any files
Table 55: touch options
Examples:
Create a file, respectively update timestamp of file /tmp/test.
touch /tmp/test
1.73
traceroute
This program is printed the route packets trace to network host.
Synopsis:
traceroute [-FIldnrv] [-f <1st_ttl>] [-m <max_ttl>] [-p <port#>] [-q <nqueries>]
[-s <src_addr>] [-t <tos>] [-w <wait>] [-g <gateway>] [-i <iface>] [-z <pausemsecs>]
host [data size]
Options:
Option
-F
-I
-l
-d
-n
-r
-v
-m
-p
-q
Description
Set the don’t fragment bit
Use ICMP ECHO instead of UDP datagrams
Display the ttl value of the returned packet
Enable socket level debugging
Print hop addresses numerically rather than symbolically
Bypass the normal routing tables and send directly to a host
Verbose output
Set the max time-to-live (max number of hops)
Set the base UDP port number used in probes (default is 33434)
Set the number of probes per "ttl" to nqueries (default is 3)
Continued on next page
46
1. COMMANDS
Continued from previous page
Option
-s
-t
-w
-g
Description
Use the following IP address as the source address
Set the type-of-service in probe packets to the following value (default 0)
Set the time (in seconds) to wait for a response to a probe (default 3 sec)
Specify a loose source route gateway (8 maximum)
Table 56: traceroute options
Examples:
Start traceroute on IP address 10.0.0.1 (without translation IP addresses to domain names).
traceroute -n 10.0.0.1
1.74
umount
This program is used to umount file systems.
Synopsis:
umount [-a] [-r] [-l] [-f] <file system> | <directory>
Options:
Option
-a
-r
-l
-f
Description
Unmount all file systems
Try to remount devices as read-only if mount is busy
Lazy umount (detach filesystem)
Force umount (i.e. unreachable NFS server)
Table 57: umount options
Examples:
Disconnecting the disc connected to the directory /mnt.
umount /mnt
47
1. COMMANDS
1.75
vi
This program is used to edit and read text file.
Synopsis:
vi [-R] [<file> ...]
Options:
Option
-R
Description
Read only, do not write to the file
Table 58: vi options
Examples:
Open file /etc/rc.local in the text editor vi.
vi /etc/rc.local
1.76
wget
This program is used to retrieve files via HTTP or FTP.
Synopsis:
wget [-c] [-q] [-O <document file>] [--header ’header:
[-P <DIR>] <url>
value’] [-Y on/off]
Options:
Option
-c
-q
-P
-O
-Y
Description
Continue retrieval of aborted transfers
Quiet mode – do not print
Set directory prefix to DIR
Save to filename (’-’ for stdout)
Use proxy (’on’ or ’off’)
Table 59: wget options
Examples:
Download a file my.cfg from HTTP server with IP address 10.0.0.1.
wget http://10.0.0.1/my.cfg
48
1. COMMANDS
1.77
xargs
This program executes the command on every item given by standard input.
Synopsis:
xargs [<commands>] [<options>] [<args> ...]
Options:
Option
-r
-t
Description
Do not run command for empty readed lines
Print the command line on stderr before executing it
Table 60: xargs options
Examples:
Find files named core in or below the directory /tmp and delete them. Note that this will work
incorrectly if there are any filenames containing newlines or spaces.
find /tmp -name core -type f -print | xargs /bin/rm -f
49
2. EXAMPLES OF SCRIPTS
2. Examples of scripts
2.1
Send SMS
Send incoming SMS to the email.
Startup Script:
EMAIL=john.doe@email.com
cat > /var/scripts/sms << EOF
#!/bin/sh
/usr/bin/email -t \$EMAIL -s "Received SMS from \$2" -m "Authorized: \$1,
Text: \$3 \$4 \$5 \$6 \$7 \$8"
EOF
2.2
SMS command 1
Implementation of a new SMS command "IMPULSE", which activates binary output OUT0
for 5 seconds. SMS will be processed, if it comes from one of three numbers defined on the
web interface or phone number +420123456789.
Startup Script:
PHONE=+420123456789
cat > /var/scripts/sms << EOF
#!/bin/sh
if [ "\$1" = "1" ] || [ "\$2" = "$PHONE" ]; then
if [ "\$3" = "IMPULSE" ]; then
/usr/bin/io set out0 1
sleep 5
/usr/bin/io set out0 0
fi
fi
EOF
50
2. EXAMPLES OF SCRIPTS
2.3
SMS command 2
This script implements a new SMS command "PPP", which sets item Network type, Default
SIM card and Backup SIM card. PPP command has the following structure:
PPP <AUTO/GPRS/UMTS> <1/2>
The first parameter sets network type. If the second parameter equals 1, Default SIM card
will be set to primary SIM card. If this parameter equals 2, Default SIM card will be set to
secondary SIM card.
Startup Script:
cat > /var/scripts/sms << EOF
STARTUP=#!/bin/sh
if [ "\$1" = "1" ]; then
if [ "\$3" = "PPP" ]; then
if [ "\$4" = "AUTO" ]; then
sed -e "s/\(PPP_NETTYPE=\).*/\10/" -e "s/\(PPP_NETTYPE2=\).*/\10/" -i
/etc/settings.ppp
elif [ "\$4" = "GPRS" ]; then
sed -e "s/\(PPP_NETTYPE=\).*/\11/" -e "s/\(PPP_NETTYPE2=\).*/\11/" -i
/etc/settings.ppp
elif [ "\$4" = "UMTS" ]; then
sed -e "s/\(PPP_NETTYPE=\).*/\12/" -e "s/\(PPP_NETTYPE2=\).*/\12/" -i
/etc/settings.ppp
fi
if [ "\$5" = "1" ]; then
sed -e "s/\(PPP_DEFAULT_SIM=\).*/\11/" -e "s/\(PPP_BACKUP_SIM=\).*/\12/"
-i /etc/settings.ppp
elif [ "\$5" = "2" ]; then
sed -e "s/\(PPP_DEFAULT_SIM=\).*/\12/" -e "s/\(PPP_BACKUP_SIM=\).*/\11/"
-i /etc/settings.ppp
fi
reboot
fi
fi
EOF
51
2. EXAMPLES OF SCRIPTS
2.4
Send information email 1
Send information email about establishing of PPP connection.
Up Script:
EMAIL=john.doe@email.com
/usr/bin/email -t $EMAIL -s "Router has established PPP connection.
IP address: $4"
2.5
Send information SMNP trap 1
Send information SNMP trap about establishing of PPP connection.
Up Script:
SNMP_MANAGER=192.168.1.2
/usr/bin/snmptrap -g 3 $SNMP_MANAGER
2.6
Send information email 2
Send information email about switch binary input BIN0.
Startup Script:
EMAIL=john.doe@email.com
MESSAGE="BIN0 is active"
while true
do
/usr/bin/io get bin0
VAL=$?
if [ "$VAL" != "$OLD" ]; then
[ "$VAL" = "0" ] && /usr/bin/email -t $EMAIL -s "$MESSAGE"
OLD=$VAL
fi
sleep 1
done
52
2. EXAMPLES OF SCRIPTS
2.7
Send information SMNP trap 2
Send information SNMP trap about change state of binary input BIN0.
Startup Script:
SNMP_MANAGER=192.168.1.2
while true
do
/usr/bin/io get bin0
VAL=$?
if [ "$VAL" != "$OLD" ]; then
/usr/bin/snmptrap $SNMP_MANAGER 1.3.6.1.4.1.30140.2.3.1.0 u $VAL
OLD=$VAL
fi
sleep 1
done
2.8
Automatic reboot
Automatic reboot at the definition time. (23:55)
Startup Script:
echo "55 23 * * * root /sbin/reboot" > /etc/crontab
service cron start
53
2. EXAMPLES OF SCRIPTS
2.9
Switch between WAN and PPP
Switching between WAN and PPP. PPP connection is active, if PING on the defined IP
address does not pass through.
Startup Script:
WAN_PING=192.168.2.1
WAN_GATEWAY=192.168.2.1
WAN_DNS=192.168.2.1
. /etc/settings.eth
/sbin/route add $WAN_PING gw $WAN_GATEWAY
/sbin/iptables -t nat -A PREROUTING -i eth1 -j napt
/sbin/iptables -t nat -A POSTROUTING -o eth1 -p ! esp -j MASQUERADE
LAST=1
while true
do
ping -c 1 $WAN_PING
PING=$?
if [ $PING != $LAST ]; then
LAST=$PING
if [ $PING = 0 ]; then
/etc/init.d/ppp stop
sleep 3
/sbin/route add default gw $WAN_GATEWAY
echo "nameserver $WAN_DNS" > /etc/resolv.conf
/usr/sbin/conntrack -F
/etc/scripts/ip-up - - - $ETH2_IPADDR
else
/etc/scripts/ip-down - - - $ETH2_IPADDR
/usr/sbin/conntrack -F
/sbin/route del default gw $WAN_GATEWAY
/etc/init.d/ppp start
fi
fi
sleep 1
done
54
2. EXAMPLES OF SCRIPTS
2.10
Add more MAC addresses reservation to DHCP server
At first, it is necessary to edit eth file (/etc/rc.d/init.d/eth) in a way that is illustrated below
(marked lines).
#!/bin/sh
. /etc/settings
. /etc/$PROFILE/settings.eth
. /etc/$PROFILE/settings.ppp
. /root/DHCP_MAC
case "$1" in
start|restart)
echo -n "Setting up network: "
..
.
fi
if [ "$ETH_DHCP_STAT_ENABLED" = "1" ]; then
[ -n "$ETH_DHCP_STAT_MAC1" ] && [ -n "$ETH_DHCP_STAT_IPADDR1" ] && HOST1="\\nhost 1
{ hardware ethernet $ETH_DHCP_STAT_MAC1; fixed-address $ETH_DHCP_STAT_IPADDR1; }"
[ -n "$ETH_DHCP_STAT_MAC2" ] && [ -n "$ETH_DHCP_STAT_IPADDR2" ] && HOST2="\\nhost 2
{ hardware ethernet $ETH_DHCP_STAT_MAC2; fixed-address $ETH_DHCP_STAT_IPADDR2; }"
[ -n "$ETH_DHCP_STAT_MAC3" ] && [ -n "$ETH_DHCP_STAT_IPADDR3" ] && HOST3="\\nhost 3
{ hardware ethernet $ETH_DHCP_STAT_MAC3; fixed-address $ETH_DHCP_STAT_IPADDR3; }"
[ -n "$ETH_DHCP_STAT_MAC4" ] && [ -n "$ETH_DHCP_STAT_IPADDR4" ] && HOST4="\\nhost 4
{ hardware ethernet $ETH_DHCP_STAT_MAC4; fixed-address $ETH_DHCP_STAT_IPADDR4; }"
[ -n "$ETH_DHCP_STAT_MAC5" ] && [ -n "$ETH_DHCP_STAT_IPADDR5" ] && HOST5="\\nhost 5
{ hardware ethernet $ETH_DHCP_STAT_MAC5; fixed-address $ETH_DHCP_STAT_IPADDR5; }"
[ -n "$ETH_DHCP_STAT_MAC6" ] && [ -n "$ETH_DHCP_STAT_IPADDR6" ] && HOST6="\\nhost 6
{ hardware ethernet $ETH_DHCP_STAT_MAC6; fixed-address $ETH_DHCP_STAT_IPADDR6; }"
[ -n "$ETH_DHCP_STAT_MAC7" ] && [ -n "$ETH_DHCP_STAT_IPADDR7" ] && HOST7="\\nhost 7
{ hardware ethernet $ETH_DHCP_STAT_MAC7; fixed-address $ETH_DHCP_STAT_IPADDR7; }"
[ -n "$ETH_DHCP_STAT_MAC8" ] && [ -n "$ETH_DHCP_STAT_IPADDR8" ] && HOST8="\\nhost 8
{ hardware ethernet $ETH_DHCP_STAT_MAC8; fixed-address $ETH_DHCP_STAT_IPADDR8; }"
[ -n "$ETH_DHCP_STAT_MAC9" ] && [ -n "$ETH_DHCP_STAT_IPADDR9" ] && HOST9="\\nhost 9
{ hardware ethernet $ETH_DHCP_STAT_MAC9; fixed-address $ETH_DHCP_STAT_IPADDR9; }"
..
.
fi
echo -e "option routers $ETH_IPADDR;" \
"\\noption domain-name-servers $ETH_IPADDR;" \
"\\ndefault-lease-time $ETH_DHCP_LEASE_TIME;" \
"\\nmax-lease-time 86400;" \
"\\nsubnet $ETH_NETWORK netmask $ETH_NETMASK { $POOL }" \
"$HOST1$HOST2$HOST3$HOST4$HOST5$HOST6$HOST7$HOST8$HOST9" > /var/dhcp/dhcpd.conf
touch /var/dhcp/dhcpd.leases
/usr/sbin/dhcpd -q -cf /var/dhcp/dhcpd.conf -lf /var/dhcp/dhcpd.leases $ETH_IFNAME
2> /dev/null &
if [ $? = 0 ]; then echo "done"; else echo "failed"; fi
exit 0
55
2. EXAMPLES OF SCRIPTS
Create a file named DHCP_MAC and copy it to folder /root/. It is possible to edit this file
(/root/DHCP_MAC) as you need (MAC addresses and IP addresses). Finally, reboot router or
press Apply buton on LAN page in the web interface of your router.
Example of DHCP_MAC file:
ETH_DHCP_STAT_MAC7=00:0A:14:80:92:2F
ETH_DHCP_STAT_IPADDR7=192.168.1.55
ETH_DHCP_STAT_MAC8=00:0A:14:12:34:56
ETH_DHCP_STAT_IPADDR8=192.168.1.11
ETH_DHCP_STAT_MAC9=00:0A:14:F0:92:6A
ETH_DHCP_STAT_IPADDR9=192.168.1.71
56
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising