快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

澳门新葡亰平台游戏app:为两个网段安装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

clientconfiguredhcpctldstLICENSEMakefile.confminiresREADMERELNOTESsite.conf

commoncontribdocincludesMakefileMakefile.distomapiprelayservertests

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-time518400;

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 澳门新葡亰平台游戏app192.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 sen澳门新葡亰平台游戏appd 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.1澳门新葡亰平台游戏app68.18/24

Sending onLPF/eth1/00:0f:3d:81:81:23澳门新葡亰平台游戏app/192.168.18/24

Listening on LPF/eth0/00:11:2f:81:ea:28/192.168.123/24

Sending onLPF/eth0/00:11:2f:81:ea:28/192.168.123/24

Sending onSocket/fallback/fallback-net

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

[root@Crazy sbin]# netstat -utln

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local AddressForeign AddressState

tcp00 0.0.0.0:327680.0.0.0:*LISTEN

tcp00 127.0.0.1:327690.0.0.0:*LISTEN

tcp00 0.0.0.0:33060.0.0.0:*LISTEN

tcp00 0.0.0.0:1110.0.0.0:*LISTEN

tcp00 0.0.0.0:60000.0.0.0:*LISTEN

tcp00 0.0.0.0:220.0.0.0:*LISTEN

tcp00 127.0.0.1:6310.0.0.0:*LISTEN

tcp00 0.0.0.0:230.0.0.0:*LISTEN

udp00 0.0.0.0:327680.0.0.0:*

udp00 0.0.0.0:5170.0.0.0:*

udp00 0.0.0.0:8250.0.0.0:*

udp00 0.0.0.0:670.0.0.0:*

udp00 0.0.0.0:1110.0.0.0:*

udp00 0.0.0.0:6310.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:澳门新葡亰平台游戏app42: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

您可能还会对下面的文章感兴趣: