License

Copyright (C) 2008-2021 Oliver Bohlen.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

A copy of the license is included in the section entitled "GNU Free Documentation License".

Introduction

This documentation comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

Howto: DHCP-Server for Gentoo Linux

If you want to manage your IPs in a central way you should use a DHCP-Server. This helps you to install and configure it.

If you want to use this solution you need the following howto(s) finished:

Required software

The required software has to be installed with the following command(s):
emerge net-misc/dhcp

Changes in /etc/conf.d/dhcpd

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/conf.d/dhcpd

Changed on 17.11.09
Issued by olli
Beginning line 20

Only change this if you want to store your DHCP-Settings in your LDAP. This sets the configuration file for LDAP.


Before change
# DHCPD_CONF="/etc/dhcp/dhcpd.conf"
After change
DHCPD_CONF="/etc/dhcp/dhcpd.conf"

Changed on 17.11.09
Issued by olli
Beginning line 29

The Listen Interface


Before change
# DHCPD_IFACE=""
After change
DHCPD_IFACE="eth0"

Changes in /etc/conf.d/dhcpd6

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/conf.d/dhcpd6

Changed on 17.11.09
Issued by olli
Beginning line 20

Config File fpr DHCP in WLAN Network


Before change
# DHCPD_CONF="/etc/dhcp/dhcpd.conf"
After change
DHCPD_CONF="/etc/dhcp/dhcpd6.conf"

Changed on 17.11.09
Issued by olli
Beginning line 29

The Listen Interface


Before change
# DHCPD_IFACE=""
After change
DHCPD_IFACE="eth0"

Changes in /etc/conf.d/dhcpd-wlan

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/conf.d/dhcpd-wlan

Changed on 17.11.09
Issued by olli
Beginning line 20

Config File fpr DHCP in WLAN Network


Before change
# DHCPD_CONF="/etc/dhcp/dhcpd.conf"
After change
DHCPD_CONF="/etc/dhcp/dhcpd-wlan.conf"

Changed on 17.11.09
Issued by olli
Beginning line 29

The Listen Interface


Before change
# DHCPD_IFACE=""
After change
DHCPD_IFACE="wlan0"

Changes in /etc/dhcp/dhcpd.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd.conf

Changed on 06.09.08
Issued by olli
Beginning line 1

DHCP Base settings only if you want to use DHCP without LDAP. After some default definitions like gateway, DNS Server, domain name,... it defines a range of IPs for clients. Change it according to your environment if you dont use DHCP over LDAP.


option domain-name "example.com";

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

option subnet-mask XXX.XXX.XXX.XXX;
option broadcast-address XXX.XXX.XXX.XXX;
option domain-name-servers my.lan.ip.addr;
option ntp-servers XXX.XXX.XXX.XXX;
option routers XXX.XXX.XXX.XXX;
default-lease-time 7200;
max-lease-time 14400;
ddns-update-style none;
subnet my.lan.network.ip netmask XXX.XXX.XXX.XXX {
 range XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX;
}

Changes in /etc/dhcp/dhcpd.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd.conf

Changed on 06.09.08
Issued by olli
Beginning line 35

Here are some Examples for fixed IPs of some DHCP-Hosts. (only if you don't use DHCP over LDAP)


host heidiphone-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host homephone-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host beckyphone-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host user1phone-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host hometablet-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host beckykindle-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host small-gabosh-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host small-gabosh {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host knirps-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host ultra-gabosh-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host station-gabosh {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host epson-gabosh-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host gaboshberry {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host gaboshsleepberry {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host gaboshbeckyberry {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host lgtv {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host testberry {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}

host mirko-nas {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}



Changes in /etc/dhcp/dhcpd-ldap.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd-ldap.conf

Changed on 17.11.09
Issued by olli
Beginning line 1

This are the settings for connecting to the LDAP Server. It is only needed if you want to use LDAP as DHCP-Storage.

ldap-server "localhost";
ldap-port 389;
ldap-username "";
ldap-password "";
ldap-base-dn "ou=DHCP-Servers,dc=example,dc=com";
ldap-dhcp-server-cn "silent-gabosh.example.com";
ldap-method dynamic;
ldap-debug-file "/tmp/dhcp-ldap-startup-config";

Changes in /etc/dhcp/dhcpd-ldap-wlan.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd-ldap-wlan.conf

Changed on 17.11.09
Issued by olli
Beginning line 1

This are the settings for connecting to the LDAP Server. It is only needed if you want to use LDAP as DHCP-Storage.

ldap-server "localhost";
ldap-port 389;
ldap-username "";
ldap-password "";
ldap-base-dn "ou=DHCP-Servers,dc=example,dc=com";
ldap-dhcp-server-cn "silent-gabosh.example.com-wlan";
ldap-method dynamic;
ldap-debug-file "/tmp/dhcp-ldap-startup-config-wlan";

Changes in /etc/dhcp/dhcpd-wlan.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/dhcp/dhcpd-wlan.conf

Changed on 06.09.08
Issued by olli
Beginning line 1

Configuration for DHCP in WLAN Network

option subnet-mask XXX.XXX.XXX.XXX;
option broadcast-address XXX.XXX.XXX.XXX;
option domain-name-servers my.lan.ip.addr;
option domain-name "example.com";
option ntp-servers my.lan.ip.addr;
option routers XXX.XXX.XXX.XXX;
default-lease-time 7200;
max-lease-time 14400;
ddns-update-style none;
subnet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX {
 range XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX;
}

next-server XXX.XXX.XXX.XXX;
filename "bootx64.efi";

Changed on 06.09.08
Issued by olli
Beginning line 20

Hosts with fixed IP

host epson-gabosh-wlan {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host small-gabosh {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host knirps {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host ultra-gabosh {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host heidiphone {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host homephone {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host beckyphone {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host user1phone {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host hometablet {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}
host beckykindle {
 hardware ethernet XX:XX:XX:XX:XX:XX;
 fixed-address XXX.XXX.XXX.XXX;
}


Setting up services

For starting the new service after system reboot you should add it to a runlevel with the following command(s):

rc-update add dhcpd 

Please send a feedback to: doc<at>gabosh.net

Howto listing
File Index

Here you can find the official Gentoo Linux Forums where you can find a lot of answers.

Here a link to the official Gentoo Linux Homepage.

Edit Howto

About / Impressum

Click here for About / Impressum

Wishlist

If you want to support my work you can find my Amazon whishlist here