|
|
(123 dazwischenliegende Versionen von 7 Benutzern werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
| =DHCP (Dynamic Host Configuration Protocol)=
| | '''{{BASEPAGENAME}}''' - Beschreibung |
|
| |
|
| ==Allgemein== | | == Beschreibung == |
| *Erweiterung des Bootstrap-Protokolls (BOOTP)
| |
| *Hintergrundprozess (Dienst/Daemon)
| |
| *RFC 2131
| |
| *Transport durch UDP
| |
| *Standard-Ports:
| |
| **IPv4: 67 (Server) 68 (Client)
| |
| **IPv6: 547 (Server) 546 (Client)
| |
|
| |
|
| ==Aufgabe== | | == Installation == |
| *Clients automatisch in ein bestehendes Netz einbinden,
| | <syntaxhighlight lang="bash" highlight="1" line copy> |
| *Übermittlung der Konfigurationsparameter...
| | sudo apt install isc-dhcp-server |
| **IP-Adresse,
| | </syntaxhighlight> |
| **Netzmaske,
| |
| **Gateway, Router ins nächst höhere Netz,
| |
| **Rechnername,
| |
| **Broadcast-Adresse,
| |
| **Boot-Image für plattenlose Workstations,
| |
| **NetBIOS Nameserver und Name Server (DNS)
| |
| **Time- und NTP-Server, die für die Synchronisierung der Uhrzeit zuständig sind,
| |
|
| |
|
| ==Betriebsmodi== | | == Aufruf == |
| | <syntaxhighlight lang="bash" highlight="1" line copy> |
| | </syntaxhighlight> |
|
| |
|
| *dynamische Zuordnung:
| | === Optionen === |
| ::*automatische Zuordnung mit Lease-Time
| | {| class="wikitable sortable options gnu big" |
| :::Lease-Time: Festlegung wie lange eine IP-Adresse an Client „verliehen“ wird, bevor Client eine „Verlängerung“ beantragen muss
| | |- |
| ::*bei „Nicht-Verlängerung“ wird IP-Adresse frei und neu vergeben
| | ! Unix !! GNU !! Parameter !! Beschreibung |
| | |- |
| | | || || || |
| | |- |
| | |} |
|
| |
|
| *automatische Zuordnung:
| | === Parameter === |
| ::*am DHCP-Server wird ein Bereich (range) von IP-Adressen definiert.
| | === Umgebungsvariablen === |
| ::*IP-Adressen werden automatisch an die MAC-Adressen von neuen DHCP-Clients zugewiesen und keinem anderen Host mehr zugewiesen
| | === Exit-Status === |
| ::*Zuweisungen sind permanent (siehe /var/lib/dhcpd.leases)
| | {| class="wikitable options col1center big" |
| ::*Neue Clients erhalten keine IP-Adresse, wenn Adressbereich vergeben, auch wenn IP-Adressen nicht aktiv genutzt werden
| | |- |
| | ! Wert !! Beschreibung |
| | |- |
| | | 0 || Erfolg |
| | |- |
| | | >0 || Fehler |
| | |} |
|
| |
|
| *statische Zuordnung:
| | == Anwendung == |
| ::*IP-Adressen werden MAC-Adressen fest zugeordnet; wichtig bei Port-Weiterleitungen oder wenn DHCP-Client Server-Dienste zur Verfügung stellt
| | ; Dienssteuerung |
| ::*kein „einfaches“ Einbinden von neuen Clients
| | Nach der Änderung der Konfiguration muss die dhcpd.conf erneut eingelesen werden |
| | <syntaxhighlight lang="bash" highlight="1" line copy> |
| | sudo systemctl restart isc-dhcp-server.service |
| | </syntaxhighlight> |
|
| |
|
| ==Ablauf== | | === Problembehebung === |
|
| |
|
| | <noinclude> |
|
| |
|
| | == Anhang == |
| | === Siehe auch === |
| | <div style="column-count:2"> |
| | <categorytree hideroot=on mode="pages">{{BASEPAGENAME}}</categorytree> |
| | </div> |
| | ---- |
| | {{Special:PrefixIndex/{{BASEPAGENAME}}/}} |
|
| |
|
| | === Dokumentation === |
| | ; Man-Page |
| | # [https://manpages.debian.org/stable/procps/pgrep.1.de.html prep(1)] |
|
| |
|
| [[Datei: DHCP.png|1200px|thumb|DHCP Ablauf|center]]
| | <!-- |
| | ; Info-Pages |
| | --> |
|
| |
|
| #DHCP-DISCOVER: Client sucht per Broadcast nach DHCP-Server | | === Links === |
| #DHCP-OFFER: DHCP-Server bietet Client per Unicast Konfigurationsparameter der Schnittstelle an | | ==== Projekt ==== |
| #DHCP-REQUEST: Client fordert angebotene Konfigurationsparameter bei DHCP-Server an (z.B. Mietanfrage) | | ==== Weblinks ==== |
| #DHCP-ACK: DHCP-Server sendet Konfigurationsparameter an Client | | # https://de.wikipedia.org/wiki/DHCP |
| | # https://kb.isc.org/docs/isc-dhcp-41-manual-pages-dhcpdconf |
| | # https://wiki.ubuntuusers.de/ISC-DHCPD/ |
| | # https://wiki.debian.org/de/DHCP_Server |
|
| |
|
| | ; Failover |
| | # https://www.tech-island.com/tutorials/dhcp-failover-linux |
| | # https://kb.isc.org/docs/aa-00502 |
|
| |
|
| *DHCP-NAK: Ablehnung einer DHCPREQUEST-Anforderung durch den DHCP-Server.
| | [[Kategorie:DHCPv4]] |
| *DHCP-DECLINE: Ablehnung durch den Client, da die IP-Adresse schon verwendet wird.
| |
| *DHCP-RELEASE: Der Client gibt die eigene Konfiguration frei, damit die Parameter wieder für andere Clients zur Verfügung stehen.
| |
| *DHCP-INFORM: Anfrage eines Clients nach weiteren Konfigurationsparametern, z. B. weil der Client eine statische IP-Adresse besitzt.
| |
|
| |
|
| | </noinclude> |
|
| |
|
| DHCP-Refresh (nur bei dynamischer Zuordnung)
| | = TMP = |
|
| |
|
| DHCPACK-Nachricht
| |
| IP-Adresse,"lease time" und zwei Fristen: Die "Renewal-Time" T1 und die "Rebinding-Time" T2.
| |
| *T1 1/2 der Lease-Time
| |
| *T2 7/8 der Lease-Time
| |
|
| |
|
| Zum Beispiel:
| | {{:DHCP/Client}} |
|
| |
|
| Lease-Time = 100s => "Renewal-Time" T1 = 50s und "Rebinding-Time" T2 = 87,5s
| | == Fehleranalyse == |
| | | # cat /var/log/syslog | grep "dhcp" |
| | |
| Nach Ablauf T1 versucht der Client, seine Lease-Time zu verlängern.
| |
| | |
| *DHCPREQUESTs per Unicast an bisherigen Server
| |
| **Erfolgt DHCP-ACK: Client erhält bisherige Konfiguration mit frischer Lease-Time
| |
| **Erfolgt kein DHCP-ACK: Client nutzt Konfiguration ohne Einschränkungen weiter
| |
| | |
| Nach Ablauf von T2 sendet Client DHCPREQUESTs per Broadcast an irgendeinen anderen DHCP-Server
| |
| | |
| Läuft die Lease-Time ab so verfällt die Konfiguration und Client beginnt erneut mit eunem DHCP-DISCOVER.
| |
| | |
| Sind alle IP-Adressen bereits vergeben, sendet Server ein DHCP-NAK (DHCP-Not Acknowledged).
| |
| | |
| ==Einrichtung unter Linux/Debian am Beispiel "isc-dhcp-server"==
| |
| | |
| ====Installation====
| |
| | |
| <pre>root@router0230:~# apt install isc-dhcp-server</pre>
| |
| | |
| ====Konfiguration====
| |
| | |
| /etc/dhcp/dhcpd.conf
| |
| | |
| *Lease-Time in Sekunden
| |
| | |
| <pre>default-lease-time 600;
| |
| max-lease-time 7200;</pre>
| |
| | |
| *Subnet-Blöcke
| |
| | |
| <pre>subnet 10.30.30.0 netmask 255.255.255.0</pre>
| |
| | |
| *Range
| |
| | |
| <pre>range 10.30.30.10 10.30.30.99;</pre>
| |
| | |
| *Options
| |
| | |
| <pre>option subnet-mask 255.255.255.0;
| |
| option domain-name-servers 10.0.0.3, 10.0.0.4;
| |
| option domain-name "raum102.itw";
| |
| option domain-search "raum102.itw";
| |
| option routers 10.30.30.1;
| |
| option broadcast-address 10.30.30.255;</pre>
| |
| | |
| | |
| Nach der Änderung der Konfiguration, muss die dhcpd.conf erneut eingelesen werden.
| |
| | |
| <pre>root@router0230:~# systemctl restart isc-dhcp-server.service</pre>
| |
| | |
| | |
| Damit Änderungen bei bereits aktivem Client wirksam werden, muss dieser sie neu anfordern.
| |
| | |
| | |
| Bisherige Konfiguration verwerfen.
| |
| <pre>root@router0230:~# dhclient -r</pre>
| |
| | |
| Neue Konfiguration anfordern.
| |
| <pre>root@router0230:~# dhclient</pre>
| |
| | |
| ====Fehlerauslesung====
| |
| | |
| /var/log/syslog
| |
| | |
| <pre>root@router0230:~# cat /var/log/syslog | grep "dhcp"</pre>
| |
| | |
| Erst Ordner /var/lib/dhcpd erzeugen.
| |
| | |
| <pre>root@router0230:~# touch /var/lib/dhcpd</pre>
| |
| | |
| Dann Datei dhcpd.leases.
| |
| | |
| <pre>root@router0230:~# touch /var/lib/dhcpd/dhcpd.leases</pre>
| |
| | |
| Danach wird diese Datei erst beschrieben und kann ausgelesen werden.
| |
| | |
| <pre>root@router0230:~# cat /var/lib/dhcpd/dhcpd.leases</pre>
| |
| | |
| | |
| | |
| Konfigurationsdatei auf Server
| |
|
| |
|
| | ==Konfigurationsdatei== |
| /etc/dhcp/dhcpd.conf | | /etc/dhcp/dhcpd.conf |
|
| |
|
| <pre>dhcpd.conf
| | log-facility local7; |
| #
| |
| # Sample configuration file for ISC dhcpd
| |
| #
| |
| | |
| # option definitions common to all supported networks...
| |
| #option domain-name "example.org";
| |
| #option domain-name-servers ns1.example.org, ns2.example.org;
| |
| | |
| #default-lease-time 600;
| |
| #max-lease-time 7200;
| |
| | |
| # The ddns-updates-style parameter controls whether or not the server will
| |
| # attempt to do a DNS update when a lease is confirmed. We default to the
| |
| # behavior of the version 2 packages ('none', since DHCP v2 didn't
| |
| # have support for DDNS.)
| |
| #ddns-update-style none;
| |
| | |
| # If this DHCP server is the official DHCP server for the local
| |
| # network, the authoritative directive should be uncommented.
| |
| authoritative;
| |
| | |
| # Use this to send dhcp log messages to a different log file (you also
| |
| # have to hack syslog.conf to complete the redirection).
| |
| log-facility local7; | |
|
| |
| #No service will be given on this subnet, but declaring it helps the
| |
| # DHCP server to understand the network topology.
| |
| | |
| #subnet 10.152.187.0 netmask 255.255.255.0 {
| |
| #}
| |
| | |
| # This is a very basic subnet declaration.
| |
| | |
| #subnet 10.254.239.0 netmask 255.255.255.224 {
| |
| # range 10.254.239.10 10.254.239.20;
| |
| # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
| |
| #}
| |
| | |
| # This declaration allows BOOTP clients to get dynamic addresses,
| |
| # which we don't really recommend.
| |
| | |
| #subnet 10.254.239.32 netmask 255.255.255.224 {
| |
| # range dynamic-bootp 10.254.239.40 10.254.239.60;
| |
| # option broadcast-address 10.254.239.31;
| |
| # option routers rtr-239-32-1.example.org;
| |
| #}
| |
| | |
| # A slightly different configuration for an internal subnet.
| |
| subnet 10.30.30.0 netmask 255.255.255.0 {
| |
| range 10.30.30.10 10.30.30.99;
| |
| option subnet-mask 255.255.255.0;
| |
| option domain-name-servers 10.0.0.3, 10.0.0.4;
| |
| option domain-name "raum102.itw";
| |
| option domain-search "raum102.itw";
| |
| option routers 10.30.30.1;
| |
| option broadcast-address 10.30.30.255;
| |
| default-lease-time 600;
| |
| max-lease-time 7200;
| |
| host user {
| |
| hardware ethernet 00:1d:7d:c8:de:bd;
| |
| fixed-address 10.30.30.5;
| |
| option host-name "user";
| |
| }
| |
| host robert {
| |
| hardware ethernet 74:27:ea:e1:b2:b4;
| |
| fixed-address 10.30.30.6;
| |
| option host-name "robert";
| |
| }
| |
| host meik {
| |
| hardware ethernet 74:27:ea:cc:fe:a0;
| |
| fixed-address 10.30.30.7;
| |
| option host-name "meik";
| |
| }
| |
| host ufuk {
| |
| hardware ethernet 74:27:ea:e1:ba:b1;
| |
| fixed-address 10.30.30.8;
| |
| option host-name "ufuk";
| |
| }
| |
| host tanja {
| |
| hardware ethernet 74:27:ea:e1:b1:e4;
| |
| fixed-address 10.30.30.9;
| |
| option host-name "tanja";
| |
| }
| |
| }
| |
| # Hosts which require special configuration options can be listed in
| |
| # host statements. If no address is specified, the address will be
| |
| # allocated dynamically (if possible), but the host-specific information
| |
| # will still come from the host declaration.
| |
| #host passacaglia {
| |
| # hardware ethernet 0:0:c0:5d:bd:95;
| |
| # filename "vmunix.passacaglia";
| |
| # server-name "toccata.example.com";
| |
| #}
| |
| | |
| # Fixed IP addresses can also be specified for hosts. These addresses
| |
| # should not also be listed as being available for dynamic assignment.
| |
| # Hosts for which fixed IP addresses have been specified can boot using
| |
| # BOOTP or DHCP. Hosts for which no fixed address is specified can only
| |
| # be booted with DHCP, unless there is an address range on the subnet
| |
| # to which a BOOTP client is connected which has the dynamic-bootp flag
| |
| # set.
| |
| #host fantasia {
| |
| # hardware ethernet 08:00:07:26:c0:a5;
| |
| # fixed-address fantasia.example.com;
| |
| #}
| |
| | |
| # You can declare a class of clients and then do address allocation
| |
| # based on that. The example below shows a case where all clients
| |
| # in a certain class get addresses on the 10.17.224/24 subnet, and all
| |
| # other clients get addresses on the 10.0.29/24 subnet.
| |
| | |
| #class "foo" {
| |
| # match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
| |
| #}
| |
| | |
| #shared-network 224-29 {
| |
| # subnet 10.17.224.0 netmask 255.255.255.0 {
| |
| # option routers rtr-224.example.org;
| |
| # }
| |
| # subnet 10.0.29.0 netmask 255.255.255.0 {
| |
| # option routers rtr-29.example.org;
| |
| # }
| |
| # pool {
| |
| # allow members of "foo";
| |
| # range 10.17.224.10 10.17.224.250;
| |
| # }
| |
| # pool {
| |
| # deny members of "foo";
| |
| # range 10.0.29.10 10.0.29.230;
| |
| # }
| |
| #}
| |
| </pre>
| |
| | |
|
| |
|
| Konfigurationsdatei auf Client
| | subnet 10.2.0.0 netmask 255.255.0.0 { |
| | range 10.2.0.10 10.2.0.100; |
| | option subnet-mask 255.255.0.0; |
| | option domain-name-servers 10.10.0.4; |
| | option domain-name "raum102.itw"; |
| | option domain-search "raum102.itw"; |
| | option routers 10.2.0.1; |
| | default-lease-time 600; |
| | max-lease-time 7200; |
| | } |
|
| |
|
| /etc/dhcp/dhclient.conf
| | host user { |
| | hardware ethernet 00:1d:7d:c8:de:bd; |
| | fixed-address 10.2.0.50; |
| | option host-name "user"; |
| | } |
|
| |
|
| <pre># Configuration file for /sbin/dhclient.
| | == DORA: (Discover Offer Request ACK) == |
| #
| | [[Datei:DORA Aufbau.png]] |
| # This is a sample configuration file for dhclient. See dhclient.conf's
| |
| # man page for more information about the syntax of this file
| |
| # and a more comprehensive list of the parameters understood by
| |
| # dhclient.
| |
| #
| |
| # Normally, if the DHCP server provides reasonable information and does
| |
| # not leave anything out (like the domain name, for example), then
| |
| # few changes must be made to this file, if any.
| |
| #
| |
|
| |
|
| option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
| | # DHCP-DISCOVER: Client sucht per Broadcast nach DHCP-Server |
| | # DHCP-OFFER: DHCP-Server bietet Client per Unicast Konfigurationsparameter der Schnittstelle an |
| | # DHCP-REQUEST: Client fordert angebotene Konfigurationsparameter bei DHCP-Server an (beispielsweise Mietanfrage) |
| | # DHCP-ACK: DHCP-Server sendet Konfigurationsparameter an Client |
|
| |
|
| send host-name = gethostname();
| |
| request subnet-mask, broadcast-address, time-offset, routers,
| |
| domain-name, domain-name-servers, domain-search, host-name,
| |
| dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
| |
| netbios-name-servers, netbios-scope, interface-mtu,
| |
| rfc3442-classless-static-routes, ntp-servers;
| |
|
| |
|
| #send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
| |
| #send dhcp-lease-time 3600;
| |
| #supersede domain-name "fugue.com home.vix.com";
| |
| #prepend domain-name-servers 127.0.0.1;
| |
| #require subnet-mask, domain-name-servers;
| |
| #timeout 60;
| |
| #retry 60;
| |
| #reboot 10;
| |
| #select-timeout 5;
| |
| #initial-interval 2;
| |
| #script "/sbin/dhclient-script";
| |
| #media "-link0 -link1 -link2", "link0 link1";
| |
| #reject 192.33.137.209;
| |
|
| |
|
| #alias {
| | * DHCP-NAK: Ablehnung einer DHCP-REQUEST-Anforderung durch den DHCP-Server. |
| # interface "eth0";
| | * DHCP-DECLINE: Ablehnung durch den Client, da die IP-Adresse schon verwendet wird. |
| # fixed-address 192.5.5.213;
| | * DHCP-RELEASE: Der Client gibt die eigene Konfiguration frei, damit die Parameter wieder für andere Clients zur Verfügung stehen. |
| # option subnet-mask 255.255.255.255;
| | * DHCP-INFORM: Anfrage eines Clients nach weiteren Konfigurationsparametern, beispielsweise weil der Client eine statische IP-Adresse besitzt. |
| #}
| | * DHCP-Refresh (nur bei dynamischer Zuordnung) DHCP-ACK-Nachricht<br> |
|
| |
|
| #lease {
| | == Lease Time == |
| # interface "eth0";
| | IP-Adresse,"lease time" und zwei Fristen: Die "Renewal-Time" T1 und die "Rebinding-Time" T2. |
| # fixed-address 192.33.137.200;
| | * T1 1/2 der Lease-Time |
| # medium "link0 link1";
| | * T2 7/8 der Lease-Time |
| # option host-name "andare.swiftmedia.com";
| | === Beispiel === |
| # option subnet-mask 255.255.255.0;
| | * Lease-Time = 100s => "Renewal-Time" T1 = 50s und "Rebinding-Time" T2 = 87,5s |
| # option broadcast-address 192.33.137.255;
| | * Nach Ablauf T1 versucht der Client, seine Lease-Time zu verlängern. |
| # option routers 192.33.137.250;
| | * DHCP-REQUESTs per Unicast an bisherigen Server |
| # option domain-name-servers 127.0.0.1;
| | * * Erfolgt DHCP-ACK: Client erhält bisherige Konfiguration mit frischer Lease-Time |
| # renew 2 2000/1/12 00:00:01;
| | * * Erfolgt kein DHCP-ACK: Client nutzt Konfiguration ohne Einschränkungen weiter |
| # rebind 2 2000/1/12 00:00:01;
| | * Nach Ablauf von T2 sendet Client DHCPREQUESTs per Broadcast an irgendeinen anderen DHCP-Server |
| # expire 2 2000/1/12 00:00:01;
| | * Läuft die Lease-Time ab so verfällt die Konfiguration und Client beginnt erneut mit eunem DHCP-DISCOVER. |
| #}</pre>
| | * Sind alle IP-Adressen bereits vergeben, sendet Server ein DHCP-NAK (DHCP-Not Acknowledged). |
|
| |
|
| ===Quellen=== | | == Ablaufverfolgung == |
| | [[Datei:Wireshark Screenshot.png|900px]] |
|
| |
|
| [https://de.wikipedia.org/wiki/DHCP wikipedia.org]
| | == DHCP-Relay == |
| [https://kb.isc.org/docs/isc-dhcp-41-manual-pages-dhcpdconf isc.org]
| | * Ist eine Funktion, um DHCP über Netzwerkgrenzen (Broadcastdomäne) hinaus nutzen zu können |
| [https://wiki.ubuntuusers.de/ISC-DHCPD/ ubuntuusers.de]
| | * Damit wird die Notwendigkeit der Bereitstellung eines DHCP-Servers in jedem Subnetz, in dem sich DHCP-Clients befinden, vermieden |
| [https://wiki.debian.org/de/DHCP_Server wiki.debian.org]
| | * Die DHCP-Relay-Funktion wird meist durch den Router selbst erbracht |
| | * DHCP-Relay ist notwendig, um die Broadcasts weiterzuleiten. Bitte auf alle interfaces Aktivieren. |
DHCPv4/Server - Beschreibung
Beschreibung
Installation
sudo apt install isc-dhcp-server
Aufruf
Optionen
Unix |
GNU |
Parameter |
Beschreibung
|
|
|
|
|
Parameter
Umgebungsvariablen
Exit-Status
Wert |
Beschreibung
|
0 |
Erfolg
|
>0 |
Fehler
|
Anwendung
- Dienssteuerung
Nach der Änderung der Konfiguration muss die dhcpd.conf erneut eingelesen werden
sudo systemctl restart isc-dhcp-server.service
Problembehebung
Anhang
Siehe auch
Dokumentation
- Man-Page
- prep(1)
Links
Projekt
Weblinks
- https://de.wikipedia.org/wiki/DHCP
- https://kb.isc.org/docs/isc-dhcp-41-manual-pages-dhcpdconf
- https://wiki.ubuntuusers.de/ISC-DHCPD/
- https://wiki.debian.org/de/DHCP_Server
- Failover
- https://www.tech-island.com/tutorials/dhcp-failover-linux
- https://kb.isc.org/docs/aa-00502
TMP
dhclient - Beschreibung
Beschreibung
Installation
Aufruf
Optionen
Unix |
GNU |
Parameter |
Beschreibung
|
|
|
|
|
Parameter
Umgebungsvariablen
Exit-Status
Wert |
Beschreibung
|
0 |
Erfolg
|
>0 |
Fehler
|
Anwendung
Konfiguration verwerfen
# dhclient -r
Neue Konfiguration anfordern
# dhclient
DHCP release mit verbose
# dhclient -v -r
[sudo] Passwort für user:
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp2s0/74:27:ea:e1:db:32
Sending on LPF/enp2s0/74:27:ea:e1:db:32
Sending on Socket/fallback
DHCPRELEASE of 10.20.1.110 on enp2s0 to 10.20.0.1 port 67 (xid=0x1f86c144)
Ausführliche Ausgabe
# dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp2s0/74:27:ea:e1:db:32
Sending on LPF/enp2s0/74:27:ea:e1:db:32
Sending on Socket/fallback
DHCPDISCOVER on enp2s0 to 255.255.255.255 port 67 interval 3 (xid=0xac531335)
DHCPOFFER of 10.20.1.13 from 10.20.1.1
DHCPREQUEST for 10.20.1.13 on enp2s0 to 255.255.255.255 port 67 (xid=0x351353ac)
DHCPACK of 10.20.1.13 from 10.20.1.1 (xid=0xac531335)
cmp: EOF on /tmp/tmp.JBuNGXT4Zg which is empty
bound to 10.20.1.13 -- renewal in 5933 seconds.
Problembehebung
Konfiguration
Dateien
Datei |
Beschreibung
|
/etc/dhcp/dhclient.conf |
|
- /etc/dhcp/dhclient.conf
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
Damit Änderungen bei bereits aktivem Client wirksam werden, muss dieser sie neu anfordern
Fehleranalyse
# cat /var/log/syslog | grep "dhcp"
Konfigurationsdatei
/etc/dhcp/dhcpd.conf
log-facility local7;
subnet 10.2.0.0 netmask 255.255.0.0 {
range 10.2.0.10 10.2.0.100;
option subnet-mask 255.255.0.0;
option domain-name-servers 10.10.0.4;
option domain-name "raum102.itw";
option domain-search "raum102.itw";
option routers 10.2.0.1;
default-lease-time 600;
max-lease-time 7200;
}
host user {
hardware ethernet 00:1d:7d:c8:de:bd;
fixed-address 10.2.0.50;
option host-name "user";
}
DORA: (Discover Offer Request ACK)
- DHCP-DISCOVER: Client sucht per Broadcast nach DHCP-Server
- DHCP-OFFER: DHCP-Server bietet Client per Unicast Konfigurationsparameter der Schnittstelle an
- DHCP-REQUEST: Client fordert angebotene Konfigurationsparameter bei DHCP-Server an (beispielsweise Mietanfrage)
- DHCP-ACK: DHCP-Server sendet Konfigurationsparameter an Client
- DHCP-NAK: Ablehnung einer DHCP-REQUEST-Anforderung durch den DHCP-Server.
- DHCP-DECLINE: Ablehnung durch den Client, da die IP-Adresse schon verwendet wird.
- DHCP-RELEASE: Der Client gibt die eigene Konfiguration frei, damit die Parameter wieder für andere Clients zur Verfügung stehen.
- DHCP-INFORM: Anfrage eines Clients nach weiteren Konfigurationsparametern, beispielsweise weil der Client eine statische IP-Adresse besitzt.
- DHCP-Refresh (nur bei dynamischer Zuordnung) DHCP-ACK-Nachricht
Lease Time
IP-Adresse,"lease time" und zwei Fristen: Die "Renewal-Time" T1 und die "Rebinding-Time" T2.
- T1 1/2 der Lease-Time
- T2 7/8 der Lease-Time
Beispiel
- Lease-Time = 100s => "Renewal-Time" T1 = 50s und "Rebinding-Time" T2 = 87,5s
- Nach Ablauf T1 versucht der Client, seine Lease-Time zu verlängern.
- DHCP-REQUESTs per Unicast an bisherigen Server
- * Erfolgt DHCP-ACK: Client erhält bisherige Konfiguration mit frischer Lease-Time
- * Erfolgt kein DHCP-ACK: Client nutzt Konfiguration ohne Einschränkungen weiter
- Nach Ablauf von T2 sendet Client DHCPREQUESTs per Broadcast an irgendeinen anderen DHCP-Server
- Läuft die Lease-Time ab so verfällt die Konfiguration und Client beginnt erneut mit eunem DHCP-DISCOVER.
- Sind alle IP-Adressen bereits vergeben, sendet Server ein DHCP-NAK (DHCP-Not Acknowledged).
Ablaufverfolgung
DHCP-Relay
- Ist eine Funktion, um DHCP über Netzwerkgrenzen (Broadcastdomäne) hinaus nutzen zu können
- Damit wird die Notwendigkeit der Bereitstellung eines DHCP-Servers in jedem Subnetz, in dem sich DHCP-Clients befinden, vermieden
- Die DHCP-Relay-Funktion wird meist durch den Router selbst erbracht
- DHCP-Relay ist notwendig, um die Broadcasts weiterzuleiten. Bitte auf alle interfaces Aktivieren.