Forums

Skip to content

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

dhcp or dhcpd? - SOLVED

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
17 posts • Page 1 of 1
Author
Message
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

dhcp or dhcpd? - SOLVED

  • Quote

Post by jankom » Tue Apr 29, 2025 11:00 pm

I have Gentoo desktop and a linux Mint laptop on my home Wifi. Sometimes avahi works, sometimes it does not. On the Gentoo machine there is an /etc/dhcpd/ directory, Mint only has /etc/dhcp. I understand that the dhcpd is a system dependency, and it is a dhcp server (daemon, and it is running). Linux Mint /etc/dhcp looks like the client,
I was looking for Gentoo documentation, but there are two wiki sites for dhcpcd and no info on dhcp.
Today I emerged dhcp and /etc/dhcpcd directory disappeared but /etc/dhcp showed up. Yet the dhcpcd is running. getent ahosts foo.local only shows the Gentoo machine. When I emerged dhcp there was a note that client will be discontinued, or something like that.

Should I remove the just emerged dhcp package?

As I said, I started to play with this because avahi behavior on both machines is not consistent.

Janos
Last edited by jankom on Mon May 05, 2025 6:55 pm, edited 1 time in total.
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Tue Apr 29, 2025 11:13 pm

net-misc/dhcp (ISC DHCP client/server) has been deprecated by its creators and will no longer receive updates. It may continue to work until some other compatibility problem comes along.

The historical default in Gentoo is net-misc/dhcpcd. If all you need is a client, then dhcpcd is generally good enough with lots of features.
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Wed Apr 30, 2025 2:40 am

Thanks, make sense. Then, quoted from another Forum, NeddySeagoon commented
Normally, you only use a dhcp server on your router
Do I need to activate the dhcpcd daemon? If the daemon is stopped do I need to configure the client and how?
Top
Banana
Administrator
Administrator
User avatar
Posts: 2394
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Wed Apr 30, 2025 5:30 am

If you are talking about client then go here: https://wiki.gentoo.org/wiki/Dhcpcd
If you are talking about server, go here: https://wiki.gentoo.org/wiki/Home_router
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56100
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Apr 30, 2025 10:23 am

jankom,
Do I need to activate the dhcpcd daemon?
That depends on how you manage your network on your non router hosts.
You must choose a maximum of one method.

dhcpcd cannot manage WiFi crypto, so you probably don't want to use dhcpcd an your network manager.
netifrc can do it it all. It will call wpa_supplicant, to manage the crypto, then dhcpcd to get the settings, if you configure it that way.
There are other network managers too. If you choose to start more that one, they fight, and none of them work.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Wed Apr 30, 2025 1:31 pm

manage your network on your non router hosts
I do everything manally. After the system is booted I may connect to WiFi with activating iwd configured for hidden SSID. If connected I may connect OVPN to my other computing instance in order to make my web and email server work. If I decide I disconnect from OVPN and/or disconnect from WiFi, and or even stop iwd daemon in order to be fully isolated from the outside world (paranoia).

Do I understand correctly that I should study the working of netifrc, and that I don't even need dhcpcd daemon running? My objective is to make avahi work reliably because my local IP from the ISP router changes occasionally, therefore I'd like to access my printers, scanners and laptop (back and forth) with ssh, sshfs on my home WiFi reliably.

jankom/Janos
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2185
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Wed Apr 30, 2025 2:19 pm

From your posts i gather you are mixing several concept into one. So first let's try get in sync,

DHCP -- Dynamic Host Configuration Protocol. a network management protocol that automatically assigns IP addresses and other network configuration parameters to devices on a network.

Avahi -- a free zero-configuration networking (zeroconf) implementation, including a system for multicast DNS and DNS Service Discovery.

dhcpcd vs dhcpd, they are in pair for your device to get IP address and other network configuration attributes.
  • dhcpd is the server portion that control a database of IP addresses and device attributes of all devices on network. And it send out configuration information base on client (dhcpcd) request.
  • dhcpcd is client portion that base on configuration on the device (or command line options) send request to dhcp server (dhcpd) for IP address and other network attributes in order and perform IP address configuration of the device.
Usually after dhcp client finish IP address configuration of device the device can communicate other devices on network base on IP addresses and possible with name assume the DHCP database have DNS server information and dhcp client (dhcpcd) requested and configured the device with DNS resolver setup. However at this point other devices on network not necessary know your device by name since it is not register in any way. This where Avahi come to play.

In order devices on network find each other by name a registration process is required, normally this is done manually by updating DNS database for newly setup device. However because DHCP can dynamically assign IP address for device the manual process become cumbersome, therefor a dynamic way to register name be come necessary. avahi is one of such dynamic dns service. (for request as well as registration)

Gentoo's netifrc does not directly manage avahi, so you experience with unreliable name resolution have nothing to do with dhcpcd/dhcpd. It is better to examine directly in the event when such case happen. From your posted use case it may fall into a corner as it is unuall for device coming up and down on network in short period of time. because many network configuration have Time To Live (TTL) concept (for performance reason).

So it will be better when it happen you provide the sequence of events start from when it is working and what actions took place the lead to stop working.
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Thu May 01, 2025 3:48 pm

Thank you all for your comments.
As far as avahi is concerned I understand that it does not relate directly to the Subject of this post: "dhcp or dhcpcd", and yes, I realize that Gentoo package dhcpcd is all that is needed for an average user computer sitting behind an ISP provided router (DHCP server of the ISP). The reason I brought up avahi is because the private IPs of computers (my Gentoo dasktop, and the Linux Mint laptop) are not always the same. So I installed avahi in order to do ssh or sshfs with hostname.local in my bash scripts. However it sometimes fails ("Connection reset by peer") but works if IP is specified instead. In order to find out what is going on I started to dig into dhcp leading to this posting.
Corrent situation after reading the comments and studying manuals, etc.:

Code: Select all

janos@andraslinux ~ $ getent ahosts andrasinux.local
2607:fb91:d3d:45e6:d87d:fef7:2789:e4e2%6 STREAM andraslinux.local
2607:fb91:d3d:45e6:d87d:fef7:2789:e4e2%6 DGRAM  
2607:fb91:d3d:45e6:d87d:fef7:2789:e4e2%6 RAW    
192.168.99.11   STREAM 
192.168.99.11   DGRAM  
192.168.99.11   RAW    
janos@andraslinux ~ $ getent ahosts acerlinux.local
janos@andraslinux ~ $ hostname --fqdn
hostname: Unknown host
janos@andraslinux ~ $ hostname       
andraslinux
janos@andraslinux ~ $ 
There is no /etc/dhcp/ or /etc/dhcpcd/ directory in my Gentoo desktop (andraslinux)
There is no /etc/confd/net file either.
/etc/dhcpcd.conf file is the default as installed by system package dhcpcd
/etc/nsswitch.conf file modified from default for avahi "hosts: mdns files dns" (mdns added in front)
The Linux Mint laptop avahi can find andraslinux computer.

My question is now: why 'Unknown host' for fqdn yet 'andraslinux' for hostname command?
I can wait with the avahi issue for some other time and other topic. It may be just TTL related.

jankom (Janos)
Top
grknight
Retired Dev
Retired Dev
Posts: 2565
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Thu May 01, 2025 4:11 pm

jankom wrote:/etc/nsswitch.conf file modified from default for avahi "hosts: mdns files dns" (mdns added in front)
So you also added sys-auth/nss-mdns to get this hosts entry to be recognized?
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2185
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu May 01, 2025 4:47 pm

jankom wrote:My question is now: why 'Unknown host' for fqdn yet 'andraslinux' for hostname command?
Name resolution happen in client nodes. All name register in DNS server database are consider Fully Qualified.

It is client node resolver configuration define how a given word resolve to an IP address. So depend on your node resolver setup it could be many thing. Do you use systemd-resolved? or do you have local dns proxy (dmsmasq for example) or just glibc based?

in /etc/resolv.conf there usually have a "search" directive which help resolver add additional suffixes for DNS query. This can be observed by doing "tcpdump port domain". Another resolv.conf directive is "options ndots:n". There are more you can try but combine tcpdump and /etc/resolv.conf should be able to address why name resolution not function as expected.

For your question, it is most likely your /etc/hosts have entry that define "andraslinux" but not for any "andraslinux.<some domain>". this is based on your post said "/etc/nsswitch.conf file modified from default for avahi "hosts: mdns files dns" (mdns added in front)" therefor resolver will search "files" before "dns".

Another part of this puzzle is that are you sure the "avahi" daemon function at the time you issue "hostname --fqdn"?
Top
dmpogo
Advocate
Advocate
Posts: 3717
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

  • Quote

Post by dmpogo » Thu May 01, 2025 5:00 pm

NeddySeagoon wrote:jankom,
Do I need to activate the dhcpcd daemon?
That depends on how you manage your network on your non router hosts.
You must choose a maximum of one method.

dhcpcd cannot manage WiFi crypto, so you probably don't want to use dhcpcd an your network manager.
netifrc can do it it all. It will call wpa_supplicant, to manage the crypto, then dhcpcd to get the settings, if you configure it that way.
There are other network managers too. If you choose to start more that one, they fight, and none of them work.
Hm, I am using dhcpd + wpa_supplicant without netifrc ( I remember few years ago there was discussion about this possibility and I went with it ), for all my WIFI needs.
Don't have my laptop with me to see configuration - but none was required if you get FQDN via dhcp. dhcpcd is launching wpa_supplicant just fine.
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Thu May 01, 2025 8:11 pm

@pingtoo:
/etc/resolv.conf file is generated by the WiFi router every time I connect to WiFi.
Output of tcpdump:

Code: Select all

listening on wlan0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:43:37.776253 IP andraslinux.local.59046 > 192.168.99.31.domain: 42702+ A? acerlinux.local. (33)
15:43:37.776331 IP andraslinux.local.59046 > 192.168.99.31.domain: 6360+ AAAA? acerlinux.local. (33)
15:43:37.849744 IP 192.168.99.31.domain > andraslinux.local.59046: 42702 NXDomain 0/1/0 (108)
15:43:37.859220 IP 192.168.99.31.domain > andraslinux.local.59046: 6360 NXDomain 0/1/0 (108)
15:43:42.803740 IP andraslinux.local.44656 > 192.168.99.31.domain: 8415+ PTR? 31.99.168.192.in-addr.arpa. (44)
15:43:43.037015 IP 192.168.99.31.domain > andraslinux.local.44656: 8415 NXDomain 0/1/0 (103)
Here 192.168.99.31 is the nameserver (defined in /etc/resolv.conf)
The 3rd item (99) changes frequently
The 4th item (31) is the router machine. My machine is 11 and never changes (at least so far in the past few years), it is somehow bound to machine (MAC address?)
As far as nsswitch.conf is concerned I put the mdns to the end, but no success, and yes, avahi is running while fostname --fqdn command is issued.
/etc/hosts file is distro default, the only uncommented content, as in default, is

Code: Select all

127.0.0.1	localhost
::1		localhost
Maybe I should put andraslinux or andraslinux.jgklinux.jangkom.com after localhost as an alias?

jankom
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2185
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Thu May 01, 2025 9:56 pm

jankom,

Do your "andraslinux" (or the device issue hostname command) use systemd-resolved? because it could create conflict with avahi.

At this point I don't get is what is issue :oops:

I will use lines from your tcpdump as example.

This line "15:43:37.776253 IP andraslinux.local.59046 > 192.168.99.31.domain: 42702+ A? acerlinux.local. (33)" tell me local node have an IP address can be reverse lookup from 192.168.99.11 -> andraslinux.local using avahi. and the request "A+? acerlinux.local" was send out from avahi or you use "acerlinux.local" in your command for name lookup to your DNS server 192.168.99.31 on port "domain" (port 53)

And "15:43:37.849744 IP 192.168.99.31.domain > andraslinux.local.59046: 42702 NXDomain 0/1/0 (108)" tell me your DNS server reply with "NXDomain" mean the DNS have no record for "acerlinux.local".

However I don't know on 192.168.99.11 for example does it have local dns cache server running (dnsmasq as example) and what is the command that generate this dns query/reply and what is content of /etc/resolv.conf and nsswitch.conf

Placing "mdns" in front or at the end just mean name lookup order it does not affect how things work.

BTW, you can modify tcpdump command to include mdns traffic by "tcpdump port domain or port 5353"
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Fri May 02, 2025 1:07 pm

@grknight - sorry, I missed your question.
Yes, sys-auth/nss-mdns was emerged way back. Sometimes it worked, sometimes not.

Interestingly, it works now. Strange. Could be TTL?

My Gentoo desktop is powered on most of the time except when doing debugging, testing. Maybe TTL is 24 hr, so I should be patioent any time when I make a change to something.

hostname --fqdn still returns

Code: Select all

janos@andraslinux ~ $ hostname --fqdn
hostname: Unknown server error
janos@andraslinux ~ $ 
Now I'll play with /etc/hosts file.
Otherwise everything works, my mail- and web server is fine.

jankom
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

Solved

  • Quote

Post by jankom » Mon May 05, 2025 6:54 pm

See https://forums.gentoo.org/viewtopic-t-1174011-highlight-.html for summary and solution - jankom

[Administrator edit: Fixed link. OP had explicitly set the link to point nowhere using [topic=], despite using a URL as the text of the link. -Hu]
Last edited by jankom on Mon May 05, 2025 8:55 pm, edited 1 time in total.
Top
dmpogo
Advocate
Advocate
Posts: 3717
Joined: Thu Sep 02, 2004 9:21 pm
Location: Canada

Re: Solved

  • Quote

Post by dmpogo » Mon May 05, 2025 7:57 pm

jankom wrote:See [topic=]viewtopic-t-1174011-highlight-.html[/topic] for summary and solution - jankom
Link seems broken
Top
jankom
Guru
Guru
Posts: 545
Joined: Mon Aug 30, 2021 4:18 pm
Location: USA
Contact:
Contact jankom
Website

  • Quote

Post by jankom » Mon May 05, 2025 9:02 pm

:oops: Sorry about that - jankom
Top
Post Reply

17 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

 

 

magic