Differences between revisions 7 and 8
Revision 7 as of 2017-12-13 12:04:16
Size: 4506
Comment:
Revision 8 as of 2017-12-13 12:05:07
Size: 4516
Comment:
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
Copy your DDNS update key from the DNS Master and save it in `/etc/dhcp/ddns-update.kallenberg.dk`. Edit `/etc/dhcp/ddns-update.kallenberg.dk` and remove the quotations. If the quotations are not remove, then the DHCP server will not accept the key. Copy your DDNS update key from the DNS Master and save it in `/etc/dhcp/ddns-update.kallenberg.dk`. Edit `/etc/dhcp/ddns-update.kallenberg.dk` and remove the quotations. If the quotations are not remove, then the DHCP server will not accept it as a valid key.

DHCP Secondary

Network

We will give the DHCP secondary a static IP-address. Edit /etc/networking/interfaces and make the following changes.

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
        address 192.168.1.37
        network 192.168.1.0
        netmask 255.255.255.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

Software

Before installing the DHCP server, make sure that you do not have other DHCP servers running on your network. It can cause hours of debugging.

  • Save time by running a static IP on the host you are configuring your system from, so you do not loose your ssh connections randomly.
  • Remember that switching off an existing DHCP server will cause all your devices to get new IP-adresses. Some devices may have to be rebooted to work properly again.
  • If you use the same IP-address range on both old and new DHCP server, then you may run into IP-address conflicts too.

Install the DHCP server.

apt-get install isc-dhcp-server

Configure the server

Stop the server

service isc-dhcp-server stop

Get the DDNS update key

Copy your DDNS update key from the DNS Master and save it in /etc/dhcp/ddns-update.kallenberg.dk. Edit /etc/dhcp/ddns-update.kallenberg.dk and remove the quotations. If the quotations are not remove, then the DHCP server will not accept it as a valid key.

key ddns-update {
        algorithm hmac-sha512;
        secret yYFzfibvlpS33+vsngV2jF5tGkTiVSjhYoFuV0T7bnCVfFGx3Mu05SW+LakImdofkNM00LxHCLuvD1W1vSWMmA==;
};

Choose Network Device

Edit /etc/default/isc-dhcp-server and set the dhcp server to run on eth0.

INTERFACESv4="eth0"

Edit dhcpcd.conf

Comment out all lines in /etc/dhcp/dhcpd.conf and add the following to the bottom of the file:

include "/etc/dhcp/dhcpd.conf_default";
include "/etc/dhcp/ddns-update.kallenberg.dk";
include "/etc/dhcp/dhcpd.conf_secondary";
include "/etc/dhcp/dhcpd.conf_subnet";
include "/etc/dhcp/dhcpd.conf_static";

Individual Config Files

Server

/etc/dhcp/dhcpd.conf_default

option domain-name "kallenberg.dk";
option domain-name-servers 192.168.1.34, 192.168.1.35;
default-lease-time 3600;
max-lease-time 7200;
log-facility local7;

Subnet

/etc/dhcp/dhcpd.conf_subnet

ddns-update-style interim;
ddns-updates on;
ddns-domainname "kallenberg.dk";
ignore client-updates;
update-static-leases on;

# forward zones for DNS updates
zone kallenberg.dk {
        primary 192.168.1.34;
        key ddns-update;
}

# reserse zone for DNS updates
zone 1.168.192.in-addr.arpa {
        primary 192.168.1.34;
        key ddns-update;
}

subnet 192.168.1.0 netmask 255.255.255.0 {

        pool {
                failover peer "network";
                range 192.168.1.96 192.168.1.127;
        }

        option routers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.1.255;
        option domain-name "kallenberg.dk";
        option domain-name-servers 192.168.1.34, 192.168.1.35;
        option ntp-servers 192.168.1.38, 192.168.1.39;
        #option ntp-servers ntp01, ntp02;

        default-lease-time 3600;
        max-lease-time 7200;

}

Static IP-adresses

We would like servers to have static IP-adresses, but not more static than controlling it from the DHCP server. Remember to keep this file synchronized with the one on the DHCP primary.

/etc/dhcp/dhcpd.conf_static

host ntp01 {
        hardware ethernet 52:54:00:9e:33:2f;
        fixed-address 192.168.1.38;
}

host ntp02 {
        hardware ethernet 52:54:00:c5:f1:92;
        fixed-address 192.168.1.39;
}

DHCP Secondary

/etc/dhcp/dhcpd.conf_secondary

failover peer "network" {
        secondary;
        address 192.168.1.37;
        port 647;
        peer address 192.168.1.36;
        peer port 647;
        max-response-delay 60;
        max-unacked-updates 10;
        mclt 3600;
        load balance max seconds 3;
}

Start the server

service isc-dhcp-server start

Notice that even though the server is startet, it will not begin to hand out IP-adresses yet. It will wait until it sees the primary. Once it has seen the primary the DHCP server will begin to work.

None: DHCP Secondary (last edited 2021-03-15 21:24:49 by Kristian Kallenberg)