Configuring multiple DHCP Relay servers

Overview

This document will teach you how to configure multiple dhcrelays.

Perform a CentOS/RHEL 5.4 x86_64 Core Install in each dhcrelay server

  • Download CentOS 5.4 x86_64 DVD from a CentOS mirror:

http://isoredirect.centos.org/centos/5.4/isos/x86_64/

  • Minimal install, no graphical environment needed.

Refer to the official RedHat/CentOS documentation if you need assistance with the installation process:

http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/index.html

IMPORTANT!!!
  • SELinux and Firewall must be disabled. See Disabling SELinux.
  • IPv6 can be disabled during the install process

Install needed packages

DHCP provides dhcrelay. Vconfig is used to create VLANs.
These packages are needed in each dhcrelay server.

yum install dhcp vconfig
 

Create configuration scripts

To automate dhcrelays configuration, we will use "dhcpconf" script (attached in this wiki page):

$ ./dhcpconf \--help
Usage: dhcpconf [OPTIONS]...
Creates configuration files and start scripts for the dhcp server and relays.

\-h	\--help					This help screen.
\-r	\--relay-server-interface=INTERFACE	Interface of relay servers connected to the DHCP server.
\-i	\--relay-server-ip-range=IPRANGE		IP range for the relays in the server interface (e.g. 10.0.0.6-10.0.0.10).
\-s	\--relay-service-interface=INTERFACE	Interface of the relay to the clients, where VLANs will be created.
\-v	\--vlan-range=VLANRANGE			VLAN range for clients (e.g. 10-1010).
\-x	\--dhcp-server-ip=IP			IP of the DHCP server.
\-n	\--relay-service-network=IP		Network addresses available for relay service interfaces.
\-b	\--relay-service-network-bits=INTEGER	Number of bits assigned to the network part of the addres (the mask).
 

It will generate two bash scripts for each dhcrelay: relay-config-X.sh and relay-run-X.sh, and one bash script for DHCP server routes config.

Example:

  • 3 dhcrelay servers: 192.168.1.2, 192.168.1.3, 192.168.1.4
  • DHCP Server IP: 192.168.1.1
  • Each dhcrelay is connected to the DHCP server through eth0 (management network)
  • Each dhcrelay is connected to VLANs through eth1 (service network)
  • Each dhcrelay manage VLAN range 2-200
  • Network for relay service interface is: 10.0.0.0/24
  • Relay service network mask is used for subnetting. Each dhrelay will have one subnet and it has to be greater than number of VLANs. In the example 255 > 198.
$ ./dhcpconf \-r eth0 \-i 192.168.1.2-192.168.1.4 \-s eth1 \-v 2-200 \-x 192.168.1.1 \-n 10.0.0.0 \-b 24

-- Generating files --

* dhcpd.conf			Configuration file for the dhcp server
* relay-config-1.sh		Script to generate VLANs and assign IPs for relay 1
* relay-run-1.sh		Script to start the dhcrelay process in relay 1
* relay-config-2.sh		Script to generate VLANs and assign IPs for relay 2
* relay-run-2.sh		Script to start the dhcrelay process in relay 2
* relay-config-3.sh		Script to generate VLANs and assign IPs for relay 3
* relay-run-3.sh		Script to start the dhcrelay process in relay 3
* config-routes-server.sh	Script to configure static routes to relays in the server

-- End --
 

We will copy each one to the right server.

$ scp config-routes-server.sh root@192.168.1.1:
$ scp relay-*-1.sh root@192.168.1.2:
$ scp relay-*-2.sh root@192.168.1.3:
$ scp relay-*-3.sh root@192.168.1.4:
 

Configure and run

Execute the generated scripts in the corresponding server:

Dhcrelay X

To configure dhcrelay X:

$ sh relay-config-X.sh
 

To init dhcrelay X:

$ sh relay-run-X.sh
 

DHCP server

$ sh config-routes-server.sh
 
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.