Q. How do I configure default router or gateway IP address under Ubuntu Linux / Debian Linux? How do I change default router / gateway IP under Ubuntu Linux?
A. You can easily configure default router or gateway IP address under Debian / Ubuntu Linux by editing /etc/network/interfaces network configuration file. This file defines how you configure and how your system is connected to the network.
Ubuntu Linux Configure Default Gateway
Open /etc/network/interfaces file:
$ sudo vi /etc/network/interfaces
Set gateway using following syntax:
For example, set gateway to 192.168.1.254, enter:
At the end it should look like as follows:
iface eth0 inet static
Save and close the file. Restart networking:
$ sudo /etc/init.d/networking restart
Verify new routing is working, enter:
$ ping 192.168.1.254
$ route -n
$ host google.com