Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
lpi2:dhcp [2016/03/08 06:43] ingo_wichmann [mehrere Domains per DHCP] |
lpi2:dhcp [2019/06/19 14:21] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== DHCP-Dienst mit festen IP-Adressen ====== | ||
- | ((kvm/xen bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717217)) | ||
- | ===== Pakete ===== | ||
- | Debian (ab 6.0): | ||
- | isc-dhcp-server | ||
- | |||
- | openSuSE (ab 12.1): | ||
- | dhcp-server | ||
- | |||
- | centos (6) : | ||
- | dhcp | ||
- | |||
- | ===== Konfiguration ===== | ||
- | ''/etc/dhcp/dhcpd.conf'' : ( debian 6.0 ) | ||
- | |||
- | ''/etc/dhcpd.conf'' : ( openSuSE 12.1, centos 6 ) | ||
- | <file> | ||
- | authoritative; | ||
- | ddns-update-style none; | ||
- | |||
- | log-facility local7; | ||
- | |||
- | subnet 192.168.1.0 netmask 255.255.255.0 { | ||
- | option domain-name "linuxhotel.de"; | ||
- | option routers 192.168.1.1; | ||
- | option broadcast-address 192.168.1.255; | ||
- | default-lease-time 600; | ||
- | max-lease-time 7200; | ||
- | } | ||
- | |||
- | use-host-decl-names on; | ||
- | |||
- | host notebook24 { | ||
- | hardware ethernet 00:16:d3:b9:a0:3e; | ||
- | fixed-address 192.168.1.224; | ||
- | } | ||
- | </file> | ||
- | |||
- | === Debian 6.0 === | ||
- | ''/etc/default/isc-dhcp-server'' : | ||
- | <file> | ||
- | INTERFACES="eth0" | ||
- | </file> | ||
- | |||
- | === SuSE === | ||
- | ''/etc/sysconfig/dhcpd'': | ||
- | <file> | ||
- | DHCPD_INTERFACE="eth0" | ||
- | </file> | ||
- | |||
- | === CentOS (bis 6) === | ||
- | ''/etc/sysconfig/dhcpd'' : | ||
- | <file> | ||
- | # Command line options here | ||
- | DHCPDARGS="eth0" | ||
- | </file> | ||
- | |||
- | ===== Testen ===== | ||
- | === Debian, CentOS 5.3 === | ||
- | dhcpd -t | ||
- | |||
- | === SuSE === | ||
- | rcdhcpd check-syntax | ||
- | |||
- | ===== 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 ===== | ||
- | DHCP Anfrage ohne Änderung: | ||
- | === Debian (ab 6.0) === | ||
- | dhclient -d -sf /bin/true eth0 | ||
- | |||
- | === openSuSE (12.3) === | ||
- | dhcpcd --test eth0 | ||
- | |||
- | ====== Clientseitiges DNS über DHCP konfigurieren ====== | ||
- | <file txt /etc/dhcp/dhcpd.conf> | ||
- | option domain-name "z202.example.com"; | ||
- | option domain-name-servers 192.168.202.1; | ||
- | option domain-search "linuxhotel.de"; | ||
- | </file> | ||
- | ====== Tools ====== | ||
- | * [[ http://www.webmin.com | Webmin - incl. DHCP und DNS Modul ]] ( in Debian Sarge enthalten, in Etch nicht mehr ) | ||
- | * [[ http://osuosl.org/projects/maintain/ | Maintain - web based management tool for DNS and DHCP ]] | ||
- | |||
- | ====== OMAPI / omshell ====== | ||
- | Ist eine Möglichkeit einen laufenden DHCP-Server ohne Neustart zu steuern ( leases, etc. ). | ||
- | |||
- | |||
- | |||
- | ====== 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> | ||
- | subnet 192.168.1.0 netmask 255.255.255.0 { | ||
- | 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> | ||
- | rm /var/lib/dhcp3/dhcpd.leases~ | ||
- | > /var/lib/dhcp3/dhcpd.leases | ||
- | /etc/init.d/dhcp3-server start | ||
- | Sekunden entsprechend mclt Eintrag warten ... | ||
- | |||
- | ===== Primary oder Secondary syncronisieren ===== | ||
- | z.B. nach ''Got POOLREQ, answering 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 ... | ||