EdgeRouter OS cli cheatsheet

These are my frequently referenced EdgeRouter OS cli commands for EdgeRouter Lite (ERL).

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
$> rollback ?          # shows versions
$> rollback 2          # reboot and revert to a previous version

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

DNS MANAGEMENT

(assuming 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
# (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 CF DDNS in edgerouter
# NEED TO TEST
$> 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"
comments powered by Disqus