Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


fortgeschrittene:dhcp

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

Nächste Überarbeitung
Vorherige Überarbeitung
fortgeschrittene:dhcp [2010/11/08 20:57]
127.0.0.1 Externe Bearbeitung
fortgeschrittene:dhcp [2025/07/13 10:27] (aktuell)
Zeile 1: Zeile 1:
-====== ​DHCP-Dienst mit festen ​IP-Adressen ====== +====== ​DHCP4-Dienst mit festen ​IPv4-Adressen ====== 
-''/​etc/​dhcpd.conf''​ :+[[https://​bugs.debian.org/​cgi-bin/​bugreport.cgi?​bug=717215|dhcpd/​KVM Bug]] beachten (( Lösungsmöglichkeiten um UDP Checksum-Problem in KVM zu vermeiden:  
 +  * in KVM e1000 als Netzwerkkarte auswählen,  
 +  * oder: TX offloading in der Netzwerkkarte ausschalten 
 +  * oder: mit iptables die Checksumme erzeugen 
 +)) 
 +===== Pakete ===== 
 +Debian (ab 6.0): 
 +  isc-dhcp-server 
 + 
 +openSuSE (ab 12.1): 
 +  dhcp-server 
 + 
 +centos (6) : 
 +  dhcp   
 + 
 +===== Konfiguration ​===== 
 +''/​etc/dhcp/​dhcpd.conf''​ : ( debian ab 6.0 ) 
 + 
 +''/​etc/​dhcpd.conf''​ : ( openSuSE 12.1, centos 6 )
 <​file>​ <​file>​
 authoritative;​ authoritative;​
 ddns-update-style none; ddns-update-style none;
- 
-log-facility local7; 
  
 subnet 192.168.1.0 netmask 255.255.255.0 { subnet 192.168.1.0 netmask 255.255.255.0 {
-  option domain-name-servers 192.168.1.4;​ 
   option domain-name "​linuxhotel.de";​   option domain-name "​linuxhotel.de";​
   option routers 192.168.1.1;​   option routers 192.168.1.1;​
Zeile 14: Zeile 29:
   default-lease-time 600;   default-lease-time 600;
   max-lease-time 7200;   max-lease-time 7200;
- 
 } }
  
 use-host-decl-names on; use-host-decl-names on;
  
-host notebook03 ​+host notebook24 ​
-  hardware ethernet 00:a0:cc:d5:52:e4+  hardware ethernet 00:16:d3:b9:a0:3e
-  fixed-address 192.168.1.203; +  fixed-address 192.168.1.224;
-  option domain-name-servers 192.168.1.6;+
 } }
 +</​file>​
  
-host notebook06 { +=== Debian ab 6.0 === 
-  ​hardware ethernet 00:a0:​cc:​d5:​53:​0c;​ +''/​etc/​default/​isc-dhcp-server'' ​
-  ​fixed-address 192.168.1.206;​ +<​file>​ 
-}+INTERFACES="​eth0"​
 </​file>​ </​file>​
  
Zeile 35: Zeile 49:
 <​file>​ <​file>​
 DHCPD_INTERFACE="​eth0"​ DHCPD_INTERFACE="​eth0"​
-DHCPD_RUN_CHROOTED="​yes"​ 
-DHCPD_RUN_AS="​dhcpd"​ 
 </​file>​ </​file>​
  
-=== CentOS ===+=== CentOS ​(bis 6) ===
 ''/​etc/​sysconfig/​dhcpd''​ : ''/​etc/​sysconfig/​dhcpd''​ :
 <​file>​ <​file>​
Zeile 47: Zeile 59:
  
 ===== Testen ===== ===== Testen =====
-=== Debian === +=== Debian, CentOS 5.3 === 
-  ​dhcpd3 ​-t+  ​dhcpd -t
  
 === SuSE === === SuSE ===
   rcdhcpd check-syntax   rcdhcpd check-syntax
  
-=== CentOS 5.3 ===+===== starten ===== 
 +=== openSuSE (ab 12.1) === 
 +  service dhcpd start 
 +  chkconfig dhcpd on 
 +=== debian (ab 6.0) === 
 +  service isc-dhcp-server restart 
 +=== centos (ab 7) === 
 +  service dhcpd start 
 +===== Client testen ===== 
 +Optional: Interface mit passender Mac-Adresse anlegen: [[admin_grundlagen:​macvlan]] 
 + 
 +DHCP Anfrage ohne Änderung:​ 
 +=== Debian (ab 6.0) Ubuntu (18.04) === 
 +  dhclient -d -sf /bin/true eth0 
 +oder 
 +  dhclient -d -sf /​usr/​bin/​env eth0 
 + 
 +Unter Ubuntu 18.04 läuft dhclient in einem [[AppArmor]]-Käfig (confinement) und kann daher ''/​bin/​true''​ und ''/​usr/​bin/​env''​ nicht ausführen. [[AppArmor|Lösung]] 
 + 
 +=== openSuSE (12.3=== 
 +  dhcpcd --test eth0 
 + 
 +=== openSuSE (ab 42.1) === 
 +  /​usr/​lib/​wicked/​bin/​wickedd-dhcp4 --test eth0 
 + 
 +====== IP-Adress-Pool ====== 
 +<file txt /​etc/​dhcp/​dhcpd.conf>​ 
 +subnet 192.168.227.0 netmask 255.255.255.0 { 
 +  range 192.168.227.50 192.168.227.69;​ 
 +  … 
 +  log-threshold-high 80; 
 +  log-threshold-low 50; 
 +
 + 
 + 
 +</​file>​
   dhcpd -t   dhcpd -t
 +  service isc-dhcp-server restart
 +  dhclient -d -sf /bin/true eth0
 +  dhcp-lease-list
  
 +====== Clientseitiges DNS über DHCP konfigurieren ======
 +<file txt /​etc/​dhcp/​dhcpd.conf>​
 +option domain-name "​z03.example.org";​
 +option domain-name-servers 192.168.202.13;​
 +option domain-search "​linuxhotel.de",​ "​z03.example.org";​
 +</​file>​
 +
 +====== DHCP Client ======
 +===== DHCP Server Optionen überschreiben =====
 +Beispiel: eigene DNS-Informationen in die ''​resolv.conf''​ eintragen
 +<file txt /​etc/​dhcp/​dhclient.conf>​
 +supersede domain-name "​z03.test";​
 +supersede domain-name-servers 192.168.203.101;​
 +</​file>​
 ====== Tools ====== ====== Tools ======
   * [[ http://​www.webmin.com | Webmin - incl. DHCP und DNS Modul ]] ( in Debian Sarge enthalten, in Etch nicht mehr )   * [[ http://​www.webmin.com | Webmin - incl. DHCP und DNS Modul ]] ( in Debian Sarge enthalten, in Etch nicht mehr )
Zeile 64: Zeile 128:
  
  
-====== ​mehrere Domains per DHCP ===== + 
-''​dhcpd.conf'':​+====== DHCP Failover ====== 
 +Debian 5.0 
 + 
 +( noch nicht getestet ) 
 + 
 +  mv /​etc/​dhcp3/​dhcpd.conf /​etc/​dhcp3/​dhcpd.common.conf 
 +  scp /​etc/​dhcp3/​dhcpd.common.conf notebook25.linuxhotel.de:/​etc/​dhcp3/​dhcpd.common.conf 
 + 
 +===== dhcpd.common.conf ​===== 
 +''​/etc/dhcp3/dhcpd.common.conf''​ : 
 <​file>​ <​file>​
-domain-name "main.domain"  +subnet 192.168.1.0 netmask 255.255.255.0 { 
-domain-search ​"additional.domain"+  pool { 
 +    failover peer "​dhcp-failover";​ 
 +    range 192.168.1.100 192.168.1.189;​ 
 +  } 
 +  option ​domain-name "linuxhotel.de"; 
 +  ​option ​domain-name-servers 192.168.1.4,​ 192.168.1.6;​ 
 +  option routers 192.168.1.1;​ 
 +  option broadcast-address 192.168.1.255;​ 
 +
 +</​file>​ 
 + 
 +===== Primary ===== 
 +''/​etc/​dhcp3/​dhcpd.conf''​ :  
 +<​file>​ 
 +failover peer "dhcp-failover"​ { 
 +  primary ; # declare this to be the primary server 
 +  address notebook20.linuxhotel.de;​ 
 +  port 520; 
 +  peer address notebook25.linuxhotel.de;​ 
 +  peer port 520; 
 +  max-response-delay 60; 
 +  max-unacked-updates 10; 
 +  load balance max seconds 3; 
 +  mclt 1800; 
 +  split 128; 
 +
 + 
 +include "/​etc/​dhcp3/​dhcpd.common.conf";​ 
 +</​file>​ 
 +  /​etc/​init.d/​dhcp3-server restart 
 + 
 +===== Secondary ===== 
 +  /​etc/​init.d/​dhcp3-server stop 
 +''/​etc/​dhcp3/​dhcpd.conf''​ :  
 +<​file>​ 
 +failover peer "​dhcp-failover"​ { 
 +  secondary;​ 
 +  address notebook25.linuxhotel.de;​ 
 +  port 520; 
 +  peer address notebook20.linuxhotel.de;​ 
 +  peer port 520; 
 +  max-response-delay 60; 
 +  max-unacked-updates 10; 
 +  load balance max seconds 3; 
 +
 + 
 +include "/​etc/​dhcp3/​dhcpd.common.conf";
 </​file>​ </​file>​
 +  rm /​var/​lib/​dhcp3/​dhcpd.leases~
 +  > /​var/​lib/​dhcp3/​dhcpd.leases
 +  /​etc/​init.d/​dhcp3-server start
 +Sekunden entsprechend mclt Eintrag warten ...
  
-With 3.1.0if the domain-search option is set, then the search directive is set to thisIf the domain-name option is set, this is prepended to the list of domains in the domain-search option+===== Primary oder Secondary syncronisieren ===== 
 +z.Bnach ''​Got POOLREQanswering negatively! ​ Peer may be out of leases or database inconsistent''​ im Log ... 
 +  /​etc/​init.d/​dhcp3-server stop 
 +  rm /​var/​lib/​dhcp3/​dhcpd.leases~ 
 +  > /​var/​lib/​dhcp3/​dhcpd.leases 
 +  /​etc/​init.d/​dhcp3-server start 
 +Sekunden entsprechend mclt Eintrag warten ...
  
fortgeschrittene/dhcp.1289249856.txt.gz · Zuletzt geändert: 2011/04/16 22:24 (Externe Bearbeitung)