Dynamically assigned | |||
192-254 Network infrastructure | 192-253 | Future use | |
254 | Traditional address for a gateway | ||
255 | Broadcast | Reserved address |
DHCP is configured through the text file
The
ddns-update-style none;
This prevents the DHCP server from attempting to update records on the DNS server (which is prohibited by Fedora's default SELinux configuration).
The rest of the configuration statements are placed in a block as part of a subnet statement:
subnet
# Statements that apply only to this subnet...
}
These are the most commonly used configuration statements:
option routers
The default gateway. Packets destined for a host that is not in your local network are sent to this gateway for forwarding.
option subnet-mask
The subnet mask, which is used to determine whether an IP address is on the local network (which determines routing).
option domain-name-servers
Nameservers for this subnet (they may be in the subnet, or they may be external). If there is more than one, list them all, separating the IP addresses or hostnames with commas.
option domain-name '
The domain name for machines on this subnet. This is used as the default domain for hostname lookup, so that if a user types a command such as telnet
option time-offset
The difference (in seconds) between the local time zone and Coordinated Universal Time (UTC). -21600 indicates a time zone that is six hours behind Greenwich, England (Eastern Standard Time in North America).
option ntp-servers
The hostnames or addresses of any available network time protocol servers. The hostname pool.ntp.org accesses a server randomly drawn from a pool of publicly accessible timeservers. You can prepend your ISO country code to select only timeservers in your country; for example, ca.pool.ntp.org would randomly select a Canadian timeserver.
range
The range of address from which dynamic IP addresses will be assigned.
default-lease-time
The normal lease time in seconds. 86,400 seconds corresponds to one day.
max-lease-time
The maximum lease time, in case the client requests a lease that is longer than the default.
To configure static hosts, statements are placed in the block of a host statement:
host
# Statements that apply only to this host...
}
These are the statements that are most commonly used in a host block:
hardware ethernet
Determines which Ethernet hardware MAC address will match this host block. This block will be selected if the hostname sent by the DHCP client matches the hostname in the host statement, or if the client's Ethernet card has the same MAC address as the hardware statement.
fixed-address
Specifies the static address for this host.
To configure a network that uses the layout shown in Table 7-2 , where the devices have the MAC addresses shown in Table 7-3 , you would write this
# Sample /etc/dhcpd.conf file
# Don't update DNS
ddns-update-style none;
# The local network is 192.168.1.X
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.254; # Default gateway