This tutorial would help you configure a static ip address for your linux machine.Static ips are used for a lot of purposes like port forwarding etc . Especially in the case of Ubuntu intrepid , this can be helpful as there seem to be some bug while setting up static ip via the Network Manager (GUI).So you could setup static ip by manually editing the /etc/network/interfaces file.Here's how you go about doing this :

Firstly, You need to know which interface you are dealing with, i.e.for which interface you need to create a static ip.So lets say you want to setup a static ip 192.168.1.10 and your gateway would be your router ip which is 192.168.1.1 .. Now say you want to apply this static ip to the interface eth0 . So here's what you do :

Step 1 : Go to the Terminal(Applications->Accessories->Terminal)
Step 2 : Then type sudo gedit /etc/network/interfaces
Step 3 : Now the interfaces file should open on gedit.
Step 4 : Now look for the line
iface eth0 inet dhcp

and replace it with

iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1


Step 5 : Save changes and close the file
Step 6 : Now Back in your terminal type sudo /etc/init.d/networking restart
Step 7 : Then type sudo ifdown eth0
Step 8 : Then type sudo ifup eth0
Step 9 : You should now have the static ip 192.168.1.10 for your interface eth0.

3 comments

Anonymous said... @ July 27, 2009 at 3:48 PM

now look for the line... iface eth0 inet dhcp

its not there.
only auto lo
iface lo inet loopback

Prash Babu said... @ July 28, 2009 at 7:07 AM

If it isnt there , you could add the line , if eth0 is the interface you wish to add a static ip address to.. but its better off doing it via the network manager http://www.prash-babu.com/2009/01/how-to-setup-static-ip-in-ubuntu.html

Abhijeet said... @ November 25, 2010 at 6:10 AM

Hi Prashant,
U made my day. I don't have words to admire your work.
After googling & binging i was unable to set my n/w for many days. thankx to u & ur posts. Its working like makhkhan now. :). I own u party. I will be coming back often to see ur tips.
1 suggestion : Add more keywords to ur pages so they come at top in search results.

Post a Comment