首页 技术 正文
技术 2022年11月9日
0 收藏 670 点赞 3,324 浏览 2431 个字

我们今天来做DHCP服务器的配置,我们的前提示要实现用一台虚拟机做DHCP服务器

1.首先,我们要有DHCP软件,我们用到下面两个软件(可以使用其他方法从网上直接安装,具体方法网络搜索)

dhcp-3.0pl1-23.i386.rpm

dhcp-devel-3.0pl1-23.i386.rpm

下载后,安装

# rpm -ivh /home/yanji/dhcp*.rpm

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

2.我们更新一下搜索的数据内容,查找我们的主配置文件

# updatedb
# locate dhcpd.conf
/etc/log.d/conf/services/dhcpd.conf
/usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample
/usr/share/man/man5/dhcpd.conf.5.gz

我们不难发现有一个文件是dhcpd.conf.sample,这个文件是我们最重要的切入点。

接下来使用下面的命令在目的目录下新建/etc/dhcpd.conf文件,是DHCP的配置文件

# cp /usr/share/doc/dhcp-3.0pl1/dhcpd.conf.sample /etc/dhcpd.conf

3.下面我们就修改这个DHCP配置文件

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

说明:

名称 解释
subnet 指定子网作用域
option routers 网关
option subnet-mask 网关子网掩码

option domain-name

option domain-name-servers

DNS,设置的域名和域名服务器的IP
option time-offset

时区时间

range dynamic-BOOTP 设置DHCP的地址池
default-lease-time

默认租约时间

max-lease-time 最大租约时间
host 设置保留主机名,即相当于静态分配一个

下面是文字版的配置信息

 ddns-update-style interim;
ignore client-updates; subnet 10.10.10.0 netmask 255.255.255.0 { # --- default gateway
option routers 10.10.10.10;
option subnet-mask 255.255.255.0; option domain-name "ns.gr.org";
option domain-name-servers 10.10.10.10; option time-offset ;
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type ; range dynamic-bootp 10.10.10.100 10.10.10.200;
default-lease-time ;
max-lease-time ; # we want the nameserver to appear at a fixed address
host boss {
next-server marvin.redhat.com;
hardware ethernet ::::AB:CD;
fixed-address 207.175.42.188;
}
}

4.配置完上面的内容后,我们重启一下DHCP服务
# service dhcpd start

查看守护进程(/usr/sbin/dhcpd)# ps -ax | grep dhcpd9782 ?        S      0:00 /usr/sbin/dhcpd
9789 pts/0    S      0:00 grep dhcpd有显示表示我们已经启动了DHCP服务,那么激动的时刻来临了注:5.这里我已经做了前面的几个,所以我的当前虚拟机是使用vmNet 1,ip是10.10.10.10(前面的文章有说明)

我们把虚拟机的DHCP获取去掉

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

再把Windows下面的网络适配器的VMNet1设置为自动获取

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

设置好之后,我们的最关键的都做了,看结果的时候到了,我们运行cmd,输入 ipconfig,下面显示的就证明我们配置成功了(我们配置的地址池最后一个是200),可以用我们的虚拟机做DHCP服务器了

(三)跟我一起玩Linux网络服务:DHCP服务配置之主服务器配置

 6.查看Linux下的租约文件

# cat  /var/lib/dhcp/dhcpd.leases

 # All times in this file are in UTC (GMT), not your local timezone.   This is
# not a bug, so please don't ask about it. There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature. If this is inconvenient or confusing to you, we sincerely
# apologize. Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases() manual page.
# This lease file was written by isc-dhcp-V3.0pl1 lease 10.10.10.200 {
starts // ::;
ends // ::;
binding state active;
next binding state free;
hardware ethernet :::c0::;
uid "\001\000PV\300\000\001";
client-hostname "PC-20140925ISEN";
}

租约文件存在,我们有空的时候可以看看这个租约文件是什么内容。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,905
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,430
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,247
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,058
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,690
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,727