This article briefly introduces the installation and simple configuration of the DHCP server. Linux server as a DHCP server,
Assign IP addresses to clients in the network.
Prerequisites
IP address segment: 192.168.0.0/24
Linux server fixed IP Address: 192.168.0.1
Client IP Range: 192.168.0.2 ~ 192.168.0.254
1. DHCP Server Installation
[Root @ test ~] # Yum-y install DHCP
2. Configuration
[Root @ test ~] # Vi/etc/DHCPD. conf <br/> # DHCP server configuration file. <br/> # See/usr/share/doc/DHCP */DHCPD. conf. sample <br/> #
Let's take a look at the sample configuration file/usr/share/doc/DHCP */DHCPD. conf. Sample
Copy the example to/etc/DHCPD. conf and modify
[Root @ test ~] # Cp/usr/share/doc/DHCP */DHCPD. conf. Sample/etc/DHCPD. conf <br/> [root @ test ~] # Vi/etc/DHCPD. conf <br/> ddns-Update-style interim; <br/> ignore client-updates; <br/> # modify the IP address and subnet mask in the following sentence based on your actual situation <br/> subnet 192.168.0.0 netmask 255.255.255.0 {<br/> # --- Default Gateway <br/> # If the router connection is used, set it to the IP address of the router <br/> # If the connection is through pppoe, set it to the server IP address <br/> Option routers 192.168.0.1; <br/> Option subnet-mask limit 255.0; <br/> # comment out the following two sentences <br/> # option Nis-domain "domain.org "; <br/> # option domain-name "domain.org "; </P> <p> # Set the IP address of the router if the router connection is used. <br/> Option domain-name-servers 192.168.0.1; <br/> # If pppoe is used, set the DNS server provided by your ISP. <br/> Option domain-name-servers XXX. xxx. xxx. XXX, YYY. YYY. YYY. YYY; </P> <p> Option time-offset-18000; # Eastern Standard Time <br/> # Set the NTP server to change according to your actual situation <br/> Option NTP-servers 192.168.0.1; <br/> # option NetBIOS-name-servers 192.168.1.1; <br/> # --- selects point-to-point node (default is hybrid ). don't change this unless <br/> # -- you understand NetBIOS very well <br/> # option NetBIOS-node-type 2; <br/> # change the IP Range of the DHCP client based on your actual situation <br/> range dynamic-BOOTP 192.168.0.2 192.168.0.254; <br/> default-lease-time 21600; <br/> MAX-lease-time 43200; <br/>}< br/> # We want the nameserver to appear at a fixed address <br/> # assign a fixed IP address to a client host, such as a client winclient fixed <br/> # assign 192.168.0.2 the physical address of the client Nic is AA: BB: CC: DD: EE: FF <br/> # note that when ipconfig/All is used in Windows to view the physical address of the NIC, the address may be displayed <br/> # become AA-BB-CC-dd-ee-FF change to AA: BB: CC: DD: EE: FF <br/> # Otherwise, DHCPD may fail to start. I encountered this problem during configuration and usage. <br/> host winclient {<br/> hardware Ethernet AA: BB: cc: DD: EE: ff; <br/> fixed-address 192.168.0.2; <br/>}
3. DHCP service start and add automatic start upon startup
[Root @ test ~] #/Etc/init. d/DHCPD configtest <br/> Syntax: OK <----- the configuration file is correct <br/> [root @ test ~] #/Etc/init. d/DHCPD start <br/> [root @ test ~] # Chkconfig DHCPD on
Note: This article passes the test in centos5.5.