ubuntuusers.de

DHCP Service nicht startbar (isc-dhcp-server)

Status: Gelöst | Ubuntu-Version: Ubuntu 16.04 (Xenial Xerus)
Antworten |

MarvinMcFly

Anmeldungsdatum:
7. Juli 2016

Beiträge: 15

Hallo,

ich habe Probiert einen DHCP Server unter Debian 8.3 mit isc-dhcp-server einzurichten. Leider bekomme ich beim starten des Service folgenden Fehler:

Befehl: systemctl status isc-dhcp-server.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
? isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server)
   Active: failed (Result: exit-code) since Mo 2017-05-15 13:11:10 CEST; 8min ago
  Process: 455 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

Mai 15 13:11:08 ****** dhcpd[526]: bugs on either our web page at www.isc.or...le
Mai 15 13:11:08 ****** dhcpd[526]: before submitting a bug.  These pages exp...er
Mai 15 13:11:08 ****** dhcpd[526]: process and the information we find helpf.....
Mai 15 13:11:08 ****** dhcpd[526]:
Mai 15 13:11:08 ****** dhcpd[526]: exiting.
Mai 15 13:11:10 ****** isc-dhcp-server[455]: Starting ISC DHCP server: dhcpdc...!
Mai 15 13:11:10 ****** isc-dhcp-server[455]: failed!
Mai 15 13:11:10 ****** systemd[1]: isc-dhcp-server.service: control process ...=1
Mai 15 13:11:10 ****** systemd[1]: Failed to start LSB: DHCP server.
Mai 15 13:11:10 ****** systemd[1]: Unit isc-dhcp-server.service entered fail...e.
Hint: Some lines were ellipsized, use -l to show in full.

die Konfiguration des System ist wie Folgt:

/etc/network/interfaces

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.192
gateway 192.168.1.1

/etc/default/isc-dhcp-server

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"

/etc/dhcp/dhcp.conf

1
2
3
4
5
6
7
8
subnet 192.168.1.0 netmask 255.255.255.192{
        option subnet-mask 255.255.255.192;
        option broadcast-address 192.168.1.63;
        option routers 192.168.1.1;
        pool{
                range 192.168.1.2 192.168.1.60;
        }
}

Habe ich ein Fehler in der Konfiguration? Liegt mein Fehler ganz wo anders? Vorab Danke für die Hilfe!

kB Team-Icon

Supporter, Wikiteam
Avatar von kB

Anmeldungsdatum:
4. Oktober 2007

Beiträge: 9615

Wohnort: Münster

MarvinMcFly schrieb:

[…] /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.192
gateway 192.168.1.1
  • Welche Dateien bindest Du über source ein? Wenn die Antwort „keine“ lautet, entferne diese Zeile.

  • Es ist Unfug, die Default-Route eines Rechners auf sich selber zeigen zu lassen. Entferne die Zeile "gateway 192.168.1.1".

[…] /etc/dhcp/dhcp.conf

subnet 192.168.1.0 netmask 255.255.255.192{
        option subnet-mask 255.255.255.192;
        option broadcast-address 192.168.1.63;
        option routers 192.168.1.1;
        pool{
                range 192.168.1.2 192.168.1.60;
        }
}
  • Wenn Du den Clients diesen Rechner als Router ankündigst, sollte er natürlich auch als Router fungieren! (Das ist aber nicht der primäre Fehler!)

.

Sessa135

Anmeldungsdatum:
24. Mai 2017

Beiträge: 46

Hallo,

das Thema ist schon etwas älter, passt jedoch super zu meinem Problem.

Habe eine Testumgebung, auf der ich den DHCP Dienst installiert habe (Debian 9).

Folgende Konfigurationen liegen vor:

/etc/network/interfaces

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

auto lo
iface lo inet loopback

iface eth1 inet manual

auto vmbr0
iface vmbr0 inet static
  address 185.248.142.162
  netmask 255.255.255.240
  gateway 185.248.142.161

  bridge_ports eth1
  bridge_stp off
  bridge_fd 0

/etc/default/isc-dhcp-server

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="eth1"
INTERFACESv6=""

/etc/dhcp/dhcpd.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

default-lease-time         3600;
max-lease-time             7200;
option subnet-mask         255.255.255.240;
option broadcast-address   185.248.142.175;
option routers             185.248.142.161;
option domain-name-servers 8.8.8.8;
option domain-name         Domain.de";

subnet 185.248.142.160 netmask 255.255.255.240 {
  range 185.248.142.164 185.248.142.174;
}

Beim Starten des Services erscheint folgender Fehler:

1
2
3
[....] Starting isc-dhcp-server (via systemctl): isc-dhcp-server.serviceJob for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
failed!

Ausgabe dazu:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-05-11 21:46:37 CEST; 39s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4142 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)
      CPU: 29ms

Mai 11 21:46:35 Hostname.de systemd[1]: Starting LSB: DHCP server...
Mai 11 21:46:35 Hostname.de isc-dhcp-server[4142]: Launching IPv4 server only.
Mai 11 21:46:35 Hostname.de dhcpd[4162]: Wrote 0 leases to leases file.
Mai 11 21:46:37 Hostname.de isc-dhcp-server[4142]: Starting ISC DHCPv4 server: dhcpdcheck syslog for diagnostics. ... failed!
Mai 11 21:46:37 Hostname.de isc-dhcp-server[4142]:  failed!
Mai 11 21:46:37 Hostname.de systemd[1]: isc-dhcp-server.service: Control process exited, code=exited status=1
Mai 11 21:46:37 Hostname.de systemd[1]: Failed to start LSB: DHCP server.
Mai 11 21:46:37 Hostname.de systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Mai 11 21:46:37 Hostname.de systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.

Wo liegt der Fehler? NIC ist ETH1. Ist auch UP.

cflinux

Anmeldungsdatum:
14. Januar 2013

Beiträge: 685

Hallo

auto lo
iface lo inet loopback

auto eth1                 # sollte das nicht hier stehen
iface eth1 inet manual

auto vmbr0
iface vmbr0 inet static
  address 185.248.142.162
  netmask 255.255.255.240
  gateway 185.248.142.161

  bridge_ports eth1
  bridge_stp off
  bridge_fd 0

Gruß cflinux

Sessa135

Anmeldungsdatum:
24. Mai 2017

Beiträge: 46

Hallo,

habe ich angepasst. Leider kommt erneut die "Failed" Meldung, sobald ich "/etc/init.d/isc-dhcp-server start" ausführen.

cflinux

Anmeldungsdatum:
14. Januar 2013

Beiträge: 685

Hallo

Wie sieht den die /etc/init.d/isc-dhcp-server aus? Ich glaube ich kann mich dunkel erinnern, das die nicht ganz korrekt war.

Gruß cflinux

Sessa135

Anmeldungsdatum:
24. Mai 2017

Beiträge: 46

Was genau meinst du? Möchtest du gerne das Script als solches haben? DHCP lief bereits. Musste aber den Host neu installieren. Hatte zuvor an diesem Script nichts geändert.

cflinux

Anmeldungsdatum:
14. Januar 2013

Beiträge: 685

Sessa135 schrieb:

Was genau meinst du? Möchtest du gerne das Script als solches haben? DHCP lief bereits. Musste aber den Host neu installieren. Hatte zuvor an diesem Script nichts geändert.

Ja, ich glaube, dar war mal was.

Gruß cflinux

Sessa135

Anmeldungsdatum:
24. Mai 2017

Beiträge: 46

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/sh

### BEGIN INIT INFO
# Provides:          isc-dhcp-server
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Should-Start:      $local_fs slapd $named
# Should-Stop:       $local_fs slapd
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: DHCP server
# Description:       Dynamic Host Configuration Protocol Server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

test -f /usr/sbin/dhcpd || exit 0

DHCPD_DEFAULT="${DHCPD_DEFAULT:-/etc/default/isc-dhcp-server}"

# It is not safe to start if we don't have a default configuration...
if [ ! -f "$DHCPD_DEFAULT" ]; then
        echo "$DHCPD_DEFAULT does not exist! - Aborting..."
        if [ "$DHCPD_DEFAULT" = "/etc/default/isc-dhcp-server" ]; then
                echo "Run 'dpkg-reconfigure isc-dhcp-server' to fix the problem."
        fi
        exit 0
fi

. /lib/lsb/init-functions

# Read init script configuration
[ -f "$DHCPD_DEFAULT" ] && . "$DHCPD_DEFAULT"

NAME4=dhcpd
NAME6=dhcpd6

DESC4="ISC DHCPv4 server"
DESC6="ISC DHCPv6 server"

# use already specified config file or fallback to defaults
DHCPDv4_CONF=${DHCPDv4_CONF:-/etc/dhcp/dhcpd.conf}
DHCPDv6_CONF=${DHCPDv6_CONF:-/etc/dhcp/dhcpd6.conf}

# try to read pid file name from config file or fallback to defaults
if [ -z "$DHCPDv4_PID" ]; then
        DHCPDv4_PID=$(sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < "$DHCPDv4_CONF" 2>/dev/null | head -n 1)
fi
if [ -z "$DHCPDv6_PID" ]; then
        DHCPDv6_PID=$(sed -n -e 's/^[ \t]*dhcpv6-pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < "$DHCPDv6_CONF" 2>/dev/null | head -n 1)
fi
DHCPDv4_PID="${DHCPDv4_PID:-/var/run/dhcpd.pid}"
DHCPDv6_PID="${DHCPDv6_PID:-/var/run/dhcpd6.pid}"

test_config()
{
        VERSION="$1"
        CONF="$2"

        if ! /usr/sbin/dhcpd -t $VERSION -q -cf "$CONF" > /dev/null 2>&1; then
                echo "dhcpd self-test failed. Please fix $CONF."
                echo "The error was: "
                /usr/sbin/dhcpd -t $VERSION -cf "$CONF"
                exit 1
        fi
}

check_status()
{
        OPTION="$1"
        PIDFILE="$2"
        NAME="$3"

        if [ ! -r "$PIDFILE" ]; then
                test "$OPTION" != -v || echo "$NAME is not running."
                return 3
        fi

        if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
                test "$OPTION" != -v || echo "$NAME is running."
                return 0
        else
                test "$OPTION" != -v || echo "$NAME is not running but $PIDFILE exists."
                return 1
        fi
}

start_daemon()
{
        VERSION="$1"
        CONF="$2"
        NAME="$3"
        PIDFILE="$4"
        DESC="$5"

        shift 5
        INTERFACES="$*"

        test_config "$VERSION" "$CONF"
        log_daemon_msg "Starting $DESC" "$NAME"

        if [ -e "$PIDFILE" ]; then
                log_failure_msg "dhcpd service already running (pid file $PIDFILE currenty exists)"
                exit 1
        fi

        touch /var/lib/dhcp/$NAME.leases

        start-stop-daemon --start --quiet --pidfile $PIDFILE \
                --exec /usr/sbin/dhcpd -- $VERSION -q -cf $CONF $INTERFACES
        sleep 2

        if check_status -q $PIDFILE $NAME; then
                log_end_msg 0
        else
                log_failure_msg "check syslog for diagnostics."
                log_end_msg 1
                exit 1
        fi
}

stop_daemon()
{
        if check_status -q $DHCPDv4_PID $NAME4; then
                log_daemon_msg "Stopping $DESC4" "$NAME4"
                start-stop-daemon --stop --quiet --pidfile $DHCPDv4_PID
                log_end_msg $?
                rm -f "$DHCPDv4_PID"
        fi

        if check_status -q $DHCPDv6_PID $NAME6; then
                log_daemon_msg "Stopping $DESC6" "$NAME6"
                start-stop-daemon --stop --quiet --pidfile $DHCPDv6_PID
                log_end_msg $?
                rm -f "$DHCPDv6_PID"
        fi
}

case "$1" in
        start)
                if test -n "$INTERFACES" -a -z "$INTERFACESv4"; then
                        echo "DHCPv4 interfaces are no longer set by the INTERFACES variable in" >&2
                        echo "/etc/default/isc-dhcp-server.  Please use INTERFACESv4 instead." >&2
                        echo "Migrating automatically for now, but this will go away in the future." >&2
                        INTERFACESv4="$INTERFACES"
                fi
                if test -n "$INTERFACESv4"; then
                        echo "Launching IPv4 server only."
                        start_daemon "-4" "$DHCPDv4_CONF" "$NAME4" \
                                "$DHCPDv4_PID" "$DESC4" "$INTERFACESv4"
                fi
                if test -n "$INTERFACESv6"; then
                        echo "Launching IPv6 server only."
                        start_daemon "-6" "$DHCPDv6_CONF" "$NAME6" \
                                "$DHCPDv6_PID" "$DESC6" "$INTERFACESv6"
                fi
                if test -z "$INTERFACESv4" -a -z "$INTERFACESv6"; then
                        echo "Launching both IPv4 and IPv6 servers (please configure INTERFACES in /etc/default/isc-dhcp-server if you only want one or the other)."
                        start_daemon "-4" "$DHCPDv4_CONF" "$NAME4" \
                                "$DHCPDv4_PID" "$DESC4" ""
                        start_daemon "-6" "$DHCPDv6_CONF" "$NAME6" \
                                "$DHCPDv6_PID" "$DESC6" ""
                fi
                ;;
        stop)
                stop_daemon
                ;;
        restart | force-reload)
                $0 stop
                sleep 2
                $0 start
                if [ "$?" != "0" ]; then
                        exit 1
                fi
                ;;
        status)
                if test -n "$INTERFACES" -a -z "$INTERFACESv4"; then
                        INTERFACESv4="$INTERFACES"
                fi
                if test -n "$INTERFACESv4"; then
                        echo -n "Status of $DESC4: "
                        check_status -v $DHCPDv4_PID $NAME4 || exit $?
                fi
                if test -n "$INTERFACESv6"; then
                        echo -n "Status of $DESC6: "
                        check_status -v $DHCPDv6_PID $NAME6 || exit $?
                fi
                ;;
        *)
                echo "Usage: $0 {start|stop|restart|force-reload|status}"
                exit 1
esac

exit 0

cflinux

Anmeldungsdatum:
14. Januar 2013

Beiträge: 685

Hallo

Probiere mal dieses InitSkript

#!/bin/sh
#
#

### BEGIN INIT INFO
# Provides:          isc-dhcp-server
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Should-Start:      $local_fs slapd $named
# Should-Stop:       $local_fs slapd
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: DHCP server
# Description:       Dynamic Host Configuration Protocol Server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

test -f /usr/sbin/dhcpd || exit 0

DHCPD_DEFAULT="${DHCPD_DEFAULT:-/etc/default/isc-dhcp-server}"

# It is not safe to start if we don't have a default configuration...
if [ ! -f "$DHCPD_DEFAULT" ]; then
	echo "$DHCPD_DEFAULT does not exist! - Aborting..."
	if [ "$DHCPD_DEFAULT" = "/etc/default/isc-dhcp-server" ]; then
		echo "Run 'dpkg-reconfigure isc-dhcp-server' to fix the problem."
	fi
	exit 0
fi

. /lib/lsb/init-functions

# Read init script configuration
[ -f "$DHCPD_DEFAULT" ] && . "$DHCPD_DEFAULT"

NAME=dhcpd
DESC="ISC DHCP server"
# fallback to default config file
DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
# try to read pid file name from config file, with fallback to /var/run/dhcpd.pid
if [ -z "$DHCPD_PID" ]; then
	DHCPD_PID=$(sed -n -e 's/^[ t]*pid-file-name[ t]*"(.*)"[ t]*;.*$/1/p' < "$DHCPD_CONF" 2>/dev/null | head -n 1)
fi
DHCPD_PID="${DHCPD_PID:-/var/run/dhcpd.pid}"

test_config()
{
	if ! /usr/sbin/dhcpd -t $OPTIONS -q -cf "$DHCPD_CONF" > /dev/null 2>&1; then
		echo "dhcpd self-test failed. Please fix $DHCPD_CONF."
		echo "The error was: "
		/usr/sbin/dhcpd -t $OPTIONS -cf "$DHCPD_CONF"
		exit 1
	fi
	touch /var/lib/dhcp/dhcpd.leases
}

# single arg is -v for messages, -q for none
check_status()
{
    if [ ! -r "$DHCPD_PID" ]; then
	test "$1" != -v || echo "$NAME is not running."
	return 3
    fi
    if read pid < "$DHCPD_PID" && ps -p "$pid" > /dev/null 2>&1; then
	test "$1" != -v || echo "$NAME is running."
	return 0
    else
	test "$1" != -v || echo "$NAME is not running but $DHCPD_PID exists."
	return 1
    fi
}

case "$1" in
	start)
		test_config
		log_daemon_msg "Starting $DESC" "$NAME"
		start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" 			--exec /usr/sbin/dhcpd -- 			-q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES
		sleep 2

		if check_status -q; then
			log_end_msg 0
		else
			log_failure_msg "check syslog for diagnostics."
			log_end_msg 1
			exit 1
		fi
		;;
	stop)
		log_daemon_msg "Stopping $DESC" "$NAME"
		start-stop-daemon --stop --quiet --pidfile "$DHCPD_PID"
		log_end_msg $?
		rm -f "$DHCPD_PID"
		;;
	restart | force-reload)
		test_config
		$0 stop
		sleep 2
		$0 start
		if [ "$?" != "0" ]; then
			exit 1
		fi
		;;
	status)
		echo -n "Status of $DESC: "
		check_status -v
		exit "$?"
		;;
	*)
		echo "Usage: $0 {start|stop|restart|force-reload|status}"
		exit 1 
esac

exit 0

Aber sichere dein altes Init Skript.

Gruß cflinux

Antworten |