CentOS 5.4 下配置DHCP服務(wù)器全過(guò)程
設(shè)置完成,DHCP服務(wù)就搭建好了,啟動(dòng)服務(wù)即可。
[root@DHCPserver CentOS]# service dhcpd start
-----------------------注釋-----------------
service dhcpd start #啟動(dòng)服務(wù)
service dhcpd stop #停止服務(wù)
service dhcpd restart #重啟服務(wù)
----------------------------------------------
----------------------------------------------
linux客戶端:
修改ifcfg-eth0的文件,將BOOTPROTO選項(xiàng)改為DHCP,自動(dòng)獲取。
[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
重新啟動(dòng)網(wǎng)絡(luò)服務(wù)
[root@localhost ~]# service network restart
通過(guò)ifconfig命令可以看到已經(jīng)獲取到了IP地址
- 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
- collisions:0 txqueuelen:0
- RX bytes:2006336 (1.9 MiB) TX bytes:2006336 (1.9 MiB)
本文出自 “SDbaby” 博客,請(qǐng)務(wù)必保留此出處http://sdbaby.blog.51cto.com/149645/325905
首先檢查DHCP服務(wù)是否安裝:
[root@DHCPserver /]# rpm -q dhcp
package dhcp is not installed
將光盤(pán)放入光驅(qū),通過(guò)mount命令進(jìn)行掛載。
[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 | grep dhcp //查看關(guān)鍵字“dhcp”文件
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
------------------注解----------------------
dhcp-* DHCP服務(wù)器軟件包
dhclient-* DHCP客戶機(jī)軟件包
dhcp-devel-* DHCP開(kāi)發(fā)工具,非必需
--------------------------------------------
[root@DHCPserver /]# rpm -q dhcp
package dhcp is not installed
將光盤(pán)放入光驅(qū),通過(guò)mount命令進(jìn)行掛載。
[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 | grep dhcp //查看關(guān)鍵字“dhcp”文件
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
------------------注解----------------------
dhcp-* DHCP服務(wù)器軟件包
dhclient-* DHCP客戶機(jī)軟件包
dhcp-devel-* DHCP開(kāi)發(fā)工具,非必需
--------------------------------------------
在這個(gè)目錄下有DHCP的安裝包,使用rpm命令進(jìn)行安裝。
[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%]
warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
安裝完之后檢查是否安裝到機(jī)器上。
[root@DHCPserver CentOS]# rpm -q dhcp
dhcp-3.0.5-21.el5
dhcp-3.0.5-21.el5
在安裝目錄下有一個(gè)模板(/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample),通過(guò)CP命令進(jìn)行覆蓋。
[root@DHCPserver CentOS]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆蓋“/etc/dhcpd.conf”? y
[root@DHCPserver CentOS]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆蓋“/etc/dhcpd.conf”? y
通過(guò)vi進(jìn)入dhcpd.conf配置文件進(jìn)行配置
[root@DHCPserver CentOS]# vi /etc/dhcpd.conf
[root@DHCPserver CentOS]# vi /etc/dhcpd.conf
- ddns-update-style interim; #配置使用過(guò)渡性 DHCP-DNS互動(dòng)更新模式。
- ignore client-updates; #忽略客戶端更新  
關(guān)鍵詞:CentOS,DHCP服務(wù)器
閱讀本文后您有什么感想? 已有 人給出評(píng)價(jià)!
- 0
- 0
- 0
- 0
- 0
- 0