挂载光盘安装DHCP服务器(本地安装)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了挂载光盘安装DHCP服务器(本地安装)相关的知识,希望对你有一定的参考价值。

首先我们先准备好CentOS的光盘文件(iso格式)使用 root 账户登录

并且配置好静态ip地址

放在桌面上。然后创建个 cdrom 文件夹

( mkdir cdrom )

以下是终端输入的命令和返回的参数

 

[[email protected] Desktop]# mkdir cdrom

[[email protected] Desktop]# rpm -qa|grep dhcp

dhcp-common-4.1.1-51.P1.el6.centos.x86_64

[[email protected] Desktop]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# ls

CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo

CentOS-Debuginfo.repo  CentOS-Media.repo

[[email protected] yum.repos.d]# touch dhcp.repo

[[email protected] yum.repos.d]# ls

dhcp.repo

[[email protected] yum.repos.d]# vim dhcp.repo (这里的dhcp.repo文件的显示内容在文章末尾)

 

[[email protected] yum.repos.d]# mount -o loop /root/Desktop/CentOS-6.8-x86_64-bin-DVD1.iso /root/Desktop/cdrom

 

[[email protected] yum.repos.d]# yum install dhcp

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

dhcp                                                     | 4.0 kB     00:00 …

dhcp/primary_db                                          | 4.7 MB     00:00 …

Resolving Dependencies

–> Running transaction check

—> Package dhcp.x86_64 12:4.1.1-51.P1.el6.centos will be installed

–> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

Package     Arch          Version                            Repository   Size

================================================================================

Installing:

dhcp        x86_64        12:4.1.1-51.P1.el6.centos          dhcp        823 k

 

Transaction Summary

================================================================================

Install       1 Package(s)

 

Total download size: 823 k

Installed size: 1.9 M

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : 12:dhcp-4.1.1-51.P1.el6.centos.x86_64                        1/1

Verifying  : 12:dhcp-4.1.1-51.P1.el6.centos.x86_64                        1/1

 

Installed:

dhcp.x86_64 12:4.1.1-51.P1.el6.centos

 

Complete!

[[email protected] yum.repos.d]# cd /etc/dhcp

[[email protected] dhcp]# ls

dhclient.d  dhcpd6.conf  dhcpd.conf

[[email protected] dhcp]# vim dhcpd.conf (这里编辑dhcpd.conf文件目的是为了将里面的配置文件参考的目录路径复制出来)

[[email protected] dhcp]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf

cp: overwrite `/etc/dhcp/dhcpd.conf’? y

[[email protected] dhcp]# ls

dhclient.d  dhcpd6.conf  dhcpd.conf

[[email protected] dhcp]# vim dhcpd.conf  (这里的dhcpd.conf的配置文件在文章的末尾)

[[email protected] dhcp]# service dhcpd restart

正在启动 dhcpd:                                           [确定]

[[email protected] dhcp]#

 

到这里,我们的DHCP服务器就完成了,接下来我们来在同网的一台windows主机上测试下能不能自动获取ip地址

我们将windows的主机上的ip设置为自动获取

然后我们查看网卡的详细信息,如下图:

 

技术分享

 


上面的dhcp.repo配置文件如下图:

技术分享

上面的 dhcpd.conf 配置文件如下图:

技术分享


本文出自 “Jimmy-Hu” 博客,请务必保留此出处http://jimmy1688.blog.51cto.com/12174375/1864778

以上是关于挂载光盘安装DHCP服务器(本地安装)的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7安装DHCP服务

DHCP

DHCP安装脚本

centos 6.5 搭建DHCP实验

PXE+kickstart自动化安装

PXE批量安装系统