5

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

5
  • 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.
    – heemayl
    Jan 18, 2015 at 7:48
  • It is set to Automatic DHCP.
    – nitishch
    Jan 18, 2015 at 12:32
  • Are you using ipv6?
    – Mitch
    Feb 9, 2015 at 7:44
  • No. using IPv4.
    – nitishch
    Feb 9, 2015 at 12:14
  • 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. Dec 15, 2020 at 0:32

4 Answers 4

4
+200

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 !

7
  • Yeah. I checked dhcilent.conf and it is fine. There seem to be no problems with it
    – nitishch
    Feb 7, 2015 at 16:46
  • Wow. deleting all connection configurations has worked.
    – nitishch
    Feb 7, 2015 at 16:54
  • 2
    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 Feb 7, 2015 at 16:56
  • 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
    – nitishch
    Feb 8, 2015 at 1:55
  • Am I the only one for whom this did not work?
    – hartmut
    Dec 5, 2018 at 21:21
1

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

6
  • Still the problem persists :(
    – nitishch
    Jan 18, 2015 at 4:52
  • @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.
    – Miphix
    Jan 18, 2015 at 5:09
  • 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.
    – nitishch
    Jan 18, 2015 at 5:34
  • @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.
    – Miphix
    Jan 18, 2015 at 6:33
  • 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
    Jan 18, 2015 at 12:31
1

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!

0

What you've probably run into is an auto-negotiation issue. (as no wiresharking has been done, hard to tell, but that's what it smells like.) These used to be more common when Ethernet moved from 10 to 100 MBit a few years ago when dinosaurs roamed the Earth.

So start of with an ethtool --change eth0 autoneg off speed 100 duplex half and then a: sudo dhclient -r&&sleep 5&&sudo dhclient and that should take exactly 5 seconds instead of 10 minutes.

Once that works, we'll work on a permanent fix that survives a cold boot (depending on your hardware, this might already survive a warm boot)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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