This article is not written by me, the credit goes to the author who wrote this.
Q. How do I setup a default gateway on Debian or Ubuntu Linux? My router IP is 192.168.1.254 and I'd like to setup this as a default gateway for Debian Linux.
A. You can use command line tool such as
a] ip command - show / manipulate routing, devices, policy routing and tunnels
b] route command - show / manipulate the IP routing table
c] Save routing information to a configuration file so that after reboot you get same default gateway.
OR
OR
OR
Find eth0 or desired network interface and add following option
Save and close the file. Restart networking:
OR
Continue Reading...
Q. How do I setup a default gateway on Debian or Ubuntu Linux? My router IP is 192.168.1.254 and I'd like to setup this as a default gateway for Debian Linux.
A. You can use command line tool such as
a] ip command - show / manipulate routing, devices, policy routing and tunnels
b] route command - show / manipulate the IP routing table
c] Save routing information to a configuration file so that after reboot you get same default gateway.
ip command to set a default router to 192.168.1.254
Login as the root and type:# ip route add default via 192.168.1.254OR
$ sudo ip route add default via 192.168.1.254route command to set a default router to 192.168.1.254
Login as the root and type:# route add default gw 192.168.1.254OR
$ sudo route add default gw 192.168.1.254Save routing information to a configuration file /etc/network/interfaces
Open /etc/network/interfaces file# vi /etc/network/interfacesOR
$ sudo vi /etc/network/interfacesFind eth0 or desired network interface and add following option
gateway 192.168.1.254Save and close the file. Restart networking:
# /etc/init.d/networking restartOR
$ sudo /etc/init.d/networking restartSource : http://www.cyberciti.biz/faq/howto-debian-ubutnu-set-default-gateway-ipaddress/