Ubuntu-16.04 Building DHCP service One, what is DHCP
DHCP (Dynamic Host Configuration Protocol) is commonly used in large local network environment, the main role is centralized management, assigning IP address, so that the host in the network environment to obtain the dynamic IP address, gateway address , DNS server address and other information, and can increase the usage of the address.
Second, install the DHCP service software
Install Isc-dhcp-server:
sudo apt-get install isc-dhcp-server
Third, configure the DHCP service
There are two main configuration files for DHCP, respectively, in/etc/default/isc-dhcp-server and/etc/dhcp/dhcpd.conf. The next thing to do is to configure these two files.
View native Network information
Assume that ens160
the network card is an external network card
Suppose ens192
the NIC is an intranet network card
Configuration isc-dhcp-server
Modify the listening port INTERFACES
to the intranet NIC nameens192
Save exit
- Configure hdcpd.conf
Modify Configuration
subnet 10.0.0.0 netmask 255.255.255.0 {range 10.0.0.10 10.0.0.100;option domain-name-servers 202.206.192.33, 223.5.5.5;option domain-name "mylab.com";option subnet-mask 255.255.255.0;option routers 10.0.0.1;option broadcast-address 10.0.0.255;default-lease-time 600;max-lease-time 7200;}
Line by row explanation
#subnet后跟子网网段,netmask后跟子网掩码subnet 10.0.0.0 netmask 255.255.255.0 {#地址池range 10.0.0.10 10.0.0.100;#DNS服务器地址(多个地址用","隔开)option domain-name-servers 202.206.192.33, 223.5.5.5;#为所分配的域分配域名option domain-name "mylab.com";#为所分配的主机分发子网掩码option subnet-mask 255.255.255.0;#分发默认网关option routers 10.0.0.1;#分发广播地址option broadcast-address 10.0.0.255;#默认租期时间(秒)default-lease-time 600;#最大租期时间(秒)max-lease-time 7200;}
Iv. Start-up service
Start the DHCP service
sudo service isc-dhcp-server restart
- To see if the DHCP service starts properly
sudo netstat -uap
See if the Service list has DHCPD services
V. Verification Services
Restart the NIC on the WIN10 client to get the IP address
Ubuntu-16.04 Building DHCP Service