DHCP
Dynamic Host Configuration Protocol (DHCP) automatically assigns IP addresses and other network configuration information (subnetmask, broadcast address, etc) to computers on a network. A client configured for DHCP will send out a broadcast request to the DHCP server requesting an address. The DHCP server will then issue a "lease" and assign it to that client. Thetime period of a valid lease can be specified on the server. DHCP reduces the amount of time required to configure clients and allows one to move a computer to various networks and be configured with the appropriate IP address, gateway and subnet mask. For ISP's it conserves the limited number of IP addresses it may use. DHCP servers may assign a "static" IP address to specified hardware. MicrosoftNetBios information is often included in the network information sent by the DHCP server.
DHCP assignment:
1. Lease Request: Client broadcasts request to DHCP server with a source address of 0.0.0.0 and a destination address of 255.255.255.255. The request includes the MAC address which is used to direct the reply.
2. IP lease offer: DHCP server replies with an IP address, subnet mask, networkgateway, name of the domain, name servers, duration of the lease and the IP address of the DHCP server.
3. Lease Selection: Client recieves offer and broadcasts to al DHCP servers that will accept given offer so that other DHCP server need not make an offer.
4. The DHCP server then sends an ack to the client. The client is configured to use TCP/IP.
5. Lease Renewal: When half of the lease timehas expired, the client will issue a new request to the DHCP server.
DHCP server installation:
Red Hat/CentOS/Fedora: rpm -ivh dhcp-x.xxx.elx.i386.rpm
Ubuntu/Debian 8: apt-get install dhcp3-server
( Later releases of Ubuntu (11.04) used the busybox release known as udhcpd and the configuration is NOT shown here)
Starting DHCP server:
Red Hat/CentOS/Fedora: service dhcpd start (or /etc/rc.d/init.d/dhcpd start for Red Hat, Fedora and CentOS Linux distributions)
Ubuntu/Debian: /etc/init.d/networking restart
Sample DHCP server config file: (DHCP v3.0.1)
Red Hat/CentOS/Fedora: /etc/dhcpd.conf
(See /usr/share/doc/dhcp-3.X/dhcp.conf.sample)
[Potential Pitfall]: Its /etc/dhcpd.conf NOT /etc/dhcp.conf !!
Ubuntu/Debian: /etc/default/dhcp3-server
01
ddns-update-styleinterim; # Required for dhcp 3.0+ / Red Hat 8.0+
02
ignore client-updates;
03
04
subnet 192.168.1.0 netmask 255.255.255.0 {
05
06
range 192.168.1.128 192.168.1.254; # Range of IP addresses to be issued to DHCP clients
07
option subnet-mask 255.255.255.0; # Default subnet mask to be used by DHCP clients
08 option broadcast-address 192.168.1.255; # Default broadcastaddress to be used by DHCP clients
09
option routers 192.168.1.1; # Default gateway to be used by DHCP clients
10
option domain-name "your-domain.org";
11
option domain-name-servers 40.175.42.254, 40.175.42.253; # Default DNS to be used byDHCP clients
12
option netbios-name-servers 192.168.1.100; # Specify a WINS server for MS/Windows clients.
13
# (Optional. Specify if used on your network)
14
15
# DHCP requests are not forwarded. Applies when there is more than one ethernet device and forwarding is configured.
16
# optionipforwarding off;
17
18
default-lease-time 21600; # Amount of time in seconds that a client may keep the IP address
19
max-lease-time 43200;
20
21
option time-offset -18000; # Eastern Standard Time
22
# option ntp-servers 192.168.1.1; # Default NTP server...
Regístrate para leer el documento completo.