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.

In my 12.04 Precise install, when I boot the system, or when I plug in an ethernet cable, dhclient isn't run automatically on my wired eth0 connection. I have no running dhclient daemon. When I run dhclient manually it succeeds at pulling an address and configuring eth0 and the route table. It does output the following however :

jdoe@example:~$ sudo dhclient eth0
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd

which indicates that it's an upstart managed thing. There are no upstart scripts in /etc/init/ for dhclient.

I'm running isc-dhcp-client version 4.1.ESV-R4-0ubuntu5.1, the current stable release.

  • Should dhclient be running all the time as a daemon on a standard 12.04 desktop install?
  • Is dhclient supposed to be launched during machine boot via upstart as the curious message I get when running dhclient suggests?
  • Should I have one of these ifplugd or netplug packages to launch dhclient when a cable is plugged into eth0?
  • Is dhclient instantiated by NetworkManager perhaps and not running at all times?
  • For a standard Ubuntu 12.04 install should NetworkManager have anything listed in the "Wired" tab of the Network Connections dialog? [example screenshot] I've both created a Wired connection profile and left it blank, neither affects dhclient being run

Other symptoms that I'm experiencing for context are :

  • NetworkManager doesn't gracefully manage when the wired and wireless connections are both connected, it merely uses the wireless
  • NetworkManager doesn't connect the VPN I have configured and sometimes try to use, over the wired network, it will only connect it over the wireless network.

@roadmr had asked for the content of /etc/network/interfaces :

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#NetworkManager#iface eth0 inet dhcp
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto
share|improve this question
    
Can you add the contents of your /etc/network/interfaces file to your question? –  roadmr Jun 22 '12 at 0:18
    
Sure thing, you'll find it in the question above. –  gene_wood Nov 27 '13 at 19:26
add comment

3 Answers 3

up vote 1 down vote accepted

When you power up the system, the first thing that should notice the Ethernet interface is the kernel. Based on the PCI ID, the kernel will try to load an appropriate driver for the card.

In your /var/log/syslog file you should see something like this:

Jun 21 09:54:59 snowflake kernel: [ 2600.056067] sky2 0000:03:00.0: eth0: Link is up at 1000 Mbps, full duplex, flow control rx
Jun 21 09:54:59 snowflake kernel: [ 2600.056731] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Jun 21 09:54:59 snowflake NetworkManager[1059]: <info> (eth0): carrier now ON (device state 20)
Jun 21 09:54:59 snowflake NetworkManager[1059]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
Jun 21 09:54:59 snowflake NetworkManager[1059]: <info> Auto-activating connection 'Wired connection 1'.

This tells you that the kernel notifies NetworkManager about the device. What I think happens (just speculating here) is that the kernel notifies udev, udev in turn tells NetworkManager (who may be registered to receive udev events) and then NetworkManager handles the rest of the configuration.

Now, NetworkManager will refuse to manage any interface that's declared in /etc/network/interfaces. This is because it assumes that, if you configured it manually in that file, you want to manage it yourself.

So one way to get NetworkManager to manage your interface is to remove the entries in /etc/network/interfaces. That's why I asked you to add that data, so we can see if this is what's happening and maybe advise further. Of course, with the proper configuration even in /etc/network/interfaces, the interface should work well even without NetworkManager and without you having to do it manually every time. Still, the place to look at what may be happening is that file :)

share|improve this answer
    
Got it, this is the line of troubleshooting I should have been following. I got lucky by switching that "managed = false" setting in the NetworkManager.conf but it was just luck in that I didn't have an understanding at that point of the sequence of what entity notifies what entity. Thanks so much for the details! –  gene_wood Jun 22 '12 at 16:38
    
Great answer! Also I think you're right about /etc/network/interfaces being handled incorrectly. 11.10 introduced a change where we exit dhclient after it fails for 60 seconds, but we do not detect when the network cable is plugged in as far as I can tell, so we should leave it running. I opened this bug to handle it: bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1017166 –  SpamapS Jun 24 '12 at 14:45
add comment

This ended up being caused by network-manager. My /etc/NetworkManager.conf file looked like this :

[main]
plugins=ifupdown,keyfile
dns=dnsmasq

[ifupdown]
managed=false

This config file was set like this when the machine was built (this may be a bug). By the fact that "managed" was set to false, NetworkManager wasn't initiating dhclient for the interface, and it wasn't considering the wired connection to be a real connection and so it wouldn't initiate the VPN either.

I changed "managed" to "true" and restarted the system. It works just as I'd hope now, runs dhclient, VPN works etc.

And to answer some of my own questions :

  • This is what the wired connection tab in a standard NetworkManager Network Connections dialog should look like : http://i.imgur.com/TgUs8.png
  • dhclient is kicked off my NetworkManager and then stays running while the connection is up
share|improve this answer
add comment

On the top right hand corner click on the network connection icon choose edit connections > wireless (tab) > highlight your connection >click edit button > IPv4 settings (tab) check what is displayed as method: if it reads "shared to other computers" use the down arrow of the box to select "Automatic DHCP" then reboot the wireless will work without having to manually run dhclient

share|improve this answer
add comment

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.