The simplest DHCP Service and the simplest DHCP Service
In the past few days, you have prepared to install the linux operating system on the network. Finally, we decided to use pxe + kickstart. After the principles and solutions are completed, the system starts construction and the result is blocked by DHCP. This does not require research on the simplest and most practical DHCP use methods.
* Red is required
* Note that green
* The Blue is the required package for package installation.
1. DHCP implementation
2. configuration file instance
Instance 1
Instance 2
-----------------------------------------------------------------
1. DHCP implementation
The DHCP Service must provide an address pool for this section.
# yum -y install dhcp-devel# rpm -aq | grep dhcp dhcp-4.1.1-38.P1.el6.centos.i686 dhcp-devel-4.1.1-38.P1.el6.centos.i686# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf# vi dhcpd.conf ddns-update-style interim; default-lease-time 21600; max-lease-time 43200; option domain-name “test.com”; option domain-name-servers 192.168.1.1,202.106.0.20;
subnet 192.168.1.0 netmask 255.255.2550 { range 192.168.1.128 192.168.1.254; option subnet-mask 255.255.255.0; option routers 192.168.1.1; } host server01 { hardware ethernet 0:c0:c3:22:46:81; fixed-address 192.168.1.11; option subnet-mask 255.255.255.0; option routers 192.168.1.1; } subnet 117.34.70.0 netmask 255.255.255.0 { default-lease-time 21600; max-lease-time 43200; option routers 117.34.70.1; option subnet-mask 255.255.255.0; }
A host has multiple NICs. To enable the DHCP service on a nic, you must configure the following:
# vi /etc/sysconfig/dhcpd # Command line options here DHCPDARGS="eth0"
------------------------------
2. configuration file instance
Simple Example: (the red part must exist)
# vi /etc/dhcp/dhcpd.conf # dhcpd.conf # Sample configuration file for ISC dhcpd # option definitions common to all supported networks... option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; # Use this to enble / disable dynamic dns updates globally. ddns-update-style none; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. subnet 117.34.73.0 netmask 255.255.255.0 { } subnet 10.152.187.0 netmask 255.255.255.0 { } # vi /etc/dhcp/dhcpd.conf default-lease-time 600; max-lease-time 7200; ddns-update-style none; subnet 117.34.73.0 netmask 255.255.255.0 { }
-----------------------------------------------------------------
* Note:
● If there are many host NICs, you can select one as the service Nic.
Vi/etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS = "em1: 1"
● The NIC that provides services must beNot automatically obtained.
Ifconfig eth0 172.16.40.129/25 up
● The address pool provided by the Service must contain the address of the local service provider.
● The address pool (range) cannot conflict with the scope (subnet.
● Other parameters and options cannot be enabled. You can leave this parameter unspecified because it is for network installation.
● If the simplest dhcp service described here is configured, it cannot be started. There is only one reason left. There is no semicolon after each sentence.