Search:  
Gentoo Wiki

DHCP

Contents

Introduction

Purpose

This HOWTO is intended to describe how to get a Gentoo box configured as a DHCP server.

Scope

This HOWTO describes how to setup the DHCP server on Gentoo, but does not cover how to setup the client machines. This HOWTO assumes Gentoo 2005.1, but is likely to work with other versions.

References

Acronyms

DHCP 
Dynamic Host Control Protocol.
NIC 
Network Interface Card, commonly an Ethernet ISA/PCI card.
DNS 
Domain Name System

Setup

Requirements

For a DHCP server you will need to emerge dhcp:

emerge dhcp

Configuration

A freshly emerged dhcp will contain a sample configuration file (/etc/dhcp/dhcpd.conf.sample). This file can be copied to /etc/dhcp/dhcpd.conf and used as the basis of the configuration.

The example shown below is typical for a small network. It contains a definition for the subnet, plus the hosts you want to assign a specific details such as IP address.

File: /etc/dhcp/dhcpd.conf
# dhcp.conf
# Sample DHCP Server Configuration File

# option definitions common to all supported networks...
option domain-name "internal";
option domain-name-servers 192.168.2.1, 192.168.2.130;
option routers 192.168.2.1;
ddns-update-style none;

authoritative;

default-lease-time 600;
max-lease-time 7200;

subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.100 192.168.2.128;
# If you want to provided WINS Server
  option netbios-name-servers 192.168.10.13;
  option netbios-node-type 8;

}

# example for a address that will be given to a fixed hardware (mac)

host laptop {
  hardware ethernet 00:10:5a:2e:56:a7;
  fixed-address 192.168.2.4;
  option routers 192.168.2.1;
  option broadcast-address 192.168.2.255;
}

This configuration file is described below:

Global organisation-wide domain name.

Global organisation-wide domain name servers, comma separated.

The default gateway address.

none: This tells the dhcp server not to update dns

The MAC address of the clients NIC.

A DHCP server can actually run with other DHCP servers on the subnet. But if you want this one to be the one that everyone should look for in case of address collisions, then add authoritative to part of your config file, preferably the first line.

If setting up your DHCP server to accept DHCP requests for clients booting over the network, add those two entries somewhere (one per line) to your config. Likely you'll need more than just those.

If you want your DHCP server to send messages to a system logger other than the local machine, use this setting here. You'll have to setup your system logger (running on the ip address specified) to listen to remote logging.

Which IP you want your NETBIOS to be provided or broadcast to all Windows Client. Windows client will refer to this server for NETBIOS name resolve.

What type of NETBIOS Server is this?

<Type ID>

1 B-node: Broadcast - no WINS

2 P-node: Peer - WINS only

4 M-node: Mixed - broadcast, then WINS

8 H-node: Hybrid - WINS, then broadcast

For lots more options and explanations, see man dhcpd.conf and man dhcp-options

Starting the server

/etc/init.d/dhcpd start
rc-update add dhcpd default
Retrieved from "http://www.gentoo-wiki.info/DHCP"

Last modified: Mon, 04 Aug 2008 17:40:00 +0000 Hits: 38,461