`

为两个网段安装DHCP服务器

 
阅读更多

我的电脑连接两个网段(eth0:192.168.123.0/24,eth1:192.168.18.0/24),系统中redhat 9,本文将把本机安装成两个网段DHCP服务器,仅作测试用……

1.下载 DHCP 3.0.3 点击下载

2.解压:

[root@Crazy bak]# tar zxvf dhcp-3.0.3.tar.gz
dhcp-3.0.3
dhcp-3.0.3/client
......
[root@Crazy bak]# cd dhcp-3.0.3
[root@Crazy dhcp-3.0.3]# ls
client configure dhcpctl dst LICENSE Makefile.conf minires README RELNOTES site.conf
common contrib doc includes Makefile Makefile.dist omapip relay server tests

3.安装:

[root@Crazy dhcp-3.0.3]# ./configure
System Type: linux-2.2
......
[root@Crazy dhcp-3.0.3]# make;make install

4.编辑/etc/dhcpd.conf(需手动创建)

root@Crazy etc]# vi dhcpd.conf

#全局设置

default-lease-time 259200;
max-lease-time 518400;

option domain-name-servers 202.96.134.133,202.96.128.68;

ddns-update-style ad-hoc;

#192.168.18.0/24网段,分配IP为:192.168.18.200-
192.168.18.250
subnet 192.168.18.0 netmask 255.255.255.0{
range 192.168.18.200 192.168.18.250;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.18.255;
option routers 192.168.18.1;
}

#192.168.123.0/24网段,分配IP为:192.168.123.200-192.168.123.250
subnet 192.168.123.0 netmask 255.255.255.0 {
range 192.168.123.200 192.168.123.250;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.123.255;
option routers 192.168.123.254;
}

#为网卡MAC为00:11:5B:10:24:9B分配一静态IP:192.168.18.251,做测试用
host crazy{
hardware ethernet 00:11:5B:10:24:9B;
fixed-address 192.168.18.251;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.18.255;
option routers 192.168.18.1;
}

5.试启动DHCP(默认启动程序为/usr/sbin/dhcpd)

[root@Crazy sbin]# dhcpd
Internet Systems Consortium DHCP Server V3.0.3
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Can't open lease database /var/state/dhcp/dhcpd.leases: No such file or directory --
check for failed database rewrite attempt!
Please read the dhcpd.leases manual page if you
don't know what to do about this.

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.

#启动出错,根据出错信息,Can't open lease database /var/state/dhcp/dhcpd.leases: No such file or directory --
# check for failed database rewrite attempt!,建立/var/state/dhcp/dhcpd.leases

6.调试

[root@Crazy root]# touch /var/state/dhcp/dhcpd.leases

7.再启动DHCP

[root@Crazy sbin]# dhcpd
Internet Systems Consortium DHCP Server V3.0.3
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 leases to leases file.
Listening on LPF/eth1/00:0f:3d:81:81:23/192.168.18/24
Sending on LPF/eth1/00:0f:3d:81:81:23/192.168.18/24
Listening on LPF/eth0/00:11:2f:81:ea:28/192.168.123/24
Sending on LPF/eth0/00:11:2f:81:ea:28/192.168.123/24
Sending on Socket/fallback/fallback-net

#OK,如出现上面的信息,DHCP应该就已经正常启动了,可以通过以下命令查看是否已启动DHCP

[root@Crazy sbin]# netstat -utln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:32769 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN
udp 0 0 0.0.0.0:32768 0.0.0.0:*
udp 0 0 0.0.0.0:517 0.0.0.0:*
udp 0 0 0.0.0.0:825 0.0.0.0:*
udp 0 0 0.0.0.0:67 0.0.0.0:*
udp 0 0 0.0.0.0:111 0.0.0.0:*
udp 0 0 0.0.0.0:631 0.0.0.0:*

#上面信息中的67就是DHCP所用端口,一切OK了

8.客户端进行测试(均为win2k的系统,IP设为自动)

#以下是192.168.18.0/24的测试信息

Ethernet adapter 本地连接:

Connection-specific DNS Suffix . :

Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC

Physical Address. . . . . . . . . : 00-11-5B-10-24-9B

Dhcp Enabled. . . . . . . . . . . : Yes

Autoconfiguration Enabled . . . . : Yes

IP Address. . . . . . . . . . . . : 192.168.18.250

#注意,此时IP为192.168.18.250,是因为在/etc/dhcpd.conf中没还没加入最后一段

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 192.168.18.1

DHCP Server . . . . . . . . . . . : 192.168.18.168

DNS Servers . . . . . . . . . . . : 202.96.134.133

202.96.128.68

Lease Obtained. . . . . . . . . . : 2005年9月13日 15:42:39

Lease Expires . . . . . . . . . . : 2005年9月16日 15:42:39

#以下是192.168.123.0/24的测试信息

Ethernet adapter 本地连接:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8139(A) PCI Fast Ethernet Adapter #2
Physical Address. . . . . . . . . : 00-E0-4C-73-50-1B
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.123.249
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.123.254
DHCP Server . . . . . . . . . . . : 192.168.123.168
DNS Servers . . . . . . . . . . . : 202.96.134.133
202.96.128.68
Lease Obtained. . . . . . . . . . : 2005年9月13日 15:53:28
Lease Expires . . . . . . . . . . : 2005年9月16日 15:53:28

9.完成

分享到:
评论

相关推荐

    实战:在单网段环境中配置安装和配置DHCP服务器

    在单网段环境中配置安装和配置DHCP服务器,动态主机设置协议(英语:Dynamic Host Configuration Protocol,DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:用于内部网或网络服务供应商自动分配IP...

    管理论文:企业DHCP服务器配置与管理.doc

    企业DHCP服务器配置与管理 摘要:本文主要以典型企业网络结构出发,具体介绍了cisco路由器上如何配置DHC P服务器,及针对多个vlan环境下DHCP中继的配置,并讨论如何管理DHCP服务器以提高网 络的安全性能。...

    多媒体教学系统介绍.doc

    2、在DHCP服务器上点右键,选择"新建作用域" 3、点"下一步"之后,在名称和描述框里填写相应内容后,再点"下一步" 4、在这一步中,需要根据终端的数量,决定建立多大的作用域,在本例中,建立一 个10个终端用的DHCP...

    两个路由器相连

    两个路由器连接最常见的应用是你家里现在有一个路由器,现在在想接一个无线路由器,如果不通过简单的设置是没有办法上网的,因为二个路由器在一个网段内IP地址都一样二个路由器连接有两个DHCP服务器共同工作所以IP会...

    WAN综合实验-2.pka

    修改设备名称(根据拓扑标注),关闭DNS解析功能,特权加密密码为ciscocisco,在CON口设置空闲超时为2分钟10秒, 在VTY口设置空闲超时为永不超时,在这两个线路平台使用光标跟踪,密码为cisco。所有的明文需要进行再...

    企业网络服务器规划与管理.doc

    "基本 "局域网服务器包括:DNS服务器、DHCP服务器、Web服务器、FT" "要求 "P服务器、VPN服务器、邮件服务等。 " " "网络中的服务器必须具有容错和负载均衡能力。 " " "网络操作系统的选择:在Windows " " "Server、...

    企业网络服务器规划与管理..doc

    "基本 "局域网服务器包括:DNS服务器、DHCP服务器、Web服务器、FT" "要求 "P服务器、VPN服务器、邮件服务等。 " " "网络中的服务器必须具有容错和负载均衡能力。 " " "网络操作系统的选择:在Windows " " "Server、...

    企业网络服务器规划与管理(2).doc

    "局域网服务器包括:DNS服务器、DHCP服务器、Web服务器、FT" "要求 "P服务器、VPN服务器、服务等。 " " "网络中的服务器必须具有容错和负载均衡能力。 " " "网络操作系统的选择:在Windows " " "Server、UNIX、Linux...

    企业网络服务器规划与管理(1).doc

    "基本 "局域网服务器包括:DNS服务器、DHCP服务器、Web服务器、FT" "要求 "P服务器、VPN服务器、邮件服务等。 " " "网络中的服务器必须具有容错和负载均衡能力。 " " "网络操作系统的选择:在Windows " " "Server、...

    两个路由器连接_静态路由设置_共享上网图解.doc

    两个路由器连接最常见的应用是你家里现在有一个路由器,现在在想接一个无线路由器,如果不通过简单的设置是没有办法上网的,因为二个路由器在一个网段内IP地址都一样二个路由器连接有两个DHCP服务器共同工作所以IP会...

    家里两台路由器连接方法.doc

    两个路由器连接最常见的应用是你家里现在有一个路由器,现在在想接一个无线路由器, 如果不通过简单的设置是没有办法上网的,因为二个路由器在一个网段内IP地址都一样二 个路由器连接有两个DHCP服务器共同工作所以IP会...

    MCITP 2012综合实验(一)之实验手册 V2.2

    3、所有vlan中客户端通过DHCP服务器分配IP地址,IP地址起止范围为100-200; 4、所有服务器均位于vlan1中,其他每个vlan中均有一台windows 8客户端,IP地址动态获取。 三)系统部分 1、两台Hyper-V主机安装Hyper-V ...

    企业网络故障排除-2.pka

    修改设备名称(根据拓扑标注),关闭DNS解析功能,特权加密密码为ciscocisco,在CON口设置空闲超时为2分钟10秒, 在VTY口设置空闲超时为永不超时,在这两个线路平台使用光标跟踪,密码为cisco。所有的明文需要进行再...

    路由安装演示很好用的,大家分享。

    (右键点网上邻居,会看到有两个网卡,显示本地连接1,本地连接2,搞清楚哪个和猫连,哪个和另一台电脑连)一定要注意安装双网卡的电脑只需要设置一个网卡的IP地址,那就是连接另一台电脑的那一个网卡,如果不知道是...

    【捷顺科技】服务器调试手册.doc

    可先尝试使用这两个IP :8866 页面进行访问。如果不能访问,请参考下面的步骤。 搜索IP: 使用main.exe驱动搜索处理器IP。 工具下载请访问 :techsupport.megvii/hc/kb/article/198265/ 修改处理器网络:需先将本地电脑...

    WAN综合实验-3.pka

    修改设备名称(根据拓扑标注),关闭DNS解析功能,特权加密密码为ciscocisco,在CON口设置空闲超时为20分钟, 在VTY口设置空闲超时为永不超时,在这两个线路平台使用光标跟踪,密码为cisco。所有的明文需要进行再...

    网络设计方案说明.doc

    7楼以上为公司办公和租赁写字楼,所以7楼以上为一个单独的局域 网,由中国联通100M光纤接入,为节约成本可先接入10M光纤,以后根据流量在扩大。两 个接入点之间预留一根千兆网线,一但运营商光纤出现问题可以快速接...

    X-Router(超级软路由) 7.4

     能自动检测内网中非法存在的DHCP服务器、PPPOE服务器、ARP欺骗等,并给予提示。  具有控制台管理界面和WEB管理界面两个平台,可根据喜好使用。  可向客户机推送通知等信息。(免费版会显示X-Router提示)  ...

    两级路由器设置.doc

    两级路由器设置 方法一、Lan口对Wan口 在一级路由器能正常上网的情况下: 1.将计算机的TCP/IP属性中的IP地址和DNS地址都设成自动获取,将IE属性中的局域网 设置项...这是由于两个路由器分配的IP处于 不同网段造成的。

    多媒体教室

    如果您需要在两个组播不通的网段间使用多媒体网络教室,就必须在以 Windows NT 作为网关的机器上安装路由器软件,安装方法如下: 1. 使网关的两块网卡分别对应不同的网段,并将各网段的学生机设置网关为相应网段的...

Global site tag (gtag.js) - Google Analytics