First, check whether the DHCP service is installed: [root @ DHCPserver] # rpm-qdhcppackagedhcpisnotinstalled puts the disc into the optical drive and mounts it through the mount command. [Root @ DHCPserver] # mountdevcdrommntmount: blockdevicedevcdromiswrite-protected, mountingread-on first check whether the DHCP service is installed:
[Root @ DHCPserver/] #
Rpm-q dhCp
Package dhcp is not install
Ed
Put the CD in the optical drive and mount it
CommandAttach.
[Root @ DHCPserver/] #
Mount/dev/CdRom/mnt
Mount: block device/dev/cdrom is
Write-Protected, mounting read-only
[Root @ DHCPserver/] #
Cd/mnt/CentOS/
[Root @ DHCPserver CentOS] #
Ls|
GrepDhcp // view the keyword "dhcp" File
Dhcp-3.0.5-21.el5.i386.rpm
Dhcp-devel-3.0.5-21.el5.i386.rpm
Dhcpv6-1.0.10-17.el5.i386.rpm
Dhcpv6-client-1.0.10-17.el5.i386.rpm
Libdhcp-1.20-10.el5.i386.rpm
Libdhcp4client-3.0.5-21.el5.i386.rpm
Libdhcp4client-devel-3.0.5-21.el5.i386.rpm
Libdhcp6client-1.0.10-17.el5.i386.rpm
Libdhcp6client-devel-1.0.10-17.el5.i386.rpm
Libdhcp-devel-1.20-10.el5.i386.rpm
Sblim-
CmpI-dhcp-0.5.5-35.el5.i386.rpm
Sblim-cmpi-dhcp-devel-1-35.el5.i386.rpm
Sblim-cmpi-dhcp-test-1-35.el5.i386.rpm
------------------ Annotation ----------------------
Dhcp-* DHCP server software package
Dhclient-* DHCP Client Software Package
Dhcp-devel-* DHCP development tool, not required
--------------------------------------------
There is a DHCP installation package in this directory. Run the rpm command to install it. [Root @ DHCPserver CentOS] #
Rpm-ivh dhcp-3.0.5-21.el5.i386.rpm
Warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ######################################## ### [100%]
1: dhcp ####################################### #### [100%] After installation, check whether the tool is installed on the machine. [Root @ DHCPserver CentOS] #
Rpm-q dhcp
The dhcp-3.0.5-21.el5 has a template under the installation directory (
/Usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample), Overwrite the data by using the CP command.
[Root @ DHCPserver CentOS] #
Cp/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample/etc/dhcpd. conf
Cp: overwrite "/etc/dhcpd. conf "?
YUse vi to enter the dhcpd. conf configuration file for configuration.
[Root @ DHCPserver CentOS] # vi/etc/dhcpd. conf
- DdNs-upDate-Style interim; # configure to use the transitional DHCP-DNS interactive update mode.
- Ignore client-updates; # ignore client updates
-
-
- SuBnet 192.168.1.0 netmask 255.255.255.0 {
-
- Option routers 192.168.1.1; # vro address
- Option subnet-mask limit 255.0; # subnet mask option
-
- Option nis-domain \ "xfbaydhcp.com \";
- Option domain-name \ "xfbaydhcp.com \"; # domain name
- Option domain-name-servers 202.102.152.3; # DNS address
-
- OptionTime-OffSet-18000; # Eastern Standard Time
-
- Range dynamic-bootp 192.168.1.100 192.168.1.200; # the range of the rented IP Address
- Default-lease-time 21600; # default lease time
- Max-lease-time 43200; # maximum lease time
-
- # We want the nameserver to appear at a fixed address
- Host ns {
- NExT-server marvin.RedHat.com;
- Hardware ethernet 12: 34: 56: 78: AB: CD;
- Fixed-address 207.175.42.254;
- }
- }
After the configuration is complete, the DHCP service is set up and you can start the service. [Root @ DHCPserver CentOS] # service dhcpd start ----------------------- comment -----------------
Service dhcpd start # start the service
Service dhcpd stop # stop the service
Service dhcpd restart # restart the service
----------------------------------------------
Linux client:
Modify the file for the ifcfg-eth0, change the BOOTPROTO option to DHCP, and get it automatically.
[Root @ localhost ~] # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
# AdvaNcEd Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE = eth0
BOOTPROTO =Dhcp
HWADDR = 00: 0C: 29: D1: 8D: D2
ONBOOT = dhcp
Restart the network service
[Root @ localhost ~] # Service network restart
PassIfconfigCommand to see that the IP address has been obtained
- eth0 Link encap:Ethernet HWaddr 00:0C:29:D1:8D:D2
- inet addr:192.168.1.101 Bcast:192.168.1.1 Mask:255.255.255.0
- inet6 addr: fe80::20c:29ff:fed1:8dd2/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:2093 errors:2 dropped:0 overruns:0 frame:0
- TX packets:634 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:184237 (179.9 KiB) TX bytes:73399 (71.6 KiB)
- Interrupt:169 Base address:0x2000
-
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:16436 Metric:1
- RX packets:1129 errors:0 dropped:0 overruns:0 frame:0
- TX packets:1129 errors:0 dropped:0 overruns:0 carrier:0