In order to change the gateway in an Unifi device via CLI, you should first look at the current routes.
route -e
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.20.0 * 255.255.255.0 U 0 0 0 eth0
Next, we should delete the default route.
route del default
Finally, we should register the new default route as the gateway. In my case the gateway is at 192.168.20.1
.
route add default gw 192.168.20.1 eth0
If we check again the curent routes, here is the result:
route -e
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.20.1 0.0.0.0 UG 0 0 0 eth0
192.168.20.0 * 255.255.255.0 U 0 0 0 eth0
Top comments (0)