Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active April 16, 2023 04:43
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Adding and removing static host mappings on EdgeRouter

Adding and removing static host mappings on EdgeRouter

Tested on a Ubiquiti EdgeRouter 4 with dnsmasq enabled for DHCP (and DNS) serving.

These operations can also be carried out in the EdgeRouter web gui with the "DNS host names" Wizard (click the "Wizards" tab and then select "DNS host names" to access).

To see all currently statically mapped hosts:

$ cat /etc/hosts

or, using the actual CLI:

$ configure
# show system static-host-mapping
# exit
$

To add a static host mapping and an alias:

$ configure
# set system static-host-mapping host-name test.example.com inet 10.0.1.24
# set system static-host-mapping host-name test.example.com alias test
# commit
# save
# exit
$

To add a couple of more aliases:

$ configure
# set system static-host-mapping host-name test.example.com alias test2.casalembo.com
# set system static-host-mapping host-name test.example.com alias test3.casalembo.com
# commit
# save
# exit
$

To remove static mapping and all aliases:

$ configure
# delete system static-host-mapping host-name test.example.com
# commit
# save
# exit
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment