uncategorized

How to Migrate From an Existing UBNT EdgeRouter to a USG

So you’ve been secretly oogling the shiny USG device and the been frustrated with the Controller software and blank graphics like me? I can verify that the migration process is quite straight forward, with some manual lifting involved.

The process is like this:

  1. Dump you existing ERL configuration to a textfile, save it on your computer and never touch the ERL again.
  2. Hook up your new USG to your computer via the LAN port.
  3. Move your new configuration over to the new device, such as external WAN ip settings and local LAN settings, including DHCP static leases etc. You need to also delete any existing conflicting settings, or the new/changed settings won’t take.
  4. commit, save, and reboot
  5. specify the unifi controller adoption url if neccessary and discover and adopt the new device via the controller software

Dump existing ERL configuration to a text file

admin@erl:~$ show configuration commands > config.txt

The commands are ready to be copy & pasted into your new device. As the device is preconfigured with some conflicting settings, it is not possible to run this as a script, as you must delete existing settings before committing.

Connect new device to local computer

Attach your local computer to the LAN port on the USG. The USG will serve out DHCP address in the 192.168.1.1/24 range and the router default adress is 192.168.1.1.

Login

Login using default settings ubnt/ubnt

Script settings

You could script settings (which I tried at first) but since existing configuration clashes with the new updated ones, you would first need to prep the script with delete commands. This would be usable if I had many devices but since I only have one, its easier to copy paste relevant lines directly.

chmod +x erl_config.sh

When you execute, the script will fail to commit due to conflicting changes.

Some settings will take though

Set static LAN ip address

The LAN port is given a static ip.

configure
edit interfaces ethernet eth1
set address 10.0.1.1/24
delete address 192.168.1.1/24
commit

You will loose connectivity at this point. Do not reboot the device as the settings will not survive until you save.

Update your local computer IP settings to match your new LAN network.

Update known_hosts

If you like me replace an existing device, chances are you need to update the SSH configuration.

nano ~/.ssh/known_hosts

Set WAN configuration

configure
show interfaces
set interfaces ethernet eth0 address *you wan ip/size*
show interfaces ethernet eth0

show service dhcp-server

delete service dhcp-server

set service dhcp-server shared-network-name LAN1 authoritative disable
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 default-router 10.0.1.1
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 dns-server 10.0.1.9
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 dns-server 10.0.1.6
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 domain-name rylander.io
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 lease 86400
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 start 10.0.1.100 stop 10.0.1.199
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping Familjens-iPad ip-address 10.0.1.151
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping Familjens-iPad mac-address '2c:1f:23:23:d7:e6'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping FamiljensiPad2 ip-address 10.0.1.170
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping FamiljensiPad2 mac-address '74:e1:b6:b7:69:85'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping FamiljensiPhone ip-address 10.0.1.176
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping FamiljensiPhone mac-address 'c0:9f:42:a4:68:e8'
...
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping VeraLite ip-address 10.0.1.104
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping VeraLite mac-address '00:0e:8f:df:f2:79'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping XboxOne ip-address 10.0.1.116
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping XboxOne mac-address 'c0:33:5e:d8:e1:79'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping kidsPad ip-address 10.0.1.122
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping kidsPad mac-address 'a8:88:08:be:9c:d5'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping photon-nginx-proxy ip-address 10.0.1.32
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping photon-nginx-proxy mac-address '00:50:56:94:21:8b'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping tinboy ip-address 10.0.1.124
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 static-mapping tinboy mac-address 'c8:2a:14:2d:f3:dd'
set service dhcp-server shared-network-name LAN1 subnet 10.0.1.0/24 unifi-controller 10.0.1.21

Adopt the USG to the controller

Since my internal DNS isn’t used by the router, I need to map a hostname to an ip. The default mapping can be removed.

edit system static-host-mapping

Set local host mapping

set host-name unifi.rylander.io inet 10.0.1.21

Verify connection to controller and initiate adoption

ping unifi.rylander.io

If the controller can’t find the USG device you can inform the controller by setting the inform url.

unifi set-inform [http://unifi.rylander.io:18080/inform](http://unifi.rylander.io:18080/inform)

As I had forgot to port forward the adoption port from my dockerized controller, this step was a bit frustrating at first. Note the screenshot is misleading as a result. I ended up forwarding the dockerized controller port 8080 to the Synology host port 18080 (and remembering why I didn’t forward port 8080 directly).

Check status

unifi info

Pending adoption

Remember to actually click the “Adopt” link in the controller UI.

Then you also need to go back to the SSH session and reissue the command to make it stick.

Adopting

Provisioning

Verify settings

The controller will preserve existing settings