SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

Monday, May 25, 2009

Debian / Ubuntu Linux Setting a Default Gateway

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.

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.254
OR
$ sudo ip route add default via 192.168.1.254

route command to set a default router to 192.168.1.254

Login as the root and type:
# route add default gw 192.168.1.254
OR
$ sudo route add default gw 192.168.1.254

Save routing information to a configuration file /etc/network/interfaces

Open /etc/network/interfaces file
# vi /etc/network/interfaces
OR
$ sudo vi /etc/network/interfaces
Find eth0 or desired network interface and add following option
gateway 192.168.1.254
Save and close the file. Restart networking:
# /etc/init.d/networking restart
OR
$ sudo /etc/init.d/networking restart


Source : http://www.cyberciti.biz/faq/howto-debian-ubutnu-set-default-gateway-ipaddress/

No comments:

Post a Comment