Differences between revisions 25 and 26
Revision 25 as of 2010-10-01 02:03:31
Size: 3830
Editor: ?skizzhg
Comment:
Revision 26 as of 2011-07-04 13:56:16
Size: 3835
Editor: ?JohannesObermueller
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
root# apt-get install dhcp3-server root# apt-get install isc-dhcp-server
Line 24: Line 24:
root# aptitude install dhcp3-server root# aptitude install isc-dhcp-server
Line 29: Line 29:
The configuration file for a dhcp-server is {{{/etc/dhcp3/dhcpd.conf}}}. Remember to make a backup copy of it before you edit the file. The configuration file for a dhcp-server is {{{/etc/dhcp/dhcpd.conf}}}. Remember to make a backup copy of it before you edit the file.

Translation(s): Deutsch - English - Italiano - 简体中文

(!) ?Discussion

Introduction

When you set up a Local Area Network (LAN), a client needs to have certain information, such as the IP-address of its interface, the IP-address of at least one domain name server, and the IP-address of a server in the LAN that serves as a router to the internet. In the manual setup you have to type in this information for each client anew. With the Dynamic Host Configuration Protocol (DHCP) the computers can do that automatically for you. This is particularly convenient for connecting laptops to the network.

For a simple configuration of your network you can set up one computer (e.g. the one connected to the internet) as a DHCP server and each of the other computers as a DHCP_Client.

Installation

As usual, installation is very simple with apt. As root simply run

root# apt-get install isc-dhcp-server

or

root# aptitude install isc-dhcp-server

Configuration

The configuration file for a dhcp-server is /etc/dhcp/dhcpd.conf. Remember to make a backup copy of it before you edit the file.

Basic configuration

For a basic configuration, you have to add/edit the following lines. I would leave all other lines as they are.

option domain-name "spices.org";

This entry provides the name of the domain, spices.org in this case (I am not sure whether and for what this is necessary. I guess it is needed if you want to refer to computers in the LAN by name without domain name, i.e. if you want to refer to computer pepper.spices.org just with pepper.).

option domain-name-servers 213.191.92.86, 213.191.74.18;

This entry provides the IP-addresses of two domain name servers (DNS), but one would be sufficient, too. You have to list here the DNS that work for your internet provider, the addresses given here will most likely not work for you.

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.1 192.168.1.10;
  option routers pepper.spices.org;
}

This entry defines the LAN and the router of the LAN. The IP-addresses 192.168.1.1 to 192.168.1.255 are typical for an intranet. Here only the range 192.168.1.1 to 192.168.1.10 are permitted. pepper.spices.org is in this case the server connected to the internet that serves as a router.

To make your changes effective you have to restart the dhcp-demon. Run as root

root# /etc/init.d/dhcp3-server restart

Advanced configuration

Assign fixed addresses

To assign a fixed address, e.g. 192.168.1.5, to a particular machine, e.g. cinnamon, add a statement like the following to the configuration file.

host cinnamon {
  hardware ethernet 00:0D:87:B3:AE:A6;
  fixed-address 192.168.1.5;
}

The cryptic number 00:0D:87:B3:AE:A6 is the hardware address of the interface of cinnamon. It identifies the client to the server. You can get it by running the ifconfig command on the client if the interface is up.

The name (cinnamon) given here is pretty arbitrary at this point and not used for anything yet, as far as I can tell.

More information

Consult the man pages for advanced options.

user> man dhcpd.conf