Stuck at getting IP configuration

27,040

Solution 1

Here are couple of suggestions, but by no means definitive answers:

Try different dhcp client

If you search with apt-cache search dhcp | less, you will see quite a few alternatives to dhcp that comes by default. For instance, I'd suggest getting dhcpcd. I'm not sure if NetworkManager changes it's settings automatically once you install dhcpcd, but I'd suggest opening the /etc/NetworkManager/NetworkManager.conf and under [main] section specify dhcp=dhcpcd, like so. At least according to man NetworkManager.conf :

Presently dhclient and dhcpcd are sup‐ ported. The client configured here should be avail‐ able on your system too. If this key is missing, available DHCP clients are looked for in this order: dhclient, dhcpcd.

Disable dnsmasq plugin

dns=dnsmasq is another option that is specified in the NetworkManager.conf. The reason why I'd disable it, is because dnsmasq would fetch the dns server from the default gateway (aka your router), and that is also one of the elements in the "getting ip configuration" process. Simply comment out that plug in, like so # dns=dnsmasq. Small thing to keep in mind is that NetworkManager then won't resolve domain names. Thus, I suggest changing dns settings altogether. Also, think about deleting /etc/resolv.conf to let things reset or at least sudo dpkg-reconfigure resolvconf.

Delete connection configurations and reconnect

This can be done either through connections editor (Edit connections option in the drop-down menu ornm-connection-editor from terminal). Also, sudo rm -i /etc/NetworkManager/system-connections/* will do the trick.

Disable NetworkManager from creating a default wired connection

Again, it's in NetworkManager.conf, under [main], option should be no-auto-default=*

Try WICD network manager

I suppose that is self explanatory . . .

Examine /etc/dhcp/dhclient.conf file

You can compare with my configuration :

#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
supersede domain-name-servers 208.67.222.222,208.67.220.220,8.8.8.8;
# prepend domain-name-servers 208.67.222.222,208.67.220.220;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.fqdn, dhcp6.sntp-servers;

Among other things, I'd also suggest that you add information from ifconfig, what ethernet card you have, and output of dmesg to your questoin. Cheerios !

Solution 2

I feel like this could be a comment, but my reputation is not high enough to comment yet.

So I ran into a similar problem after a hard crash of my Ubuntu Server. After restoring I thankfully got everything back to booting and then lucky me, no internet because the network card seemed to be stuck in asking but never recieving an IP address. All it would do is send DHCPDISCOVER requests as above.

After hours/days of tinkering I found the driver r8169, as seen in the corner of your first screen shot, for realtek does not play nice. An addition to the troubleshooting proposed by Sergiy would be to take a look at

dmesg | grep -e r8169 -e <NICName>

You may see that the link is down, and not ready but it may not be abundantly apparent otherwise because the card still appears to send out DHCPDISCOVER messages during ifdown ; ifup resets.

Rolling back the drivers is easy enough and I followed this webpage as a guide: https://unixblogger.com/2016/08/11/how-to-get-your-realtek-rtl8111rtl8168-working-updated-guide/

Loading the drivers onto a USB stick and installing them onto the server worked for me even without an internet connection.

Hope this helps, and at the very least hopefully it will show up when I google this problem in the future because I am sure this will happen again!

Solution 3

You have to add the ethernet interface to your /etc/network/interfaces list as follows

iface eth0 inet dhcp

transversely, if you want to do the dhcp process manually. key in:

sudo dhclient eth0

Share:
27,040

Related videos on Youtube

nitishch
Author by

nitishch

Updated on September 18, 2022

Comments

  • nitishch
    nitishch over 1 year

    Recently, whenever I try to connect to Ethernet, Ubuntu detects the LAN wire but takes a long time(about 10min) to get the IP address.

    Output of nm-tool:

    Type: Wired
    Driver: r8169
    State: connecting (getting IP configuration)
    Default: no
    HW Address: ----------
    
    Capabilities:
      Carrier Detect: yes
      Speed: 100Mb/s
    
    Wired Properties:
      Carrier: on
    

    There is no problem with DHCP server. Windows connects to the same LAN very fast.

    Contents of /etc/network/interfaces

    # interfaces(5) file used by ifup(8) and ifdown(8)
    auto lo
    iface lo inet loopback
    

    What might cause this problem?

    EDIT:

    Output of ifconfig

    eth0      Link encap:Ethernet  HWaddr e8:03:9a:b6:d1:2a  
          inet addr:10.2.64.198  Bcast:10.2.95.255  Mask:255.255.224.0
          inet6 addr: fe80::ea03:9aff:feb6:d12a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1123164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:582761 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1503341500 (1.5 GB)  TX bytes:56327121 (56.3 MB)
    
    lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:119202 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119202 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:7588901 (7.5 MB)  TX bytes:7588901 (7.5 MB)
    

    Output of dmesg : Pastebin Link

    • heemayl
      heemayl over 9 years
      Have you tried putting the method as DHCP in the graphical network manager? From Ubuntu 12.04, networking will be overridden by the configurations of network-manager, which is the default for Ubuntu desktops now. The graphical network manager is basically a wrapper around network-manager. You can also set the IP via command line but graphical method is much easier.
    • nitishch
      nitishch over 9 years
      It is set to Automatic DHCP.
    • nitishch
      nitishch about 9 years
      No. using IPv4.
    • user4493605
      user4493605 over 3 years
      This solution is only worth a comment. But I got a similar error, and fixed it by restarting the Router/AP. Might be worth a try for anyone else.
  • nitishch
    nitishch over 9 years
    Still the problem persists :(
  • Miphix
    Miphix over 9 years
    @hatter Do you have more than one network interface? If you do, you'll find that your system will still attempt to obtain IPs for the remaining interfaces.
  • nitishch
    nitishch over 9 years
    I have wlan0, eth0 and lo. This problem surfaced around 20 days back. Before then I had same network interfaces but everything used to work fine.
  • Miphix
    Miphix over 9 years
    @hatter I have noticed that my system suffered the same symptom after reading this question. Just haven't suffered the consequence exactly. I managed to fix it by enabling network-manager. If that works for you. I'll edit my answer to include that step.
  • nitishch
    nitishch over 9 years
    What do you mean by enabling network-manager? Isn't it enabled automatically? Do you mean restarting it? If yes, I have tried sudo service network-manager restart. But it didn't help
  • nitishch
    nitishch about 9 years
    Yeah. I checked dhcilent.conf and it is fine. There seem to be no problems with it
  • nitishch
    nitishch about 9 years
    Wow. deleting all connection configurations has worked.
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy about 9 years
    Great - the simplest troubleshooting tip since the beginning of networking strikes again :) Let's see if that definitely sorts out the problem for a day or two
  • nitishch
    nitishch about 9 years
    I'll accept this answer if I don't face trouble again in two days. But I still have no idea what caused this problem :P
  • hartmut
    hartmut over 5 years
    Am I the only one for whom this did not work?
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy over 5 years
    @hartmut Likely you're not the only one. This answer was written by me in 2015, when Ubuntu was using a different networking system. Beginning with 18.04 they've switched to something called netplan. So that may interfere with dhclient configuration, but then again I've not worked with netplan enough to know the details. This answer, however, should work for versions before 18.04. I may update it at some point to include netplan solution
  • hartmut
    hartmut over 5 years
    @SergiyKolodyazhnyy: I am actually on 14.04.
  • cheche
    cheche about 5 years
    Somehow the configuration was using iface eth0 inet manual