Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When you set a static IP under Ubuntu 12.04.1, you must supply the desired machine IP and the gateway IP, all using the Network Manager. When I first entered them and rebooted, everything worked great. On the second boot, however, Firefox could find no Web page. Upon checking, I discovered that the gateway IP had returned to zero. Now, no matter how often I resupply it, it returns to zero immediately after NM "saves" it: that is, appears as zero when redisplayed. The only way I can get to the Internet is to restore DHCP operation.

I need to use static IP for access to my home network. Would appreciate any suggestion.

--Robert Smith

share|improve this question
    
Please use apport-bug to file a bug report against the network-manager package. –  jdthood Dec 9 '12 at 11:47

1 Answer 1

If you can't get network manager to work correctly, you can setup static IP addresses by editing the /etc/network/interfaces file. Full documentation on how to do this can be found in man interfaces. For example, you could setup eth0 to have a static IP address by inserting this into the file:

auto eth0
iface eth0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    dns-nameservers xxx.xxx.xxx.xxx

After doing this run "sudo restart network-manager" or reboot.

Hope this helps.

share|improve this answer
    
Sigh. I've tried this or similar sequences over and over. Usually they hang the machine after boot. Yours merely caused the network not to come up, an improvement. –  Robert Smith Dec 7 '12 at 22:35
    
Humm... this is quite odd. Perhaps eth0 is not the name of your network adapter? What is the name of the device if you run ifconfig in a terminal? You should have an ethN device (with N being an integer) and lo for the loopback. Note, if only lo shows up, comment out the lines in the files above with a # and restart before running ifconfig. –  bkloppenborg Dec 8 '12 at 8:41
1  
In Ubuntu 12.04 and later you need not and should not edit /etc/resolv.conf directly since the file is dynamically generated. If ifup is used to configure interfaces defined in /etc/network/interfaces then nameserver addresses should also be specified in that file, on a dns-nameservers xxx.xxx.xxx.xxx line in the iface stanza in question. –  jdthood Dec 9 '12 at 11:39
1  
The answer (currently) says that NetworkManager should be "disabled" by changing managed = false to managed = true. Changing managed = false to managed = true actually causes NetworkManager to emulate ifup, obeying /etc/network/interfaces. Please read the manual page NetworkManager.conf(5) and take note of the following warning text: "Remember that NetworkManager controls the default route, so [if an] interface is ignored, NetworkManager may assign the default route to some other interface." –  jdthood Dec 9 '12 at 11:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.