Last Friday I upgraded my install from Ubuntu 7.04 to 8.10 Intrepid Ibex on my office workstation and I noticed that I was unable to assign static IP to the machine. After reboot the netmask was getting messed up and reset to 22. Look at this bug for more info.
So, I ditched the native ubuntu Network Manager and installed wicd which is another open source network manager that works with Ubuntu. But after configuring wicd with the static IP, I had another problem. Everytime I restarted the machine, I had to manually start the wicd network manager. Instead of trying anything more with wicd, I decided to ditch a network manager altogether and just configure the files myself.
So, to get the network working with static IP, first remove the network manager (Many people have said that it is not necessary, but I prefer to remove it as I wont be using it anyway):
sudo apt-get remove --purge network-manager
Then modify the /etc/resolv.conf with the dns servers and domain names:
search foo.bar.com bar.com
nameserver 192.168.0.1
nameserver 192.168.0.2
Now, modify /etc/network/interfaces and add
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.252.0
gateway 192.168.0.253
Now, just restart the networking:
sudo /etc/init.d/networking restart
Obviously, you should figure out the netmask, gateway and name servers before you start these steps.
This is all that you need to do to configure the machine with a static IP.
Azureus – Java BitTorrent Client
Get Firefox
Add to Google
Add to My Yahoo!
#1 by Jeff on November 8th, 2008
I followed your instructions, but ran into problems. After looking, I noticed that the instruction
iface inet eth0 static
is incorrect. It should be
iface eth0 inet static
I was able to proceed after that change.
#2 by Nalin on November 9th, 2008
Thanks. Fixed.
#3 by Gregory on November 10th, 2008
Thanks, this helped me out.
#4 by Gregory on November 10th, 2008
I came across that in Debian/Ubuntu they have modified the Network Manager so that if an interface is configured in /etc/network/interfaces the Network Manager will ignore (not manage) it.
So there should be no need to actually remove the Network Manager.
http://live.gnome.org/DarrenAlbers/NetworkManagerFAQ#head-45c7dcb29a13372e1da1221b5ed499d981ea7ec6
#5 by nullrend on November 11th, 2008
Yeah, I found out the hard way the only way to make Ubuntu 8.10 actually use static IP addresses is to get rid of network-manager (check my comment here (it’s the very last one). This is pretty important for people wishing to use Host Networking for VirtualBox, like myself.
@Gregory: It is true there should be no need to remove it, but that is why this seems to have been classified as a bug.
#6 by Gregory on November 12th, 2008
That’s exactly where I was needing the static IP, host networking in VirtualBox
#7 by rajendra on November 13th, 2008
There is no need to remove Network Manager
just modify modify the
/etc/resolv.conf with the dns servers and domain names:
nameserver #.#.#.#
nameserver #.#.#.#
Now, modify /etc/network/interfaces and add
auto eth0
iface eth0 inet static
address #.#.#.#
netmask #.#.#.#
gateway #.#.#.#
and this is all……
#8 by rajendra on November 13th, 2008
and
for restart networking
type in terminal
sudo /etc/init.d/networking restart
like mentioned above………:d
srry for incomplete information
#9 by kabel on November 19th, 2008
@rajendra: i’ve done everything you said, after the restart my computer boots with dhcp, not static ip, so the network manager is realy messed up, removing the network manager was the only way to fix the problem with static ip, or i should have say to remember the changes after the reboot.
#10 by rajendra on November 20th, 2008
@Kabel: i didn’t removed the network manager, n for me its working properly….
so i really don’t know what u hv done…
so u should try once more step by step…
just modify modify the
/etc/resolv.conf with the dns servers and domain names:
nameserver #.#.#.#
nameserver #.#.#.#
Now, modify /etc/network/interfaces and add
auto eth0
iface eth0 inet static
address #.#.#.#
netmask #.#.#.#
gateway #.#.#.#
for restart networking
type in terminal
sudo /etc/init.d/networking restart
hey don’t forget saving all files…
even after dis u r in trouble
u may stick to the upper post…
but do it in correct way…
#11 by userwaldo on November 22nd, 2008
I finally got a static IP to work using the Network Manager.
I had to do the following.
Set my /etc/network/interfaces as follows:
_______________ /etc/network/interfaces _______________
# The loopback network interface
auto lo
iface lo inet loopback
# Wireless interface
auto wlan0
#iface wlan0 inet dhcp
# The primary network interface
auto eth0
#iface eth0 inet dhcp
# The secondary network interface
auto eth1
#iface eth1 inet dhcp
_________________________________________________________
Then after a reboot I had to remove auto eth0.
Then I created a new wired connection called Wired Ethernet 1.
Once I did this I was able to set a static address and this new profile was written to
/etc/NetworkManager/system-connections
I’ll look at getting a bridge network up for Virtual Box later.
#12 by benitecs on November 24th, 2008
solved – thanks
#13 by JAVE on November 27th, 2008
Wahey! That was just what I needed.
I decided to check out Ubuntu (after using FreeBSD for ages), and was getting really fed up with that network manager thing.
For some reason my resolv.conf would get wiped every time.
I’m still not used to all these graphical config things. Why do you think a Unix system comes with a shell & vi?
grtx,
JAVE
#14 by xenonn on December 3rd, 2008
Would anyone care to enlighten me on how to
modify
/etc/network/interfaces
if I’d like to set up a static ip over wireless.
I don’t really use eth0 on my desktop and
I’m a newbie to setting up wireless on linux.
#15 by artist on December 8th, 2008
To set static IP:
Need not to remove NetworkManager.
First to edit (as root) /etc/NetworkManager/nm-system-settings.conf:
[ifupdown]
managed=true
then edit your /etc/network/interfaces and /etc/resolv.conf for your IP and name server.
then reboot.
#16 by Jay on December 13th, 2008
What do we do when we have multiple internet connections? What would go in for the /etc/resolv.conf?
Example: My configuration is as as follows..
auto lo
iface lo inet loopback
# Wireless interface internet connection 1
auto wlan0
iface wlan0 inet dhcp
# The primary network interface internet connection 2
auto eth0
iface eth0 inet dhcp
Both are different providers with different nameservers
#17 by manoj on December 20th, 2008
hi ,
i have removed my network manager, so help me how can i reinstall network manager offline ..??
#18 by success on December 21st, 2008
For those who followed artist’s instructions and still having problems with resolv.conf being overwritten, the following fixed it for me and I no longer need to modify resolv.conf and have not removed network manager (but made artist’s changes). Directions copied from here: http://en.kioskea.net/faq/sujet-979-having-a-static-ip-address-under-ubuntu-8-10
DNS
If you want to make use of specific DNS, modify the following file /etc/resolv.conf
Note that if you are using DHCP on one of your interfaces, the contents of this file will be overwritten by the DHCP client.
To force the DHCP client to use a specific DNS, edit the file /etc/dhcp3/dhclient.conf
Add the following line:
prepend domain-name-servers 208.67.222.222,208.67.220.220;
DNS returned by DHCP are will be added after the DNS you specified.
#19 by success on December 21st, 2008
Oh, should have added that the DNS addresses in the directions above point to the opendns.com servers. You are free to use them or replace with your own dns address. See opendns.com for more info/restrictions.
#20 by artist on December 22nd, 2008
I’m sorry as what success said I had problems with resolv.conf, too. But I could not return here to point the problem until I got the e-mail with success’s reply (There is the URL here in the e-mail).
I have ever wrote a file with DNS message and add a script auto to copy the message to the resolv.cionf after every reboot. But I thought it’s not a good way.
Then I found that what I had to do is only to remove the line “auto eth0″ in /etc/network/interfaces. Then NetworkManager will not rewrite resolv.conf again. Simple!
Thank success.
#21 by artist on December 22nd, 2008
To manoj: I think you can use “Synaptic Package Manager” in the menu of “System -> Administration” to install it if your system is UBUNTU Linux.
#22 by artist on December 22nd, 2008
I’m sorry I found I had the problem of resolv.conf too what as success said after I wrote that message. But I could not return here until I got an e-mail with success’s reply ( there is the URL here in it).
Firstly I wrote a file with DNS message and wrote a script for auto copy the DNS message from the file to resolv.conf after every reboot. But I thought it’s stupid and then try again.
Actually, the only thing have to do is to remove the line “auto eth0″ from /etc/network/interfaces, then NetworkManager wil not rewrite resolv.conf again.
Success, Thank you.
#23 by pew pew pew on December 26th, 2008
To manoj.
Use the Ubuntu installation CD. Synaptic Package Manager can install packages from the CD.
#24 by Rico on February 26th, 2009
And how about two configurations — one with static manual IP, and the other DHCP?
I was switching from Fedora, but after struggling with this for a day now I think not. Strange, I had been hearing about how everything just worked with Ubuntu….
#25 by dedi on February 28th, 2009
after you remove ( sudo apt-get remove –purge network-manager )
#just edit file /etc/rc.local
#give command
ifconfig eth0 inet [your-ip] netmask [your-netmask]
route add default gw [your-gateway]
#and edit /etc/resolv.conf for DNS SERVER. after your PC reboot your system will reading this configuration
#26 by hawks on April 22nd, 2009
I would just like to say thanks, after looking around the web and even ubuntu own site for help. I can across this, WORK 1st time for me