DHCP server:
Environment: Red Hat Enterprise Linux Server Release 5.2
!! Note: Set the IP address to a static IP address. Here I set it to 192.168.0.80.
(1) first attach the disc and install the DHCP package:
Mount: Mount/dev/CDROM/mnt/
Installation Package: rpm-IVH/mnt/Server/DHCP *
Rpm-IVH dhcp-3.0.5-13.el5.i386.rpm
(2) edit the configuration file:
Go to the editing page: Vim/etc/DHCPD. conf
Copy the configuration file template, in the edit interface command line mode: R/usr/share/doc/dhcp-3.0.5/DHCPD. conf. Sample (there are several CIDR Block copy several times template)
1. After the copy is completed, delete the same part, leaving only the beginning
* Ddns-Update-style none; (three modes can be selected here: None | interim | ad-hoc) Note: The configuration file must contain this parameter and be placed on the first line.
# Purpose: Define the supported
# None
# Interim
# Ad-hoc
* Ignore client-updates; function: Ignore client updates
2. Configure the gateway, subnet mask, NIS domain, and (you can set the default value as needed ):
# --- Default Gateway
Option routers 192.168.0.1; Gateway
Option subnet-mask limit 255.0; mask
Option Nis-domain "domain.org"; NIS domain
Option domain-name "domain.org"; default search region
Option domain-name-servers 192.168.1.1; specify the DNS server for the client
Option time-offset-18000; # Eastern Standard timerange dynamic-BOOTP 192.168.0.10 192.168.0.60;
* Range dynamic-BOOTP 192.168.0.10 192.168.0.60; subnet Declaration
Default-lease-time 21600; default lease time
Max-lease-time 43200; Max lease time
Host Declaration * Host test1 {
Note: The host name cannot be identical in host declaration. For example, it can be test1 Test2 test3.
Next-server marvin.redhat.com;
Hardware Ethernet 12: 34: 56: 78: AB: CD; this option is the same as the host retained in windows. When the MAC address is checked at startup, a reserved IP address is assigned.
Fixed-address 207.175.42.254; reserved IP Address
}
I am using the 192.168.0.0/24 CIDR block. I have also created the 192.168.1.0/24 and 192.168.2.0/24 CIDR blocks. I also copied the template file and modified it according to the above process, it is worth noting that the star "*" on my top is not allowed to be repeated in a configuration file.
(3) start the service: Service DHCPD restart
(4) Add the Default Gateway: Route add default GW 192.168.0.1 (the IP address of the DHCP relay server)
DHCP relay server:
Environment: Red Hat Enterprise Linux Server Release 5.2, and add three NICs to it (we use three network segments as an example)
(1) Installing the DHCP software package is the same as the above steps.
(2) modify the nic ip address (Vim/etc/sysconfig/network-scripts/ifcfg-ethx ):
Change the IP address of the first network adapter to 192.168.0.1 (the gateway address of the first network segment of the DHCP server)
Change the IP address of the first network adapter to 192.168.1.1 (the IP address of the Gateway in the second network segment of the DHCP server)
Change the IP address of the first network adapter to 192.168.2.1 (the gateway address of the third network segment of the DHCP server)
Restart NIC: Service Network restart
(3) Enable the server's route forwarding function:
[[Email protected] ~] # Vim/etc/sysctl. conf
Net. ipv4.ip _ forward = 1 (the default value here is 0. Change this value to 1)
[[Email protected] ~] # Sysctl-P (refresh to make the settings take effect)
(5) set interfaces that allow DHCP relay data and IP addresses of DHCP servers:
[[Email protected] server] # Vim/etc/sysconfig/dhcrelay
Interfaces = "eth0 eth1 eth2"
Dhcpservers = "192.168.0.80"
(6) Start the dhcrelay Relay Service Program
[[Email protected] server] # service dhcrelay start
Chkconfig -- level 35 dhcrelay on
(7) check whether the DHCP server and the DHCP relay server can communicate with each other
(8) test:
First test the network segment 192.168.0.0/24:
650) This. width = 650; "src =" http://hiphotos.baidu.com/jiaguodong1122/pic/item/62b1f7fafbc9ce9b7609d79f.jpg "alt =" 62b1f7fafbc9ce9b7609d79f.jpg "/>
Test the network segment 192.168.1.0/24:
650) This. width = 650; "src =" http://hiphotos.baidu.com/jiaguodong1122/pic/item/010f7c0fcd1c82a2267fb54a.jpg "alt =" 010f7c0fcd1c82a2267fb54a.jpg "/>
Continue to test the CIDR Block 192.168.2.0/24:
650) This. width = 650; "src =" http://hiphotos.baidu.com/jiaguodong1122/pic/item/b8c299d78c4f525810df9b57.jpg "alt =" b8c299d78c4f525810df9b57.jpg "/>
You can also view the lease information in the lease file on the DHCP server.
[[Email protected] server] # tail-9/var/lib/DHCPD. Leases
Lease 192.168.2.60 {
Starts 1 09:22:23;
Ends 1 15:22:23;
Binding State active;
Next binding state free;
Hardware Ethernet 00: 0C: 29: 75: 49: 9C;
UID "\ 001 \ 000 \ 014) UI \ 234 ";
Client-hostname "Jia-PC ";
}
Haha ~ So far, the DHCP server and the DHCP relay server have been set up .. Simple! But some details are worth noting !!
This article from the "Wonderful it circle" blog, please be sure to keep this source http://jiagd.blog.51cto.com/3915719/1430767