The configuration method is actually very simple!! But we need to pay attention to some problems:
1, the DHCP service can not cross the network segment can only be used for intranet use can not be placed outside the network
2, if the virtual machine to simulate, you need to turn off the virtual DHCP
3, in a network segment is not allowed to have 2 DHCP server or conflict can not be used normally
In RH9, the DHCPD configuration file is:/etc/dhcpd.conf default, this file does not exist, it needs to be created by hand, dhcp-3.0pl1-23.i386.rpm on the Redhat installation CD
You can use the command Rpm-qa | grep DHCP lookup Whether DHCP is installed
The output is as follows:
Dhcp-devel-3.0pl1-23
Dhcp-3.0pl1-23
Then enter RPM-QL dhcp-3.0pl1-23
Output:
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcrelay
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcrelay
/usr/bin/omshell
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-3.0pl1
/usr/share/doc/dhcp-3.0pl1/changes
/usr/share/doc/dhcp-3.0pl1/readme
/usr/share/doc/dhcp-3.0pl1/relnotes
/usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample (This is the dhcpd.conf template file)
/usr/share/man/man1/omshell.1.gz String 6
/usr/share/man/man5/dhcp-eval.5.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcp
/var/lib/dhcp/dhcpd.leases (this file must exist or the service will fail.) This saves information about the machines that request IP addresses from the server, including: Some records of IP DNS assigned by the customer's MAC address this information can help you find some problems in your network.
If you use the source code package installation, some of the configuration files here are not the same address.
You can view the contents of a template by using the less command.
#less/usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample
DHCP server configuration, we have to copy the profile template to modify
Here is an example of an operation:
#cd/etc
#cp/usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample dhcp.conf//Copy profile template
#vi/etc/dhcpd.conf//Use VI to modify/ETC/DHCPD.CONF
#cat/etc/dhcpd.conf//Display configuration file contents
#每行结尾是;
Ddns-update-style Interim;
Ignore client-updates;
Subnet 192.168.117.0 netmask 255.255.255.0 {//Set subnet declaration
String 2
Option routers 192.168.117.2; Setting a default gateway for DHCP users
Option broadcast-address 192.168.117.255; Set up broadcast addresses for customers
Option Subnet-mask 255.255.255.0; Set up a subnet flood code for the customer
Option Domain-name "77168.com"; Setting up a DNS domain for clients
Option Domain-name-servers 192.168.117.154,218.85.157.99; Set the DNS server address for the customer, if it is multiple use, split
Option time-offset-18000;
Range DYNAMIC-BOOTP 192.168.117.10 192.168.117.200; Set Address pool
Default-lease-time 21600; Set a default address lease for a customer
Max-lease-time 43200; Set the maximum address lease for a customer
group{
Host Greenpig {//Set hosts declaration
Hardware Ethernet 100:0C:29:4F:20:DC; Specify the customer's MAC address
Fixed-address 192.168.117.210; Assign a fixed IP address to a specified MAC address
}
}
To start a DHCP server:
#service DHCPD Start
String 5
To configure a DHCP client:
Linux, in the graphical interface to select the automatic access to IP address settings using DHCP can,
If you configure the win client to select Internet Protocol (TCP/IP) stand-alone properties, choose to obtain an IP address automatically ...
Linux command line with Netconfig to select DHCP
Then use the Command service network restart to restart the network or use Ifdown eth0 then ifup eth0 is also possible
Win under command ipconfig/renew to refresh IP address