Page 41 / 58 Scroll up to view Page 36 - 40
38
Appendix A: Command Line Interface
EdgeRouter
Lite User Guide
Ubiquiti Networks, Inc.
Appendix A: Command Line
Interface
Overview
The Command Line Interface (CLI) is available if you
need to configure and monitor advanced features on the
EdgeRouter or prefer configuration by command line. The
CLI provides direct access to standard Linux tools and shell
commands. This chapter explains how to access the CLI
and describes a basic set of frequently used commands.
Access the CLI
There are four methods you can use to access the CLI:
terminal emulator
Go to the following section,
Connect
to the Console Port
.
SSH
If you are using the console port, go to the
following section,
Connect to the Console Port
; otherwise,
go to
“Access Using SSH” on page 39
.
Telnet
If you are using the console port, go to the
following section,
Connect to the Console Port
; otherwise,
go to
“Access Using Telnet” on page 39
.
EdgeOS Configuration Interface
Go to
“Access Using
the EdgeOS Configuration Interface” on page 40
.
Connect to the Console Port
Instructions may vary slightly, depending on your specific
terminal emulator.
1.
Use a RJ45 to DB9, serial console cable, also known
as a rollover cable, to connect the
Console
port of the
EdgeRouter to your computer. (If your computer does
not have a DB9 port, then you will also need a DB9
adapter.)
Computer
Console
2. Follow the appropriate set of instructions:
terminal emulator
Go to the following section,
Access Using a Terminal Emulator
.
SSH
Go to
“Access Using SSH” on page 39
.
Telnet
Go to
“Access Using Telnet” on page 39
.
Access Using a Terminal Emulator
Instructions may vary slightly, depending on your specific
terminal emulator.
1.
Open the terminal emulator on your computer, and
configure it with the following serial port settings:
Baud rate
115200
Stop bits
8
Parity
1
Flow control
NONE
2. Select
Serial
as the connection type.
3. Click
Open
to connect to the EdgeRouter.
4. At the
ubnt login
prompt, enter the username (the
default is
ubnt
).
5. At the
Password
prompt, enter the password (the
default is
ubnt
).
6.
For help with commands, you can either press the
?
key
or enter
show
and press the
?
key.
Note:
To enhance security, we recommend that you
change the default login using at least one of the
following options:
Set up a new user account (preferred option).
For details, go to
“Remove the Default User
Account” on page 42
.
• Change the default password of the
ubnt
login.
Use the
set
command as detailed in
“Remove the
Default User Account” on page 42
.
Page 42 / 58
39
Appendix A: Command Line Interface
EdgeRouter
Lite User Guide
Ubiquiti Networks, Inc.
Access Using SSH
SSH is enabled by default.
1.
Open the SSH client on your computer.
2. At the
login
prompt, enter:
ssh
<username>
@<
hostname>
The defaults are
ubnt
for the username and
192.168.1.1
for the hostname. You can also enter a domain name
instead of an IP address for the hostname.
Note:
Upon initial login, a host key will be
displayed. You will be asked to confirm that you
want to save the host key to the local database.
Click
Yes
to bypass this message in the future.
3. At the
Password
prompt, enter the password (the
default is
ubnt
).
4.
For help with commands, you can either press the
?
key
or enter
show
and press the
?
key.
Note:
To enhance security, we recommend that you
change the default login using at least one of the
following options:
Set up a new user account (preferred option).
For details, go to
“Remove the Default User
Account” on page 42
.
• Change the default password of the
ubnt
login.
Use the
set
command as detailed in
“Remove the
Default User Account” on page 42
.
Access Using Telnet
Telnet is disabled by default. To use Telnet, enable it on the
System
tab (see
“Telnet Server” on page 8
).
1.
Open the telnet client on your computer.
2. At the prompt, enter:
telnet
<
hostname>
The default is
192.168.1.1
for the hostname. You can
also enter a domain name instead of an IP address for
the hostname.
3. At the
login
prompt, enter the username (the default is
ubnt
).
4. At the
Password
prompt, enter the password (the
default is
ubnt
).
5.
For help with commands, you can either press the
?
key
or enter
show
and press the
?
key.
Note:
To enhance security, we recommend that you
change the default login using at least one of the
following options:
Set up a new user account (preferred option).
For details, go to
“Remove the Default User
Account” on page 42
.
• Change the default password of the
ubnt
login.
Use the
set
command as detailed in
“Remove the
Default User Account” on page 42
.
Page 43 / 58
40
Appendix A: Command Line Interface
EdgeRouter
Lite User Guide
Ubiquiti Networks, Inc.
Access Using the EdgeOS Configuration
Interface
Each tab of the EdgeOS interface contains CLI access.
1.
At the top right of the screen, click the
CLI
button.
2. The
CLI
window appears. At the
login
prompt, enter the
username (the default is
ubnt
).
3. At the
Password
prompt, enter the password (the
default is
ubnt
).
4.
For help with commands, you can either press the
?
key
or enter
show
and press the
?
key.
Note:
To enhance security, we recommend that you
change the default login using at least one of the
following options:
Set up a new user account (preferred option).
For details, go to
“Remove the Default User
Account” on page 42
.
• Change the default password of the
ubnt
login.
Use the
set
command as detailed in
“Remove the
Default User Account” on page 42
.
CLI Modes
Operational Mode
When you first log in, the CLI is in operational mode. Press
the
?
key to view the available commands.
ubnt@ubnt:~$
Note:
The question mark does not display onscreen.
add
delete
ping6
reset
terminal
clear
disconnect
reboot
restart
traceroute
configure generate
release set
traceroute6
connect
initial-setup remove
show
undebug
copy
no
rename
shutdown
debug
ping
renew
telnet
Enter
show
and press the
?
key to view the settings that
you have configured.
ubnt@ubnt:~$ show
arp
flow-accounting nat
tech-support
bridge
hardware
ntp
ubnt
configuration history
openvpn
users
date
host
pppoe-server version
debugging
incoming
queueing
vpn
dhcp
interfaces
reboot
vrrp
dhcpv6
ip
route-map
webproxy
disk
ipv6
shutdown
zebra
dns
lldp
snmp
file
log
system
firewall
login
table
For example, type
show interfaces
to display the
interfaces and their status information.
ubnt@ubnt:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down,
A - Admin Down
Interface
IP Address
S/L
Description
---------
----------
---
-----------
eth0
-
u/u
eth1
-
u/D
eth2
-
u/D
lo
127.0.0.1/8
u/u
To properly shut down the EdgeRouter, use the
shutdown
command.
ubnt@ubnt:~$ shutdown
WARNING:
Use the
shutdown
command to properly
shut down the EdgeRouter. An improper shutdown,
such as disconnecting the EdgeRouter from its
power supply, runs the risk of data corruption!
Page 44 / 58
41
Appendix A: Command Line Interface
EdgeRouter
Lite User Guide
Ubiquiti Networks, Inc.
Configuration Mode
To switch to configuration mode, use the
configure
command.
ubnt@ubnt:~$ configure
[edit]
ubnt@ubnt#
For the
show
,
set
, and
delete
commands, you can press the
?
key for help.
set ?
View the available commands.
show ?
View the settings that you have configured.
(Because configurations vary, the list you see will differ
from the sample list displayed below.)
delete ?
View the settings that you can delete.
Enter
show
and press the
?
key.
ubnt@ubnt# show
firewall
interfaces
protocol
service
system
[edit]
To display the available command completions, press the
tab
key.
Note:
The tab does not display onscreen.
ubnt@ubnt# show
Possible completions:
firewall
Firewall
interfaces
Network interfaces
protocols
Routing protocol parameters
service
Services
system
System parameters
The EdgeRouter uses three configurations:
Working
When you make changes to the working
configuration, they are not applied until you commit the
changes to the active configuration.
Active
When you commit changes to the active
configuration, they are applied; however, the changes
do not become part of the boot configuration until you
save the changes to the boot configuration.
Boot
When the EdgeRouter reboots, it loads the boot
configuration for use.
The following scenarios cover some of the most
commonly used commands:
• Configure an Interface (see below)
“Remove the Default User Account” on page 42
“Create a Firewall Rule” on page 42
“Manage the Configuration File” on page 45
Configure an Interface
To configure an interface, do the following:
Assign an IP address and subnet mask
• Enter a description
Use the
set
,
compare
,
commit
, and
save
commands.
To configure an interface, use the
set
command.
ubnt@ubnt:~$ configure
[edit]
To view the possible completions for the eth0 address,
enter
set interfaces ethernet eth0 address
and press the
?
key.
ubnt@ubnt# set interfaces ethernet eth0 address
Possible completions:
<x.x.x.x/x>
IP address and prefix length
<h:h:h:h:h:h:h:h/x>
IPv6 address and prefix length
dhcp
Dynamic Host Configuration Protocol
dhcpv6
Dynamic Host Configuration Protocol
for IPv6
[edit]
ubnt@ubnt# set interfaces ethernet eth0 address
10.1.1.80/23
[edit]
ubnt@ubnt# set interfaces ethernet eth0 description
“production LAN”
These changes affect the working configuration, not the
active configuration. To see what changes have been
made to the working configuration, use the
compare
command:
ubnt@ubnt# compare
[edit interfaces ethernet eth0]
+address 10.1.1.2/24
+description “production LAN”
[edit]
To make the changes active, use the
commit
command:
ubnt@ubnt# commit
[edit]
If you reboot the EdgeRouter, the changes will be lost. To
save these changes, use the
save
command to save the
active configuration to the boot configuration.
ubnt@ubnt# save
Saving configuration to ‘/config/config.boot’...
Done
[edit]
ubnt@ubnt# exit
exit
ubnt@ubnt:~$
ubnt@ubnt:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down,
A - Admin Down
Interface
IP Address
S/L
Description
---------
----------
---
-----------
eth0
10.1.1.80/23
u/u
production LAN
eth1
-
u/D
eth2
-
u/D
lo
127.0.0.1/8
::1/128
u/u
ubnt@ubnt:$ ping 10.1.0.1
PING 10.1.0.1 (10.1.0.1) 56(84) bytes of data.
64 bytes from 10.1.0.1: icmp_req=1 ttl=64 time=0.460 ms
64 bytes from 10.1.0.1: icmp_req=2 ttl=64 time=0.407 ms
^C
--- 10.1.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time
999 ms
rtt min/avg/max/mdev = 0.407/0.433/0.460/0.033 ms
Page 45 / 58
42
Appendix A: Command Line Interface
EdgeRouter
Lite User Guide
Ubiquiti Networks, Inc.
Remove the Default User Account
To remove the default user account, do the following:
• Create a new user
Log out of the default user account
Log in with the new user account
• Delete the default user account
Use the
set
,
commit
,
save
,
exit
, and
delete
commands.
ubnt@ubnt:~$ configure
[edit]
ubnt@ubnt:# set system login user admin1 authentication
plaintext-password admin1pass
[edit]
ubnt@ubnt:# commit
[edit]
ubnt@ubnt:# save
Saving configuration to ‘/config/config.boot’...
Done
[edit]
ubnt@ubnt:# exit
exit
ubnt@ubnt:~$ exit
logout
Welcome to Edge OS ubnt ttyS0
ubnt login: admin1
Password:
Linux ubnt 2.6.32.13-UBNT #1 SMP Fri Jun 8 09:48:31 PDT
2012 mips64
Welcome to EdgeOS
admin1@ubnt:~$ configure
[edit]
admin1@ubnt# delete system login user ubnt
[edit]
admin1@ubnt# commit
[edit]
admin1@ubnt# save
Saving configuration to ‘/config/config.boot’...
Done
[edit]
admin@ubnt# exit
exit
admin1@ubnt:~$
The plaintext password that you entered is converted to
an encrypted password.
admin1@ubnt:~$ configure
[edit]
admin1@ubnt# show system login
user admin1 {
authentication {
encrypted-password
$1$mv8ERQ1T$7xq/eUDwy/5And7nV.9r6.
plaintext-password
““
}
}
[edit]
admin1@ubnt# exit
exit
admin1@ubnt:~$
Create a Firewall Rule
To create a firewall rule, use the
set
or
edit
commands
(both methods are described below). In addition, use the
compare
,
discard
,
up
,
top
,
copy
, and
rename
commands.
Create a firewall rule using the full syntax:
ubnt@ubnt:~$ configure
[edit]
ubnt@ubnt# set firewall name TEST default-action drop
[edit]
ubnt@ubnt# set firewall name TEST enable-default-log
[edit]
ubnt@ubnt# set firewall name TEST rule 10 description
“allow icmp”
[edit]
ubnt@ubnt# set firewall name TEST rule 10 action accept
[edit]
ubnt@ubnt# set firewall name TEST rule 10 protocol icmp
[edit]
To display uncommitted changes, use the
compare
command:
ubnt@ubnt# compare
[edit firewall]
+name TEST {
+
default-action drop
+
enable-default-log
+
rule 10 {
+
action accept
+
description “allow icmp”
+
protocol icmp
+
}
+}
[edit]
To undo uncommitted changes, use the
discard
command:
ubnt@ubnt# discard
Changes have been discarded
[edit]
ubnt@ubnt# compare
No changes between working and active configurations
[edit]
To create the same firewall rule while reducing the amount
of repetition in the full syntax, use the
edit
command:
ubnt@ubnt# edit firewall name TEST
[edit firewall name TEST]
ubnt@ubnt#set default-action drop
[edit firewall name TEST]
ubnt@ubnt# set enable-default-log
[edit firewall name TEST]
ubnt@ubnt#edit rule 10
[edit firewall name TEST rule 10]

Rate

4.5 / 5 based on 2 votes.

Bookmark Our Site

Press Ctrl + D to add this site to your favorites!

Share
Top