DHCP configuration in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. Install the dhcp Software Package
# Rpm? Ivh dhcp-3.0.1-12_EL.i386.rpm
2. configuration file dhcpd. conf
Because dhcpd. conf is not included in the software package by default
# Cp/usr/share/doc/dhcp-3.0.2/dhcpd. conf. sample/etc/dhcpd. conf
3. Edit dhcpd. conf.
# Vi/etc/dhcpd. conf
Basic configuration file format
Subnet 192.168.1.0 netmask 255.255.255.0 {range 192.168.1.100 192.168.1.200}
(Declared that the network address is 192.168.1.0 and the subnet mask is 255.255.255.0. The IP address ranges from 192.168.1.100 ~ IP addresses between 192.168.1.200 are used for Dynamic Address Allocation by DHCP clients)
The dhcpd. conf configuration file can contain three basic formats: Declaration, parameter, and option.
Subnet is a common declaration. The setting in the Declaration (Content in braces) is valid throughout the Declaration scope;
Set the Subnet network address after the Subnet keyword, and set the Subnet mask after The netmask keyword
A parameter consists of a set item and set value. Based on the parameter location, the parameter location can be applied to the global or specified declaration. The parameter ends with ";", for example:
Default-lease-time 21600; (Default release time)
Max-lease-time 43200; (maximum release time)
The option is always guided by the option keyword, followed by the specific options and the set value of the option. The option can be applied to the global or a declaration according to the position, and the option is also "; "ended, for example:
Option routers 192.168.1.1 (GATEWAY)
Opyion subnet-mask 255.255.255.0 (subnet mask)
Use host declaration to set host properties
Host server01 {
Hardware Ethernet 0: c0: c3: 22: 46: 81;
Fixed-address 192.168.1.11;
Option subnet-mask limit 255.0
Option routers 192.168.1.1;
}
In the preceding configuration instance, host declares the host named server01. Its MAC address is 0: c0: c3: 22: 46: 81, and the IP address used for host allocation is 192.168.1.11, the subnet mask for the host is 255.255.255.0 and the gateway address is 192.168.1.1.
Files to be configured for multiple network interfaces
# Vi/etc/sysconfig/dhcpd
DHCPDARGS = eth0
Indicates that dhcp is only available on the eth0 network interface.
4. Start and Stop the dhcpd Service
The STARTUP script of the Dhcpd service is located in/etc/init. d/dhcpd
Start the dhcpd Service
# Service dhcpd start
Stop the dhcpd Service
# Service dhcpd stop
Modify startup status
# Chkconfig? Level 35 dhcpd on
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service