DHCP server settings
1. Set the DHCP server network address to static assignment first:
Vim/etc/sysconfig/network-*/*-eth0
Device=eth0
Onboot=yes
Bootproto=statics
hwaddr=00:0c:29:56:ea:8a
ipaddr=192.168.1.109
gateway=192.168.1.1
netmask=255.255.255.0
Service Network restart
2. Installing the configuration DHCP server
Yum Install DHCP
Vim/etc/dhcp/dhcpd.conf (later version of linux6)
Vim/etc/dhcpd.conf (version of LINUX5)
Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.1 192.168.1.111; #从192.168.1.1 to 192.168.1.111 (set the address pool yourself)
Option Domain-name-servers 192.168.1.1,8.8.8.8,192.168.1.109; #DNS地址
Option Domain-name "walls.com"; #域名
Option routers 192.168.1.1; #路由器地址
Option Subnet-mask 255.255.255.0; #子网掩码
Option broadcast-address 192.168.1.109; #广播地址 (required within the address pool)
Default-lease-time 21600; #默认租约时间
Max-lease-time 43200; #最大租约时间
}
Host ABC {
Hardware Ethernet 00:0c:29:0a:7b:86; #指定机器MAC地址
Fixed-address 192.168.1.220; #给该机器指定IP地址 (this address is outside the address pool above)
}
When the configuration is complete,
Service DHCPD Restart
PS: If the DHCP server fails to start, check that the configuration file is formatted correctly, or view tail-50/var/log/messages |less
Lazy people can directly copy my configuration file for modification, which I have tested.
This article is from the "11736340" blog, please be sure to keep this source http://11746340.blog.51cto.com/11736340/1793083
Linux DHCP server settings (replicable code)