# NetworkManager not using dhcp for eth0 [solved]

## T-Dawg

I can't seem to get NetworkManager to run dhcp on my wired interface, eth0. It does however work with my wired, wlan0.

/var/log/messages when on eth0:

```

Nov 23 11:01:35 cobalt dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.reason

Nov 23 11:01:35 cobalt NetworkManager: <info>  User Switch: /org/freedesktop/NetworkManager/Devices/eth0

Nov 23 11:01:35 cobalt NetworkManager: <info>  Deactivating device eth0.

Nov 23 16:01:35 cobalt avahi-daemon[26869]: Withdrawing address record for 192.168.1.102 on eth0.

Nov 23 16:01:35 cobalt avahi-daemon[26869]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.1.102.

Nov 23 16:01:35 cobalt avahi-daemon[26869]: Interface eth0.IPv4 no longer relevant for mDNS.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Device eth0 activation scheduled...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) started...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 1 of 5 (Device Prepare) started...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 1 of 5 (Device Prepare) complete.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 2 of 5 (Device Configure) starting...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 2 of 5 (Device Configure) successful.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 2 of 5 (Device Configure) complete.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 3 of 5 (IP Configure Start) started...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 4 of 5 (IP Configure Get) scheduled...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 4 of 5 (IP Configure Get) started...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled...

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 4 of 5 (IP Configure Get) complete.

Nov 23 11:01:35 cobalt NetworkManager: <info>  Activation (eth0) Stage 5 of 5 (IP Configure Commit) started...

Nov 23 16:01:35 cobalt avahi-daemon[26869]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.102.

Nov 23 16:01:35 cobalt avahi-daemon[26869]: New relevant interface eth0.IPv4 for mDNS.

Nov 23 16:01:35 cobalt avahi-daemon[26869]: Registering new address record for 192.168.1.102 on eth0.IPv4.

Nov 23 11:01:36 cobalt NetworkManager: <WARN>  nm_system_set_hostname(): nm_system_set_hostname(): gethostbyaddr failed, h_errno = 2

Nov 23 11:01:36 cobalt NetworkManager: <info>  Activation (eth0) Finish handler scheduled.

Nov 23 11:01:36 cobalt NetworkManager: <info>  Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete.

Nov 23 11:01:36 cobalt NetworkManager: <info>  Activation (eth0) successful, device activated.

```

/var/log/messages on wlan0:

```

Nov 23 11:04:31 cobalt NetworkManager: <debug> [1227456271.969823] nm_device_802_11_wireless_get_activation_ap(): Forcing AP 'gates_wi'

Nov 23 11:04:31 cobalt NetworkManager: <info>  User Switch: /org/freedesktop/NetworkManager/Devices/wlan0 / gates_wi

Nov 23 11:04:31 cobalt NetworkManager: <info>  Deactivating device wlan0.

Nov 23 11:04:31 cobalt dhclient: can't create /var/lib/dhclient/dhclient-wlan0.leases: No such file or directory

Nov 23 16:04:32 cobalt avahi-daemon[26869]: Withdrawing address record for 192.168.1.102 on wlan0.

Nov 23 16:04:32 cobalt avahi-daemon[26869]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.1.102.

Nov 23 16:04:32 cobalt avahi-daemon[26869]: Interface wlan0.IPv4 no longer relevant for mDNS.

Nov 23 11:04:32 cobalt NetworkManager: <WARN>  nm_device_802_11_wireless_set_essid(): error setting ESSID to '' for device wlan0: Invalid argument

Nov 23 11:04:34 cobalt NetworkManager: <info>  Device wlan0 activation scheduled...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) started...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0/wireless): access point 'gates_wi' is encrypted, but NO valid key exists.  New key needed.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) New wireless user key requested for network 'gates_wi'.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) New wireless user key for network 'gates_wi' received.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Nov 23 11:04:34 cobalt NetworkManager: <info>  Activation (wlan0/wireless): access point 'gates_wi' is encrypted, and a key exists.  No new key needed.

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'INTERFACE_ADD wlan0      wext   /var/run/wpa_supplicant   '

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'AP_SCAN 1'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'ADD_NETWORK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was '0'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 ssid 67617465735f7769'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 proto WPA'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 key_mgmt WPA-PSK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'SET_NETWORK 0 psk <key>'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: sending command 'ENABLE_NETWORK 0'

Nov 23 11:04:36 cobalt NetworkManager: <info>  SUP: response was 'OK'

Nov 23 11:04:36 cobalt NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Nov 23 11:04:36 cobalt NetworkManager: <info>  Supplicant state changed: 1

Nov 23 11:04:36 cobalt NetworkManager: <info>  Activation (wlan0/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to access point 'gates_wi'.

Nov 23 11:04:36 cobalt NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) scheduled.

Nov 23 11:04:36 cobalt NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) started...

Nov 23 11:04:38 cobalt NetworkManager: <info>  Activation (wlan0) Beginning DHCP transaction.

Nov 23 11:04:38 cobalt NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) complete.

Nov 23 11:04:38 cobalt NetworkManager: <info>  DHCP daemon state is now 12 (successfully started) for interface wlan0

Nov 23 11:04:38 cobalt dhclient: can't create /var/lib/dhclient/dhclient-wlan0.leases: No such file or directory

Nov 23 11:04:39 cobalt NetworkManager: <info>  DHCP daemon state is now 1 (starting) for interface wlan0

Nov 23 11:04:42 cobalt dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7

Nov 23 11:04:42 cobalt dhclient: DHCPOFFER from 192.168.1.254

Nov 23 11:04:42 cobalt dhclient: DHCPREQUEST on wlan0 to 255.255.255.255 port 67

Nov 23 11:04:42 cobalt dhclient: DHCPACK from 192.168.1.254

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.1.102.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: New relevant interface wlan0.IPv4 for mDNS.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Registering new address record for 192.168.1.102 on wlan0.IPv4.

Nov 23 11:04:42 cobalt dhclient: can't create /var/lib/dhclient/dhclient-wlan0.leases: No such file or directory

Nov 23 11:04:42 cobalt dhclient: bound to 192.168.1.102 -- renewal in 35896 seconds.

Nov 23 11:04:42 cobalt NetworkManager: <info>  DHCP daemon state is now 2 (bound) for interface wlan0

Nov 23 11:04:42 cobalt NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) scheduled...

Nov 23 11:04:42 cobalt NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) started...

Nov 23 11:04:42 cobalt dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/wlan0 for sub-path wlan0.dbus.get.host_name

Nov 23 11:04:42 cobalt dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/wlan0 for sub-path wlan0.dbus.get.nis_domain

Nov 23 11:04:42 cobalt dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/wlan0 for sub-path wlan0.dbus.get.nis_servers

Nov 23 11:04:42 cobalt NetworkManager: <info>  Retrieved the following IP4 configuration from the DHCP daemon:

Nov 23 11:04:42 cobalt NetworkManager: <info>    address 192.168.1.102

Nov 23 11:04:42 cobalt NetworkManager: <info>    netmask 255.255.255.0

Nov 23 11:04:42 cobalt NetworkManager: <info>    broadcast 192.168.1.255

Nov 23 11:04:42 cobalt NetworkManager: <info>    gateway 192.168.1.254

Nov 23 11:04:42 cobalt NetworkManager: <info>    nameserver 192.168.1.104

Nov 23 11:04:42 cobalt NetworkManager: <info>    nameserver 24.25.5.148

Nov 23 11:04:42 cobalt NetworkManager: <info>    nameserver 24.25.5.147

Nov 23 11:04:42 cobalt NetworkManager: <info>    domain name 'gates.net'

Nov 23 11:04:42 cobalt dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/wlan0 for sub-path wlan0.dbus.get.interface_mtu

Nov 23 11:04:42 cobalt NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) scheduled...

Nov 23 11:04:42 cobalt NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) complete.

Nov 23 11:04:42 cobalt NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) started...

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Withdrawing address record for 192.168.1.102 on wlan0.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.1.102.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Interface wlan0.IPv4 no longer relevant for mDNS.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Joining mDNS multicast group on interface wlan0.IPv4 with address 192.168.1.102.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: New relevant interface wlan0.IPv4 for mDNS.

Nov 23 16:04:42 cobalt avahi-daemon[26869]: Registering new address record for 192.168.1.102 on wlan0.IPv4.

Nov 23 11:04:43 cobalt NetworkManager: <info>  Setting hostname to 'cobalt'

Nov 23 11:04:43 cobalt NetworkManager: <info>  Activation (wlan0) Finish handler scheduled.

Nov 23 11:04:43 cobalt NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) complete.

Nov 23 11:04:43 cobalt NetworkManager: <info>  Activation (wlan0) successful, device activated.

Nov 23 11:04:43 cobalt NetworkManager: <debug> [1227456283.247110] nm_dbus_signal_filter(): NetworkManagerInfo triggered update of wireless network 'gates_wi'

```

Note when on wlan0 stage 2 or 5 says 'running DHCP' while when on eth0 it simply skips past it. What ends up happening is my ip is set to that of what wlan0 was last, gateway is updated for eth0 but resolv.conf is left untouched. I can run dhclient eth0 manually from the command line and receive an address just fine so I know it works. I just can't figure out why NetworkManager or who ever the hell calls dhclient isn't doing so. I'm using version 0.6.6.Last edited by T-Dawg on Thu Nov 27, 2008 10:28 pm; edited 1 time in total

----------

## T-Dawg

Anyone? I still can't figure out what the hell the problem here is...

----------

## UberLord

Nov 23 11:04:38 cobalt dhclient: can't create /var/lib/dhclient/dhclient-wlan0.leases: No such file or directory 

I'm guessing it's because Gentoo sets a different lease directory than what NM uses.

----------

## T-Dawg

I actually tried creating that directory but to no avail...

I can try rebuilding NM with the gentoo dhcp lease directory when I get home but the message is coming from dhclient. Should I not try rebuilding that?

Thanks for the suggestion.

----------

## T-Dawg

Solved.

When I restarted NM I noticed the GentooReadConfig() lines in /var/log/messages so I immediately realized gentoo has provided hooks from /etc/conf.d/net. I actually considered this once before but my config for eth0 has always worked via net.eth0. Turns out these hooks for NM are bit finicky with syntax. It was setting everything from my config correctly except for the DNS. In my config I had:

```

dns_servers_eth0=("x.x.x.x" "x.x.x.x")

```

i.e. stringed bash array. Gentoo init scripts could parse this just fine but NM got confused and threw nothing in my resolv.conf. I ended up having to modify that line to a non string bash array:

```

dns_servers_eth0="x.x.x.x x.x.x.x"

```

Now both NM and init scripts can parse the file just fine.

To anyone reading this unfamiliar with those two different bash array syntaxes: the first allows you to have a white space between elements and the latter interprets it as the next element.

Thanks for your effort UberLord  :Smile: 

----------

