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.

I am getting errors when running apt-get update or when installing new packages. Although this only happens when the server configured for a static IP address. Changing the configuration back to DHCP and restarting networking fixes the problem, although I want a static IP. Once it is working I can change back to my static IP address and restart networking. Although this only works until I restart the server (restarting the router is ok), and then I start getting the same errors and have to switch back to DHCP.

Any ideas on what could be causing this or tips on troubleshooting it? Thanks in advance.

  • here is my static IP configuration:

    auto eth0
    iface eth0 inet static
        address 192.168.2.2
        netmask 255.255.255.0
        gateway 192.168.2.1
    
  • The apt-get update errors go something like this:

    A few of these

    Ign http://us.archive.ubuntu.com precise-backports InRelease
    

    then a lot of these

    Err http://security.ubuntu.com precise-security Release.gpg   Something wicked happened resolving 'security.ubuntu.com:http' (-5 - No address associated with hostname)
    

    and a lot of these

    W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/universe/i18n/Translation-en  Something wicked happened resolving 'us.archive.ubuntu.com:http' (-5 - No address associated with hostname)
    
share|improve this question

1 Answer 1

up vote 8 down vote accepted

It sounds like you aren't able to resolve domains via DNS. Assuming this is the case, you can likely fix it by adding a dns-nameservers line to /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 192.168.2.2
    netmask 255.255.255.0
    gateway 192.168.2.1
    dns-nameservers 192.168.2.1

and then running

resolvconf -u

as root to update /etc/resolv.conf. Feel free to include a DNS search domain record (which is also typically handed out via DHCP). Refer to resolvconf(8) for more information.

share|improve this answer
    
Yep that did it! Thanks –  jpetersen Jun 25 '12 at 19:57
    
Glad I could help! –  Alex Hirzel Jun 25 '12 at 20:04

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.