Step one: Configure a static IP for the DHCP server
[[email protected] ~]# ifconfig eth0//View the configuration information of the ETH0 network card
Eth0 Link encap:ethernet HWaddr 00:0c:29:0c:c3:1f
inet addr:192.168.1.33 bcast:192.168.1.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE0C:C31F/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:2519 errors:0 dropped:0 overruns:0 frame:0
TX packets:2644 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1806182 (1.7 mib) TX bytes:1671573 (1.5 MiB)
Interrupt:18 Base address:0x2000
[[email protected] ~]# route-n//View routing table entry
Kernel IP Routing Table
Destination Gateway genmask Flags Metric Ref use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
Step Two:
Install the required packages for the DHCP server as required
[[email protected] ~]# rpm-q DHCP//See if DHCP package is installed, below shows not installed
Package DHCP was not installed
[[email protected] ~]# MKDIR/WW//Create a folder
[[email protected] ~]# MOUNT/DEV/CDROM/WW//mount the system image to the/WW directory
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[[email protected] ~]# rpm-ivh/ww/packages/dhcp-4.1.1-34.p1.el6.x86_64.rpm//install DHCP
Warning:/ww/packages/dhcp-4.1.1-34.p1.el6.x86_64.rpm:header V3 rsa/sha256 Signature, key ID Fd431d51:nokey
Preparing ... ########################################### [100%]
1:dhcp ########################################### [100%]
[Email protected] ~]#
Step Three:
Generating a DHCP server configuration file
[Email protected] ~]# cp/usr//share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf CP: Overwrite "/ETC/DHCP/DHCPD. Conf "? Y
Step Four: Configure the/etc/dhcp/dhcpd.conf configuration file
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks ...
Option Domain-name "example.org";
Option Domain-name-servers 8.8.8.8, 4.4.4.4; Specify DNS server address
Default-lease-time 600;
Max-lease-time 7200;
# Use this to enble/disable dynamic DNS updates globally.
#ddns-update-style None;
# IF This DHCP server is the official DHCP server for the local
# Network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send DHCP log messages to a different log file (you also
# has to hack syslog.conf to complete the redirection).
Log-facility Local7;
# No Service would be given on this subnet, but declaring it helps the
# DHCP Server to understand the network topology.
Subnet 192.168.1.0 netmask 255.255.255.0 {
}
# This is a very basic subnet declaration.
Subnet 192.168.1.0 netmask 255.255.255.0 {//Declaration URL Address
Range 192.168.1.10 192.168.1.100; Set up an address pool
Option routers 192.168.1.1; Set the default gateway
}
# This declaration allows BOOTP clients to get dynamic addresses,
# which we don ' t really recommend.
Subnet 10.254.239.32 netmask 255.255.255.224 {
Range DYNAMIC-BOOTP 10.254.239.40 10.254.239.60;
Option Broadcast-address 10.254.239.31;
option routers rtr-239-32-1.example.org;
}
# A slightly different configuration for A internal subnet.
Subnet 10.5.5.0 netmask 255.255.255.224 {
Range 10.5.5.26 10.5.5.30;
Option Domain-name-servers ns1.internal.example.org;
Option Domain-name "internal.example.org";
Option routers 10.5.5.1;
Option Broadcast-address 10.5.5.31;
Default-lease-time 600;
Max-lease-time 7200;
}
# Hosts which require special configuration options can be listed in
# host statements. If No address is specified, the address would be
# Allocated dynamically (if possible), but the host-specific information
# would still come from the host declaration.
Host Passacaglia {
Hardware Ethernet 0:0:c0:5d:bd:95;
FileName "Vmunix.passacaglia";
Server-name "toccata.fugue.com";
}
# Fixed IP addresses can also is specified for hosts. These addresses
# should not also is listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses has been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address was specified can only
# be booted with DHCP, unless there is a address range on the subnet
# to which a BOOTP client are connected which has the the DYNAMIC-BOOTP flag
# set.
Host Fantasia {
Hardware Ethernet 08:00:07:26:C0:A5;
Fixed-address fantasia.fugue.com;
}
# You can declare a class of clients and then do address allocation
# based on that. The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# Other clients get addresses on the 10.0.29/24 subnet.
Class "Foo" {
Match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}
Shared-network 224-29 {
Subnet 10.17.224.0 netmask 255.255.255.0 {
option routers rtr-224.example.org;
}
Subnet 10.0.29.0 netmask 255.255.255.0 {
option routers rtr-29.example.org;
}
Pool {
Allow members of "Foo";
Range 10.17.224.10 10.17.224.250;
}
Pool {
Deny members of "Foo";
Range 10.0.29.10 10.0.29.230;
}
}
Step five: Start the DHCP server
[[Email protected] ~]# service DHCPD start
Start dhcpd: [OK]
Step Six: Test
Open a windows7 and DHCP under the same network, get IP automatically
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/75/wKioL1WdNwngFy8zAAKq3V4jgy0861.jpg "title=" m1h)) UONFWLXV~WBTSNFC (l.jpg "alt=" Wkiol1wdnwngfy8zaakq3v4jgy0861.jpg "/>
Open/etc/dhcp/dhcpd.conf Modify the fifth row of host parameters after binding Win7 Mac to win7 specified IP
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/75/wKioL1WdP9-y9aSuAAKzqGrxBQY880.jpg "title=" M6htol [Cg53g[hqw$i (yard.jpg "alt=" Wkiol1wdp9-y9asuaakzqgrxbqy880.jpg "/>
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "spacer.gif"/> Restart DHCP Services service DHCPD restart
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s3.51cto.com/wyfs02/m00/6f/79/wkiom1wdp6oi7a24aac_1glhvtu984.jpg "title=" _m}fu_3lftr13g[bfah ' E4N.png "alt=" Wkiom1wdp6oi7a24aac_1glhvtu984.jpg "/>
View Win7 's network connection details
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/75/wKioL1WdQf2CkRMJAAHDx8ni0VI192.jpg "title=" 5[ Mb4w3r ' 4 ' U%f7byz} (udd.png "alt=" Wkiol1wdqf2ckrmjaahdx8ni0vi192.jpg "/>
This article is from the "Lixiaowei" blog, make sure to keep this source http://itlxw.blog.51cto.com/10197289/1672208
Configuration of the Linux DHCP server (redhat6.4)