Image credit: Unsplash

EdgeRouter OS CLI Cheatsheet

My goto commands when using my Ubiquiti ERL

Image credit: Unsplash

EdgeRouter OS CLI Cheatsheet

My goto commands when using my Ubiquiti ERL

These are my frequently used EdgeRouter OS commands for Ubiquiti’s EdgeRouter Lite (ERL).

You can enable SSH from the GUI (web interface) under System, check the box to enable SSH server. Only enable SSH if you fully understand the risk of doing so.

Basics

# access ssh
ssh <admin username>@<EdgeRouterIP>

# enter editing mode
configure

# saving changes
# NOTE: if you did not save, a reboot should roll back the changes.
commit ; save
# or
commit ; save ; exit

# use 'exit discard' to discard the changes and exit.

# rolling back changes
# shows versions
rollback ?
# reboot and revert to a previous version
rollback 2

# NOTE: swap 'set' with 'delete' to delete the change

DNS Management

This assumes your ERL/ERX is providing DHCP and is listed as DNS 1.

Set A records

# set a static fqdn to an IP
set system static-host-mapping host-name <test.testdomain.com> inet <1.1.1.1>
commit
# optional 'save'
exit

# to view mappings (in config mode)
show/delete system static-host-mapping

# set a wildcard DNS name for *.example.com
set service dns forwarding options 'address=/example.com/172.16.0.2'

Increase DNS cache on router

# optional 'show dns forwarding statistics'

# set cache to 1000
set service dns forwarding cache-size 1000

Set DNS forwarders

# optional 'show dns forwarding nameservers'

# follow strict order
set service dns forwarding options strict-order

# set DNS forwarders to cloud flare
set service dns forwarding name-server 1.1.1.1
set service dns forwarding name-server 1.0.0.1

Add Cloudflare DDNS provider

Set Cloudflare to handle your dynamic IP.

# set CF DDNS in edgerouter
set service dns dynamic interface eth0 service custom-cloudflare host-name www.yoursite.com
set service dns dynamic interface eth0 service custom-cloudflare login your_cloudflare_email
set service dns dynamic interface eth0 service custom-cloudflare password your_cloudflare_global_API_key
set service dns dynamic interface eth0 service custom-cloudflare protocol cloudflare
set service dns dynamic interface eth0 service custom-cloudflare server www.cloudflare.com
set service dns dynamic interface eth0 service custom-cloudflare options "zone=yoursite.com"
Avatar
Jim Angel
Everything Computers & Cloud

I’m a Cloud Administrator at General Motors. My primary focus is making Kubernetes easier to use. Part of that includes contributing to open source Kubernetes.

comments powered by Disqus