Minggu, 16 Desember 2012

How to configure Dynamic Host Configuration Protocol (DHCP) in Linux


Dynamic Host Configuration Protocol (DHCP) Lease Process

The process of leasing an IP address occurs in the following four phases:
• Discovery (Message from DHCP client to DHCP Server): The DHCP client broadcasts a DHCP discover message on the network containing its MAC address to find a DHCP server running in the network.
• Offer (Message from DHCP server to DHCP client): Each DHCP server on the network that receives the request responds with a DHCP offer message. An offered IP address is included in the message.
• Request (Message from DHCP client to DHCP Server): When a DHCP client receives a DHCPOffer packet, it responds by broadcasting a DHCPRequest packet that contains the offered IP address, and shows acceptance of the offered IP address. If multiple DHCP servers respond, the client selects the first offer it receives and broadcasts a DHCP request for the IP address. The message is broadcast on the network because the client has not yet been assigned an IP address; it has only been offered one.
• Acknowledge (Message from DHCP server to DHCP client): The DHCP server responds with a DHCPACK (acknowledgment) granting the client's request to use the IP address. The DHCPACK also contains information about any DHCP options that have been configured on the server (such as the IP address of the DNS server).

Dynamic Host Configuration Protocol (DHCP) configuration file (/etc/dhcpd.conf)

A sample Linux dhcpd.conf file is copied below.
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "omnisecu.com";
option domain-name-servers 192.168.1.1;
# option time-offset + 19800; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
# range dynamic-bootp 192.168.0.128 192.168.0.254;
range 192.168.1.210 192.168.1.220;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
# host ns {
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 207.175.42.254;
# }
}
• ddns-update-style interim: Confirms Dynamic DHCP.
• ignore client-updates: This setting don't allow users on client computers to change their host names.
• subnet 192.168.0.0 netmask 255.255.255.0 Describes a network with an address of 192.168.0.0 and a subnet mask of 255.255.255.0. This allows the local DHCP server to assign addresses in the range 192.168.0.1 to 192.168.0.254 to different computers on this network. If you've configured a different network IP address, you'll want to change these settings accordingly.
• option routers: Lists the default router.
• option subnet-mask: Specifies the subnet mask for the local network.
• option nis-domain: Specifies the NIS domain name
• option domain-name: Domain name for the network
• option domain-name-servers DNS Server for the network
• option time-offset: Lists the difference from Greenwich Mean Time.
• option ntp-servers Network Time Protocol (NTP) servers
• option netbios-name-servers: WINS (Windows Internet Name Servers) Servers. Used for NetBIOS name resolution.
• range dynamic-bootp: BOOTP range
• default-lease-time: Specifies the lease time for IP address information, in seconds.
• max-lease-time Specifies the maximum lease time for IP address information, in seconds.
• next-server: Boot server for network computers
Linux Dynamic Host Configuration Protocol (DHCP) leases file is /var/lib/dhcpd/dhcpd.leases.

Tidak ada komentar:

Poskan Komentar