The Command Line Interface (CLI) offers a unified control interface to the router and can be used to get/set configuration parameters, apply updates, restart services or perform other system tasks.
The CLI should be started using cli -i command from system shell or when logging as root user. A list of available commands can be displayed by running cli -l. It will be started automatically in interactive mode when logging in as admin user.
$ cli Name: cli (Command Line Utility) Usage: [-ilvh] <command>
~ $ cli -i MIDGE Command Line Interface (version 0.2) (C) Copyright RACOM s.r.o, Czech Republic Enter 'help' for a list of available commands or hit the TAB key for auto-completion. Ready to serve. >
The CLI supports the TAB completion, that is expanding entered words or fragments by hitting the TAB key at any time. This applies to commands but also to arguments and generally offers a convenient way for working on the shell.
Please note that each CLI session will perform an automatic logout as
soon as a certain time of inactivity (10 minutes by default) have been
reached. It can be turned off by the command
The CLI can be exited by running
When operating the
CLI in interactive mode, each
entered command will be executed by the
RETURN key. You can
Right keys to move the current
point between entered characters or use the
Down keys to search the history of entered commands. Pressing
CTRL-c twice or
CTRL-d on an empty command line
will exit the
|CTRL-a||Move to the start of the current line.|
|CTRL-e||Move to the end of the line.|
|CTRL-f||Move forward a character.|
|CTRL-b||Move back a character.|
|ALT-f||Move forward to the end of the next word.|
|ALT-b||Move back to the start of the current or previous word.|
|CTRL-l||Clear the screen leaving the current line at the top of the screen, with an argument given refresh the current line without clearing the screen.|
|CTRL-p||Fetch the previous command from the history list, moving back in the list.|
|CTRL-n||Fetch the next command from the history list, moving forward in the list.|
|ALT-<||Move to the first line in the history.|
|ALT->||Move to the end of the input history.|
|CTRL-r||Search backward starting at the current line and moving up through the history.|
|CTRL-s||Session will be frozen.|
|CTRL-q||Reactivate frozen session.|
|CTRL-d||Delete character at point or exit CLI if at the beginning of the line.|
|CTRL-t||Drag the character before point forward moving point forward as well. If point is at the end of the line, then this transposes the two characters before point.|
|ALT-t||Drag the word before point past the word after point, moving point over that word as well. If point is at the end of the line, this transposes the last two words on the line.|
|CTRL-k||Delete the text from point to the end of the line.|
|CTRL-y||Yank the top of the deleted text into the buffer at point.|
Please note, that it can be required to apply quotes (“) when entering commands with arguments containing whitespaces.
The following sections are trying to explain the available commands.
help command can be used to get the list of
available commands when called without arguments, otherwise it will print
the usage of the specified command.
> help Usage: help [<command>] Available commands: get Get config parameters set Set config parameters update Update system facilities cert Manage keys and certificates status Get status information scan Scan networks send Send message, mail, techsupport or ussd restart Restart service debug Debug system reset Reset system facilities reboot Reboot system shell Run shell command help Print help for command no-autologout Turn off auto-logout history Show command history exit Exit
get command can be used to get
configuration values (not the current values).
get -h Usage: get [-hsvfc] <parameter> [<parameter>..] Options: -s generate sourceable output -v validate config parameter -f get factory default rather than current value -c show configuration sections
See the following example for reading configuration DIO values:
> get dio.out1 dio.out1=on > get dio.out2 dio.out2=on
set command can be used to set
> set -h Usage: set [-hv] <parameter>=<value> [<parameter>=<value>..] Options: -v validate config parameter
See the following example for setting configuration digital output values. Both values will be “off” and both values will be also “off” after the next start-up procedure.
> set dio.out1=off > set dio.out2=off
The update command can be used to perform various system updates.
> update -h Usage: update [-hfrsnbv] <software|config|firmware|license|sshkeys> <URL> Options: -r reboot after update -f force update -n don't reset missing config values with factory defaults -b update backup config -s show update status Available update targets: software Perform software update firmware Perform module firmware update config Update configuration license Update licenses sshkeys Install SSH authorized keys
The update command can be used to manage keys and certificates.
> cert -h Usage: cert [-h] [-p phrase] <operation> <cert> [<url>] Possible operations: install install a certificate from specified URL create create a certificate locally enroll enroll a certificate via SCEP erase erase an installed certificate view view an installed certificate
The status command can be used to get various status information of the system.
> status -h Usage: status [-hs] <section> Options: -s generate sourceable output Available sections: summary Short status summary info System and config information config Current configuration system System information configuration Configuration information license License information storage Storage wwan WWAN module status wlan WLAN module status gnss GNSS (GPS) module status eth Ethernet interface status lan LAN interface status wan WAN interface status openvpn OpenVPN connection status ipsec IPsec connection status pptp PPTP connection status gre GRE connection status dialin Dial-In connection status mobileip MobileIP status dio Digital IO status audio Audio module status can CAN module status uart UART module status redundancy Redundancy status sms SMS status firewall Firewall status qos QoS status neigh Neighborhood status location Current location users Active users hotspot Hotspot status bgp BGP status ospf OSPF status
In the following example, we read the current DIO values. Remember that the current states do not correspond to the configuration values set with “set dio.out” commands.
> status dio === DIGITAL IO INFORMATION === IN1: off IN2: on OUT1: on OUT2: off
The scan command can be used to scan the mobile network for the possible networks. Note that the active mobile connection will be deactivated during the scan procedure.
> scan -h Usage: scan [-hs] <interface> Options: -s generate sourceable output Available interfaces: Mobile1 (wwan0)
See the example below:
> scan -s Mobile1 NETWORK1_NAME="EUROTEL - CZ" NETWORK1_LAI="23002" NETWORK1_RAT="GSM" NETWORK1_SERVICE="CSD" NETWORK1_STATUS="Current" NETWORK2_NAME="vodafone CZ" NETWORK2_LAI="23003" NETWORK2_RAT="GSM" NETWORK2_SERVICE="CSD" NETWORK2_STATUS="Forbidden" NETWORK3_NAME="T-Mobile CZ" NETWORK3_LAI="23001" NETWORK3_RAT="GSM" NETWORK3_SERVICE="CSD" NETWORK3_STATUS="Forbidden" NETWORK_COUNT="3"
The send command can be used to send a message via E-Mail/SMS to the specified address or phone number.
> send -h Usage: send [-h] <type> <dest> <msg> Options: <type> type of message to be sent (mail, sms, techsupport, ussd) <dest> destination of message (mail-address, phone-number or argument) <msg> message to be sent
The restart command can be used to restart system services.
> restart -h Usage: restart [-h] <service> Available services: configd Configuration daemon dnsmasq DNS/DHCP server dropbear SSH server firewall Firewall and NAPT gpsd GPS daemon gre GRE connections ipsec IPsec connections lighttpd HTTP server link-manager WAN links network Networking openvpn OpenVPN connections pptp PPTP connections qos QoS daemon smsd SMS daemon snmpd SNMP daemon surveyor Supervision daemon syslog Syslog daemon telnet Telnet server voiced Voice daemon vrrpd VRRP daemon wlan WLAN interfaces wwan-manager WWAN manager
The debug command can be used to display individual daemons debugging output.
> debug -h Usage: debug [-hr] [-l <level>] <target> Options: -l <level> set debug level -r reset debug level Available debug targets: system scripts ubxd rrsp11 rrsp12 configd watchdog swupdate wwan-manager led-manager event-manager link-manager wwanmd surveyor mobile-node home-agent voiced smsd sdkhost ser2net qosd gpsd rrsp2 rrsp21
The reset command can be used to reset the router back to factory defaults.
> reset -h Usage: reset [-h] [facility] Available reset facilities: factory Reset system to factory defaults statistics Reset link statistics
The reboot command can be used to reboot the router.
> reboot -h Usage: reboot [-h]
The shell command can be used to execute a system shell and run any arbitrary application.
> shell -h Usage: shell [-h] [<cmd>]
The history command displays the history of CLI commands entered on the unit.
> history 1 help 2 get -h 3 get dio.out1 4 set dio.out1=off 5 set dio.out2=off 6 set dio.out1=on 7 get dio.out1 8 get dio.out2 9 set -h
CLI-PHP, an HTTP front-end to the CLI application, can be used to configure and control the router remotely. It is enabled in factory configuration, thus can be used for deployment purposes, but disabled as soon as the admin account has been set up. The service can later be turned on/off by setting the cliphp.status configuration parameter:
> get cliphp.status cliphp.status=0 > set cliphp.status=1 > get cliphp.status cliphp.status=1
cliphp.status=0 Service is disabled cliphp.status=1 Service is enabled
This section describes the CLI-PHP interface for Version 2, the general usage (GET requests) is defined as follows:
Usage: http (s)://cli.php?<key1>=<value1>&<key2>=<value2>..<keyN>=< valueN> Available keys: output Output format ( html, plain ) usr Username to be used for authentication pwd Password to be used for authentication commandV Command to be executed arg0..arg31 Arguments passed to commands Notes: The commands correspond to CLI commands as seen by 'cli −l', the arguments (arg0..arg31) will be directly passed to the cli application Thus, an URL containing the following sequence: command=get&arg0=admin.password&arg1=admin.debug&arg2=admin.access will lead to cli being called as: $ cli get "admin.password" "admin.debug" "admin.access" It supports whitespaces but please be aware that any special characters in the URL must be specified according to RFC1738 (which usually done by common clients such as wget, lynx, curl). Response: The returned response will always contain a status line in the format: <return>: <msg> with return values of OK if succeeded and ERROR if failed. Any output from the commands will be appended Examples: OK: status command successful ERROR: authentication failed
Key usage: command=status[&arg0=<section>] Notes: Available sections can be retrieved by running command=status&arg0=−h. System status can be displayed without authentication. Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01&command= status&arg0=−h http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01&command= status&arg0=summary http://192.168.1.1/cli.php?version=2&output=html&command=status
Key usage: command=get&arg0=<config−key>[&arg1=<config−key>..] Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=get&arg0=config.version http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=get&arg0=openvpn.status&arg1=snmp.status&arg2=ipsec.status
Key usage: command=set&arg0=<config−key>&arg1=<config−value>[&arg2=<config −key>&arg3=<config−value>..] Notes: In contrast to the other commands, this command requires a set of tuples because of the reserved '=' char, i.e. [arg0=key0, arg1=val0], [arg2=key1, arg3=val1], [arg4=key2, arg5=val2], etc Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=set&arg0=snmp.status&arg1=1 http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=set&arg0=snmp.status&arg1=0&arg2=openvpn.status&arg3=1
Key usage: command=restart&arg0=<service> Notes: Available services can be retrieved by running 'command=restart&arg0=−h' Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=restart&arg0=−h http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=restart&arg0=link−manager
Key usage: command=reboot Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01&command=reboot
Key usage: command=reset Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01&command=reset
Key usage: command=update&arg0=<facility>&arg1=<URL> Notes: Available facilities can be retrieved by running 'command=update &arg0=−h' Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=127 admin01&command=update&arg0=software&arg1=tftp://192.168.1.254/latest http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=update&arg0=config&arg1=tftp://192.168.1.254/user− config.zip http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd= admin01&command=update&arg0=license&arg1=http://192.168.1.254/xxx.lic
Key usage: command=send&arg0=sms&arg1=<number>&arg2=<text> Notes: The phone number has to be specified in international format such as +123456789 including a leading plus sign (which can be encoded with \%2B). The SMS daemon must be properly configured prior to using that function. Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01 &command=send&arg0=sms&arg1=\%2B123456789&arg2=test
Key usage: command=send&arg0=mail&arg1=<address>&arg2=<text> Notes: The address has to be a valid E−Mail address such as firstname.lastname@example.org (the at−sign can be encoded with \%40). The E−Mail client must be properly configured prior to using that function. Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01& command=send&arg0=mail&arg1=abc\%40abc . com&arg2=test
Key usage: command=send&arg0=techsupport&arg1=stdout command=send&arg0=techsupport&arg1=<address>&arg2=<subject> Notes: The address has to be a valid E−Mail address such as email@example.com (the at−sign can be encoded with \%40) . The E−Mail client must be properly configured prior to using that function. In case of stdout , the downloaded techsupport file will be called 'download'. Examples: http://192.168.1.1/cli.php?version=2&output=mime&usr=admin&pwd=admin01& command=send&arg0=techsupport&arg1=stdout http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01& command=send&arg0=techsupport&arg1=abc\%40abc.com&arg2=subject
Key usage: command=send&arg0=ussd&arg1=<card>&arg2=<code> Notes: The argument card specifies the card module index (e.g. 0 for wwan0 ). The USSD code can consist of digits , plus signs , asterisks (can be encoded with \%2A) and dashes (can be encoded with \%23) . Examples: http://192.168.1.1/cli.php?version=2&output=html&usr=admin&pwd=admin01& command=send&arg0=ussd&arg1=0&arg2=\%2A100\%23