Discussion:
No rc.d script for dhcpd?
(too old to reply)
Robert Riches
2018-03-10 05:06:44 UTC
Permalink
Raw Message
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.

Is there something else that is supposed to start and stop it?

I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?

Thanks,
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Rich
2018-03-10 06:56:16 UTC
Permalink
Raw Message
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.

On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
Post by Robert Riches
Is there something else that is supposed to start and stop it?
Likely. Look into rc.inet1.conf and rc.inet1 (and/or grep the files to
see where it gets launched).
Post by Robert Riches
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
One good reason would be that the rc scripts are already setup to
launch it for you, so you'd just be overriding what is already present.
Eef Hartman
2018-03-10 11:16:46 UTC
Permalink
Raw Message
Post by Rich
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.
On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
Note: you're talking about a different daemon:
dhcpcd is the _client_ daemon, while dhcpd is the server (that gives
out IP addresses from a range of those on a certain interface).
Rich
2018-03-10 15:38:52 UTC
Permalink
Raw Message
Post by Eef Hartman
Post by Rich
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.
On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
dhcpcd is the _client_ daemon, while dhcpd is the server (that gives
out IP addresses from a range of those on a certain interface).
Ah, right you are, but at least in 14.1, there is also a USE_DHCP[X]
variable for each interface.

Looking into rc.inet1 again, there is a section that is conditional
upon that variable being set to "yes".

Some lines down from the conditional, is this:

/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}

Which does launch the client deamon to configure the interface.

So that is also there, and as well, the 'grep' command I suggested
would have found both for you, then you could have picked apart the
exact one yourself.
Robert Riches
2018-03-11 01:57:09 UTC
Permalink
Raw Message
Post by Rich
Post by Eef Hartman
Post by Rich
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.
On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
dhcpcd is the _client_ daemon, while dhcpd is the server (that gives
out IP addresses from a range of those on a certain interface).
Ah, right you are, but at least in 14.1, there is also a USE_DHCP[X]
variable for each interface.
Looking into rc.inet1 again, there is a section that is conditional
upon that variable being set to "yes".
/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}
Which does launch the client deamon to configure the interface.
So that is also there, and as well, the 'grep' command I suggested
would have found both for you, then you could have picked apart the
exact one yourself.
Doing 'grep -ri dhcp /etc/rc.d' discovers mention in these files:
/etc/rc.d/rc.networkmanager
/etc/rc.d/rc.S
/etc/rc.d/rc.M
/etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.wireless
/etc/rc.d/rc.inet1
/etc/rc.d/rc.6
/etc/rc.d/rc.inet1.conf

I had already done a grep of '/etc/rc.d/rc.?', which had found
references to the client side. The other files that the 'grep
-ri ...' found are also for the client side.

Thanks for the suggestions, but all of those references are for
the client side.
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Rich
2018-03-11 05:14:24 UTC
Permalink
Raw Message
Post by Robert Riches
Post by Rich
Post by Eef Hartman
Post by Rich
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.
On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
dhcpcd is the _client_ daemon, while dhcpd is the server (that gives
out IP addresses from a range of those on a certain interface).
Ah, right you are, but at least in 14.1, there is also a USE_DHCP[X]
variable for each interface.
Looking into rc.inet1 again, there is a section that is conditional
upon that variable being set to "yes".
/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}
Which does launch the client deamon to configure the interface.
So that is also there, and as well, the 'grep' command I suggested
would have found both for you, then you could have picked apart the
exact one yourself.
/etc/rc.d/rc.networkmanager
/etc/rc.d/rc.S
/etc/rc.d/rc.M
/etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.wireless
/etc/rc.d/rc.inet1
/etc/rc.d/rc.6
/etc/rc.d/rc.inet1.conf
I had already done a grep of '/etc/rc.d/rc.?', which had found
references to the client side. The other files that the 'grep
-ri ...' found are also for the client side.
Thanks for the suggestions, but all of those references are for
the client side.
Indeed. Double checking my 14.1 rc files, they are also all for the
client side.

Another poster mentioned Alien Bob had a script. It seems to live
here:

http://www.slackware.com/~alien/rc_scripts/other_rc_scripts/rc.dhcpd

So if you don't want to create your own, you could use that one.
Robert Riches
2018-03-13 02:33:51 UTC
Permalink
Raw Message
Post by Rich
Post by Robert Riches
Post by Rich
Post by Eef Hartman
Post by Rich
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
The 'grep' command is your friend here. Try running "grep dhcp
/etc/rc.d/*" and see what comes up.
On my 14.1 system, dhcpcd is launched on any given interface by
rc.inet1 depending upon the "USE_DHCP[#]" setting from rc.inet1.conf.
dhcpcd is the _client_ daemon, while dhcpd is the server (that gives
out IP addresses from a range of those on a certain interface).
Ah, right you are, but at least in 14.1, there is also a USE_DHCP[X]
variable for each interface.
Looking into rc.inet1 again, there is a section that is conditional
upon that variable being set to "yes".
/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}
Which does launch the client deamon to configure the interface.
So that is also there, and as well, the 'grep' command I suggested
would have found both for you, then you could have picked apart the
exact one yourself.
/etc/rc.d/rc.networkmanager
/etc/rc.d/rc.S
/etc/rc.d/rc.M
/etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.wireless
/etc/rc.d/rc.inet1
/etc/rc.d/rc.6
/etc/rc.d/rc.inet1.conf
I had already done a grep of '/etc/rc.d/rc.?', which had found
references to the client side. The other files that the 'grep
-ri ...' found are also for the client side.
Thanks for the suggestions, but all of those references are for
the client side.
Indeed. Double checking my 14.1 rc files, they are also all for the
client side.
Another poster mentioned Alien Bob had a script. It seems to live
http://www.slackware.com/~alien/rc_scripts/other_rc_scripts/rc.dhcpd
So if you don't want to create your own, you could use that one.
Got it. Thanks.
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Lew Pitcher
2018-03-11 15:35:00 UTC
Permalink
Raw Message
Robert Riches wrote:
[snip]
Post by Robert Riches
/etc/rc.d/rc.networkmanager
/etc/rc.d/rc.S
/etc/rc.d/rc.M
/etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.wireless
/etc/rc.d/rc.inet1
/etc/rc.d/rc.6
/etc/rc.d/rc.inet1.conf
I had already done a grep of '/etc/rc.d/rc.?', which had found
references to the client side. The other files that the 'grep
-ri ...' found are also for the client side.
Thanks for the suggestions, but all of those references are for
the client side.
In lieu of an official launch script, I launch my /etc/rc.d/rc.dhcpd from
/etc/rc.d/rc.local
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Robert Riches
2018-03-13 02:34:36 UTC
Permalink
Raw Message
Post by Lew Pitcher
[snip]
Post by Robert Riches
/etc/rc.d/rc.networkmanager
/etc/rc.d/rc.S
/etc/rc.d/rc.M
/etc/rc.d/rc.dnsmasq
/etc/rc.d/rc.wireless
/etc/rc.d/rc.inet1
/etc/rc.d/rc.6
/etc/rc.d/rc.inet1.conf
I had already done a grep of '/etc/rc.d/rc.?', which had found
references to the client side. The other files that the 'grep
-ri ...' found are also for the client side.
Thanks for the suggestions, but all of those references are for
the client side.
In lieu of an official launch script, I launch my /etc/rc.d/rc.dhcpd from
/etc/rc.d/rc.local
Thanks for that suggestion. Another branch of the thread
recommended Alien Bob's script, which I downloaded and
installed.
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Chris Elvidge
2018-03-10 11:43:24 UTC
Permalink
Raw Message
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
Is there something else that is supposed to start and stop it?
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
Thanks,
Are you sure dhcpd is installed (/usr/sbin/dhcpd)?
If so there's a script here:
http://www.slackware.com/~alien/rc_scripts/other_rc_scripts/rc.dhcpd
--
Chris Elvidge, England
Lew Pitcher
2018-03-10 16:07:59 UTC
Permalink
Raw Message
Post by Chris Elvidge
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
Is there something else that is supposed to start and stop it?
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
Thanks,
Are you sure dhcpd is installed (/usr/sbin/dhcpd)?
http://www.slackware.com/~alien/rc_scripts/other_rc_scripts/rc.dhcpd
Back with Slackware 13 (or before) I started running the DHCP server (dhcpd)
on my server system. PV didn't supply a startup script (and I didn't know
about alianbob's script), so I crafted one myself, based on other Slackware
rc.d scripts

v-------- /etc/rc.d/rc.dhcpd --- start ----------------------------------v
#!/bin/sh
# rc.dhcpd - Script to start/stop/restart DHCP server
# 2012-02-12 - Version 1.0 - Lew Pitcher

# Start dhcpd:
dhcpd_start() {
/usr/bin/logger -s -t "${0##*/}[$$]" "Starting dhcp daemon"
/usr/sbin/dhcpd -pf /var/run/dhcpd.pid eth0
}

# Stop dhcpd:
dhcpd_stop() {
/usr/bin/logger -s -t "${0##*/}[$$]" "Stopping dhcp daemon"
kill $(cat /var/run/dhcpd.pid)
sleep 1
rm -f /var/run/dhcpd.pid
}

# Restart dhcpd:
dhcpd_restart() {
dhcpd_stop
sleep 1
dhcpd_start
}

# Check if dhcpd is running
dhcpd_status() {
if [ -e /var/run/dhcpd.pid ]; then
echo "${0##*/}[$$]: dhcpd is running - PID $(cat /var/run/dhcpd.pid)"
else
echo "${0##*/}[$$]: dhcpd is stopped."
exit 1
fi
}

case "$1" in
'start')
dhcpd_start
;;
'stop')
dhcpd_stop
;;
'restart')
dhcpd_restart
;;
'status')
dhcpd_status
;;
*)
echo "${0##*/}[$$]: Usage $0 start|stop|restart|status"
esac
^-------- /etc/rc.d/rc.dhcpd --- end ----------------------------------^
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Robert Riches
2018-03-11 01:59:55 UTC
Permalink
Raw Message
Post by Lew Pitcher
Post by Chris Elvidge
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
Is there something else that is supposed to start and stop it?
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
Thanks,
Are you sure dhcpd is installed (/usr/sbin/dhcpd)?
http://www.slackware.com/~alien/rc_scripts/other_rc_scripts/rc.dhcpd
Back with Slackware 13 (or before) I started running the DHCP server (dhcpd)
on my server system. PV didn't supply a startup script (and I didn't know
about alianbob's script), so I crafted one myself, based on other Slackware
rc.d scripts
v-------- /etc/rc.d/rc.dhcpd --- start ----------------------------------v
#!/bin/sh
# rc.dhcpd - Script to start/stop/restart DHCP server
# 2012-02-12 - Version 1.0 - Lew Pitcher
dhcpd_start() {
/usr/bin/logger -s -t "${0##*/}[$$]" "Starting dhcp daemon"
/usr/sbin/dhcpd -pf /var/run/dhcpd.pid eth0
}
dhcpd_stop() {
/usr/bin/logger -s -t "${0##*/}[$$]" "Stopping dhcp daemon"
kill $(cat /var/run/dhcpd.pid)
sleep 1
rm -f /var/run/dhcpd.pid
}
dhcpd_restart() {
dhcpd_stop
sleep 1
dhcpd_start
}
# Check if dhcpd is running
dhcpd_status() {
if [ -e /var/run/dhcpd.pid ]; then
echo "${0##*/}[$$]: dhcpd is running - PID $(cat /var/run/dhcpd.pid)"
else
echo "${0##*/}[$$]: dhcpd is stopped."
exit 1
fi
}
case "$1" in
'start')
dhcpd_start
;;
'stop')
dhcpd_stop
;;
'restart')
dhcpd_restart
;;
'status')
dhcpd_status
;;
*)
echo "${0##*/}[$$]: Usage $0 start|stop|restart|status"
esac
^-------- /etc/rc.d/rc.dhcpd --- end ----------------------------------^
To answer the first question: Yes, /usr/sbin/dhcpd is installed.

Thank you both for the pointer to both scripts. I'll take a look
at them both and use one, probably intact.

Thanks.
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
John Forkosh
2018-03-13 04:17:42 UTC
Permalink
Raw Message
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
Is there something else that is supposed to start and stop it?
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
Thanks,
followup question: Along with the dhcpd scripts suggested in the
followup answers, you guys have suggestions for an accompanying
iptables firewall script (or something-else-based firewall script)
to run just before running dhcpd? Thanks again,
--
John Forkosh ( mailto: ***@f.com where j=john and f=forkosh )
Robert Riches
2018-03-14 00:43:03 UTC
Permalink
Raw Message
Post by John Forkosh
Post by Robert Riches
When I graduate to running Slackware 14.2 on my main machine
(currently practicing configuring a test VM), I will need to run
dhcpd on one of two NICs. In the test VM, I notice there does
not appear to be a script in /etc/rc.d to start and stop dhcpd.
Is there something else that is supposed to start and stop it?
I suppose I could start it from rc.local. Are there any known
good reasons to _not_ do that?
Thanks,
followup question: Along with the dhcpd scripts suggested in the
followup answers, you guys have suggestions for an accompanying
iptables firewall script (or something-else-based firewall script)
to run just before running dhcpd? Thanks again,
John, thanks for asking that. I'm also interested in the answers
to that question.

For what little it might be worth, my plan is to continue using
some old Firestarter files. Yes, I know Firestarter is terribly
obsolete. Several years ago, I generated a configuration of
files (in /etc/firestarter and subdirectories) using the
Firestarter GUI. Since then, I have been manually editing the
files as needs have changed by a port here and there. So far, on
the Slackware 14.2 test VM, it looks like it works well.

HTH
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Eef Hartman
2018-03-18 17:46:49 UTC
Permalink
Raw Message
Post by John Forkosh
iptables firewall script (or something-else-based firewall script)
to run just before running dhcpd? Thanks again,
The problem is: there is no "one config fits all" or even "most" setup
for that, especially WHEN you're running a dhcp server.

The simplest case is: reject EVERYTHING that is NOT a response to a
local outgoing request and do not forward anything at all, but of
course that means no server functions:
- no webserver (httpd)
- no file server (nfs, smb or likewise)
- no printer server either
- no remote access (ssh and such)
- no dhcp services
- no access at all from wifi devices like smart-phone or tablet
or Virtual Machines

So the default "iptables" config is very much site-dependant as only
YOU know which incoming services should NOT be blocked.
And of course which kernel modules you need for that is dependant too
on whether you're running the "huge" or the "generic" kernel (or maybe
even your own compiled one).

The "default" scripts we were using are between 60 (local "calculation
cluster", not much access from outside) to 130 (workstations) lines
and they could be modified on each and every workstation by additional
local rules. In total we had 18 different rule sets, started by a more
then 150 long "rc.iptables" script.

Just as an example I'll give you the "stop" functionality:
stop)
test -r /proc/net/ip_tables_names ||
{
echo "Packetfiltering using iptables is not enabled."
exit 0
}

echo "Turning off packet filtering using iptables ..."
echo 0 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD DROP
# Flush all chains in both tables
$IPTABLES -F -t nat
$IPTABLES -F -t filter
# Delete all User-specified chains
$IPTABLES -X -t nat
$IPTABLES -X -t filter
# Reset all IPTABLES counters
$IPTABLES -Z
$IPTABLES -L -n
;;
(and this was pre-IPv6 networking, so it only does IPv4).

"nat" is the local network, i.e. wifi, "filter" the Internet one.

PS: the variable IPTABLES is the full pathname of the iptables
executable, often /usr/sbin/iptables (but as it can change we'd
rather do it with a single definition).

Loading...