Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bug? dnsmasq starts dhcpcd even if configured for DNS only
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
saturnalia0
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2016
Posts: 94

PostPosted: Thu Oct 13, 2016 3:22 am    Post subject: Bug? dnsmasq starts dhcpcd even if configured for DNS only Reply with quote

dnsmasq can provide both DNS and DHCP servers. I have configured it such that it only provides the former, but starting dnsmasq via rc-service causes dhcpcd to be started also.

Code:

$ equery u dnsmasq
...
 - - dhcp          : Enable support for acting as a DHCP server.
 - - dhcp-tools    : Install extra command line tools for manually managing DHCP leases.
...


Code:

$ grep /etc/dnsmasq.conf -Pe '^\w'
domain-needed
bogus-priv
strict-order
listen-address=127.0.0.1
bind-interfaces


If I uninstall dhcpcd then dnsmasq starts successfully, obviously without bringing up dhcpcd with it. Should I fill a bug report?

There's the following line on the "depends" block of /etc/init.d/dhcpcd:

Code:

before dns


I tried commenting it out then `rc-service dhcpcd stop ; rc-service dnsmasq restart`, but dhcpcd is still brought up...
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1361
Location: Montréal

PostPosted: Thu Oct 13, 2016 7:49 am    Post subject: Reply with quote

For sure, if you unmerge dhcpcd, it will not be started. The Dnsmasq dhcp USE flag refer to a dhcp server feature when Dhcpcd is a dhcp client. I do not think that emerge Dnsmasq can emerge Dhcpcd as a dependancy even not any external dhcp server because, Dnsmasq IS a dhcp server.

If Dhcpcd is started as a boot script and/or some network interfaces are configure via dhcp, Dhcpcd will bring up. Be sure with rc-update and in /etc/conf.d/net that nothing need to start a dhcp client.
_________________
Paul
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Oct 13, 2016 9:56 am    Post subject: Reply with quote

dhcpcd provides the net dependency.
dnsmasq requires the net dependency to be up.

dnsmasq handling DHCP has nothing to do with your problem, it's simple services.

SOMETHING has to provide net.
dhcpcd can, /etc/init.d/network and /etc/init.d/net.* do as well.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
saturnalia0
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2016
Posts: 94

PostPosted: Thu Oct 13, 2016 5:03 pm    Post subject: Reply with quote

UberLord wrote:
dhcpcd provides the net dependency.
dnsmasq requires the net dependency to be up.

dnsmasq handling DHCP has nothing to do with your problem, it's simple services.

SOMETHING has to provide net.
dhcpcd can, /etc/init.d/network and /etc/init.d/net.* do as well.


I see. I'm a noob when it comes to init services. Is there any way I can prevent dhcpcd from providing net as to avoid it being started with dnsmasq? I only use dhcpcd at work, at home I have a static ip setup and do not wish it to start (I use dnsmasq both at home and at work). Furthermore I'm not using /etc/init.d/net.* to connect, I'm using a script that calls wpa_supplicant + ip/dhcpcd (not ideal, but again I'm a noob and could not configure /etc/conf.d/net to do what I need) so I'm not sure what could provide net.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1361
Location: Montréal

PostPosted: Fri Oct 14, 2016 6:00 am    Post subject: Reply with quote

There are several ways to resolv your problem with Openrc net service. You can let Openrc start the Dhcpcd service when it start the Dnsmasq service and configure Dhcpcd to configure dynamically your network interface at work and statically at home. Dhcpcd can start by itself Wpa_supplicant for a wireless interface. Dhcpcd can ask for IP and/or DNS configuration. You need to learn how to write /etc/dhcpcd.conf.

An other way is to learn how to configure Openrc net service with /etc/conf.d/net. You can use
Code:
bzless /usr/share/doc/netifrc-0.2.2/net.example.bz2

to have examples on how to do it.

In both cases, you should stop to use a personnal script if you want to learn how to configure your network using the Dhcpcd and the Gentoo ways.

If you absolutely want use configure your network manually with Openrc not starting Dhcpcd when it bring up Dnsmasq, you have to edit /etc/rc.conf to specify what is providing and what is not providing the net service.
_________________
Paul
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Fri Oct 14, 2016 8:39 am    Post subject: Reply with quote

saturnalia0 wrote:

I see. I'm a noob when it comes to init services. Is there any way I can prevent dhcpcd from providing net as to avoid it being started with dnsmasq? I only use dhcpcd at work, at home I have a static ip setup and do not wish it to start (I use dnsmasq both at home and at work). Furthermore I'm not using /etc/init.d/net.* to connect, I'm using a script that calls wpa_supplicant + ip/dhcpcd (not ideal, but again I'm a noob and could not configure /etc/conf.d/net to do what I need) so I'm not sure what could provide net.


Why not use add dhcpcd and wpa_supplicant to the default runlevel and configure dhcpcd to assign your static IP for your home network?
It can work it out via SSID or ARPing by itself so no need to run a manual script when changing locations.
See dhcpcd.conf(5) for details on profiles and arping support.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum