Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

dhclient or dhcpcd ? which is the best?[SOLVED]

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

dhclient or dhcpcd ? which is the best?[SOLVED]

  • Quote

Post by cwc » Tue Apr 08, 2008 1:23 pm

dhclient or dhcpcd ? Which is the best or does it matter.
I'm running gentoo on a Dell 8000 using both eth0 and ath0.

dhcpcd works much better once it's installed correctly.
Last edited by cwc on Fri Apr 11, 2008 11:55 am, edited 1 time in total.
Without diversity there can be no evolution:)
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Tue Apr 08, 2008 2:29 pm

I'm the author of dhcpcd-3, so I'm probably a little biased when saying that dhcpcd is the best :roll:

dhclient is the most flexible DHCP client there is. However, it's bloated, slow, heavily patched by Gentoo (my work I must admit) and has the occasional hiccup. It also require external binaries such as ifconfig and others.
dhcpcd is not flexible in the slightest, but is a lot smaller and faster. It has no need for any external binaries. It also supports more DHCP features out of the box. dhcpcd also has the occasional hiccup as Gentoo is the main testbase I have :twisted:

dhcpcd-3.3 (currently in heavy development) will be even smaller than dhcpcd-3.2 (by 15k currently) and be a lot more flexible (or allow to be more flexible in the future), hopefully without sacrificing any features.
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

  • Quote

Post by cwc » Tue Apr 08, 2008 2:57 pm

UberLord wrote:I'm the author of dhcpcd-3, so I'm probably a little biased when saying that dhcpcd is the best :roll:

dhclient is the most flexible DHCP client there is. However, it's bloated, slow, heavily patched by Gentoo (my work I must admit) and has the occasional hiccup. It also require external binaries such as ifconfig and others.
dhcpcd is not flexible in the slightest, but is a lot smaller and faster. It has no need for any external binaries. It also supports more DHCP features out of the box. dhcpcd also has the occasional hiccup as Gentoo is the main testbase I have :twisted:

dhcpcd-3.3 (currently in heavy development) will be even smaller than dhcpcd-3.2 (by 15k currently) and be a lot more flexible (or allow to be more flexible in the future), hopefully without sacrificing any features.
Wow would I like to put you on my speed dial!
Thanks for the line. I'm really having trouble with my laptop and eth0 and ath0. I emerged dhcpcd and I'd prefer to do use that.
But ... I'm finding out I'm more of a nOOb than I thought. How do I point my nics to dhcpcd? Dhclient works with ath0 but not eth0.

I've compiled my kernel and I can use both ath0 and eth0 (if I'm lucky, I even can pick up the neighbors WAP). I just don't have things set correctly.
I need to look at the kernel options more closely and recompile so I bind my nics to the kernel.

error on boot:
* dhcp
* Running dhcpcd ...
err, etho: timed out
warn, eth0: using IPV$LL address 169.254.42.198 ( yuk!)

Anyway. If you write back I'd appreciate. I really want to learn how to do this.

Buy the way.
I teach java, linux (using Fedora core), SQL, A+, Web design and 3d animation at a High School In Pasco,Wa
I have a groupd of students wanting to install Gentoo and I'm the test monkey. I've sure learned a lot more about linus since I've
started this Gentoo install on my Dell Ins 8000 p3 800 laptop.

Once again . thank you. Off to work I go.
Without diversity there can be no evolution:)
Top
toralf
Developer
Developer
User avatar
Posts: 3944
Joined: Sun Feb 01, 2004 2:58 pm
Location: Hamburg
Contact:
Contact toralf
Website

  • Quote

Post by toralf » Tue Apr 08, 2008 3:03 pm

Probably you need sth like this :

Code: Select all

tfoerste@n22 ~/workspace $ grep ^RC_PLUG_SERVICES= /etc/conf.d/rc
RC_PLUG_SERVICES="!*"
to give the kernel module(s) enough time to initialize your card(s).

Furthermore this works for me:

Code: Select all

tfoerste@n22 ~/workspace $ cat /etc/conf.d/net
# /etc/conf.d/net
#

#       LAN
#       dhcp, static ip for local services like apache, ...
#
config_eth0=(
        "dhcp"
        "192.168.0.254/24"
        )
dhcp_eth0="nontp"
dhcpcd_eth0="-L -t 25 -h <hostname>"

#       DSL at home
#
config_ppp0=( "ppp" )
link_ppp0=( "eth0" )
plugins_ppp0=( "pppoe" )
username_ppp0="foo"
password_ppp0=
pppd_ppp0=(
        "defaultroute"
        "usepeerdns"
        "maxfail 1"
)

#       WLAN
#
modules=( "wpa_supplicant" )
wpa_supplicant_ath0="-Dmadwifi"
config_ath0=( "dhcp" )

dhcp_ath0="nontp nosendhost"
dhcpcd_ath0="-L -t 20"

BTW dhcpcd works like a charm :-)
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Tue Apr 08, 2008 3:11 pm

cwc wrote:How do I point my nics to dhcpcd? Dhclient works with ath0 but not eth0.

I've compiled my kernel and I can use both ath0 and eth0 (if I'm lucky, I even can pick up the neighbors WAP). I just don't have things set correctly.
I need to look at the kernel options more closely and recompile so I bind my nics to the kernel.

error on boot:
* dhcp
* Running dhcpcd ...
err, etho: timed out
warn, eth0: using IPV$LL address 169.254.42.198 ( yuk!)

Anyway. If you write back I'd appreciate. I really want to learn how to do this.
Well, if neither dhcpcd or dhclient work on eth0, then we can probably assume a problem with eth0.
Is the cable plugged in and working? You should install ifplugd to manage the cable in/out events for you :)
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

  • Quote

Post by cwc » Wed Apr 09, 2008 4:01 am

I re emerged dhcpcd and eth0 works a bit better.
I also emerged ifplugd.

I do believe I've got a bit a reading to do as per the thread from toralf (thank you!)
I might recompile my kernel and pay closer attention to my nics. eth0 and ath0

thanks toralg and UberLord
Without diversity there can be no evolution:)
Top
toralf
Developer
Developer
User avatar
Posts: 3944
Joined: Sun Feb 01, 2004 2:58 pm
Location: Hamburg
Contact:
Contact toralf
Website

  • Quote

Post by toralf » Wed Apr 09, 2008 7:28 am

UberLord wrote:Well, if neither dhcpcd or dhclient work on eth0, then we can probably assume a problem with eth0.
Is the cable plugged in and working? You should install ifplugd to manage the cable in/out events for you :)
WIth my ThinkPad T41 I have the problem, that during a boot the eth0 device isn't initialized yet when the net.eth0 services is (automatically) started. Therefore I put the "!* into the rc file and added net.eth0 to the default level instead. Now the kernel already finishes the device before it's being used.
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Apr 09, 2008 8:29 am

toralf wrote:WIth my ThinkPad T41 I have the problem, that during a boot the eth0 device isn't initialized yet when the net.eth0 services is (automatically) started. Therefore I put the "!* into the rc file and added net.eth0 to the default level instead. Now the kernel already finishes the device before it's being used.
Could you explain "isn't initialized yet" a little more?
Also, is eth0 wired or wireless?
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
toralf
Developer
Developer
User avatar
Posts: 3944
Joined: Sun Feb 01, 2004 2:58 pm
Location: Hamburg
Contact:
Contact toralf
Website

  • Quote

Post by toralf » Wed Apr 09, 2008 8:45 am

UberLord wrote:Could you explain "isn't initialized yet" a little more?
Also, is eth0 wired or wireless?
I mean eth0. If I let the Gentoo boot scripts automatically start net.eth0 then dhcpcd times out during boot. But I can get an IP address immediately after my sytem has booted.
I suspect that dhcpcd is started to early after udev loaded the e1000 module. Therefore I added net.eth0 to the default level, which gives the e1000 module enough time to complete whatever it is doing.
OTOH I made these experiences with an older kernel + udev (>1 year ago) - maybe I should give the current system a try ?
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Apr 09, 2008 9:04 am

Those e1000 cards are nothing but trouble - they don't work good witth ifplugd or netplugd.

BTW, eth0 would also be wireless, which is why I asked :)
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

  • Quote

Post by cwc » Wed Apr 09, 2008 1:54 pm

toralf wrote:Probably you need sth like this :

Code: Select all

tfoerste@n22 ~/workspace $ grep ^RC_PLUG_SERVICES= /etc/conf.d/rc

I've yet to update /etc/conf.d/rc.
I can not get dhcpcd to work.  Here is my tty session for ath0. 
I wrote a simple script to connect to my wap essid = "TMA"
I can connect to my neighbor at 192.168.1.1 my WAP is 192.168.0.1  weird.
[code]
tma ~ # iwconfig 
lo        no wireless extensions.

eth1      no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"TMA"  Nickname:""
          Mode:Managed  Frequency:2.452 GHz  Access Point: 00:1C:F0:C5:EF:CB   
          Bit Rate:24 Mb/s   Tx-Power:18 dBm   Sensitivity=1/1  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=62/70  Signal level=-34 dBm  Noise level=-96 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

tma ~ # 
tma ~ # dhcpcd ath0
err, ath0: timed out
warn, ath0: using IPV4LL address 169.254.115.3
tma ~ # 
tma ~ # dhclient ath0
Internet Systems Consortium DHCP Client V3.0.3-Gentoo-r9
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

wifi0: unknown hardware address type 801
eth1: unknown hardware address type 24
wifi0: unknown hardware address type 801
eth1: unknown hardware address type 24
Listening on LPF/ath0/00:14:6c:fa:b1:46
Sending on   LPF/ath0/00:14:6c:fa:b1:46
Sending on   Socket/fallback
DHCPREQUEST on ath0 to 255.255.255.255 port 67
DHCPREQUEST on ath0 to 255.255.255.255 port 67
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 16
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 16
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 10
No DHCPOFFERS received.
Trying recorded lease 192.168.1.102
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

Trying recorded lease 192.168.0.2
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.174/0.174/0.174/0.000 ms
bound: immediate renewal.
DHCPREQUEST on ath0 to 255.255.255.255 port 67
tma ~ # iwconfig 
lo        no wireless extensions.

eth1      no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"TMA"  Nickname:""
          Mode:Managed  Frequency:2.452 GHz  Access Point: 00:1C:F0:C5:EF:CB   
          Bit Rate:48 Mb/s   Tx-Power:18 dBm   Sensitivity=1/1  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=60/70  Signal level=-29 dBm  Noise level=-89 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

tma ~ # ifconfig 
ath0      Link encap:Ethernet  HWaddr 00:14:6C:FA:B1:46  
          inet addr:169.254.115.3  Bcast:169.254.115.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1409 errors:0 dropped:0 overruns:0 frame:0
          TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:209466 (204.5 Kb)  TX bytes:40952 (39.9 Kb)

eth0      Link encap:Ethernet  HWaddr 00:20:E0:66:0E:96  
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1493 errors:0 dropped:0 overruns:0 frame:0
          TX packets:746 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:493629 (482.0 Kb)  TX bytes:159664 (155.9 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:672 (672.0 b)  TX bytes:672 (672.0 b)

wifi0     Link encap:UNSPEC  HWaddr 00-14-6C-FA-B1-46-FB-82-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13798 errors:0 dropped:0 overruns:0 frame:1360
          TX packets:440 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:199 
          RX bytes:2814037 (2.6 Mb)  TX bytes:56108 (54.7 Kb)
          Interrupt:10 


Without diversity there can be no evolution:)
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

  • Quote

Post by cwc » Wed Apr 09, 2008 2:04 pm

toralf wrote:Probably you need sth like this :

Code: Select all

tfoerste@n22 ~/workspace $ grep ^RC_PLUG_SERVICES= /etc/conf.d/rc
RC_PLUG_SERVICES="!*"

Here is my tty for eth0.
I have no idea why I can use dhclient but not dhcpcd and why my ath0 does not work(previous post)
ath0 does find my ap though.

[code]
tma ~ # ifconfig ath0 down
tma ~ # ifconfig eth0 down
tma ~ # dhcpcd eth0
err, eth0: timed out
warn, eth0: using IPV4LL address 169.254.42.198
tma ~ # dhclient eth0
Internet Systems Consortium DHCP Client V3.0.3-Gentoo-r9
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

eth1: unknown hardware address type 24
eth1: unknown hardware address type 24
Listening on LPF/eth0/00:20:e0:66:0e:96
Sending on   LPF/eth0/00:20:e0:66:0e:96
Sending on   Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 192.168.0.1
bound to 192.168.0.2 -- renewal in 37565 seconds.






Without diversity there can be no evolution:)
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Apr 09, 2008 2:18 pm

You can use the -I '' option like so

Code: Select all

dhcpcd -I '' eth0
If that works, then your DHCP server isn't RFC compliant.
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cwc
Veteran
Veteran
User avatar
Posts: 1491
Joined: Mon Mar 20, 2006 10:36 pm
Location: Tri-Cities, WA USA
Contact:
Contact cwc
Website

  • Quote

Post by cwc » Wed Apr 09, 2008 2:41 pm

UberLord wrote:You can use the -I '' option like so

Code: Select all

dhcpcd -I '' eth0
If that works, then your DHCP server isn't RFC compliant.

Code: Select all

dhcpcd -I '' eth0
did not work.

But dhclient did work. What is crazy I picked up a WAP from a lynksys router somewhere in my neighborhood.

I've got a dlink 802 11n Router (192.168.0.x) that I can't connect to at this point with ath0. I used to be able to connect with the same computer.
I've done something wrong somewhere.
Without diversity there can be no evolution:)
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Apr 09, 2008 3:41 pm

Could you try using the -t option? Hopefully it would at least test OK, if not then could I trouble you to get a raw tcpdump of both please?

Code: Select all

tcpdump -s 0 -i eth0 -w /tmp/dump.pcap
While that's running, activate dhclient. Once it has a lease, kill it and start dhcpcd. When that fails, kill it (if running) and try dhclient again.
Once done, email /tmp/dump.pcap to roy@marples.name so I can see why dhcpcd isn't working for you.

Thanks
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Post Reply

15 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy