DHCP中继的配置

1、要求:

现有一台路由器,一台交换机,一台服务和两台PC机。要求模拟三个不同VLAN网段,两台PC机和一台服务器分别在不同的VLAN中,其中服务器为DHCP服务器,其中DHCP服务器能够为其他两个VLAN提供自动分配IP地址。

2、网络拓扑图:

网络拓扑图如图1所示:

DHCP中继的配置_服务器

1:网络拓扑图

3、设备的配置

(1)路由器的配置:

[Router-Ethernet0]int eth0.1

[Router-Ethernet0.1]vlan-type dot1q ?

   vid                 VLAN id

[Router-Ethernet0.1]vlan-type dot1q vid 10

[Router-Ethernet0.1]ip add ?

 X.X.X.X        IP address

[Router-Ethernet0.1]ip add 192.168.1.1 ?

 X.X.X.X        IP subnet mask

 INTEGER<8-30>  IP subnet mask length

[Router-Ethernet0.1]ip add 192.168.1.1 24

[Router-Ethernet0.1]

%01:09:38: Line protocol ip on the interface Ethernet0.1 is UP

[Router-Ethernet0.1]ip relay-address 192.168.3.100    //配置中继

[Router-Ethernet0.1]int eth0.2

[Router-Ethernet0.2]vlan-type dot1q vid 20

[Router-Ethernet0.2]ip add 192.168.2.1 24

[Router-Ethernet0.2]

%01:10:30: Line protocol ip on the interface Ethernet0.2 is UP

[Router-Ethernet0.2]ip relay-address 192.168.3.100    //配置中继

[Router-Ethernet0.2]int eth0.3

[Router-Ethernet0.3]vlan-type dot1q vid 30

[Router-Ethernet0.3]ip add 192.168.3.1 24

[Router-Ethernet0.3]

%01:12:36: Line protocol ip on the interface Ethernet0.3 is UP

(2)交换机的配置:

<Quidway>system-view

[Quidway]vlan 10

[Quidway-vlan10]

[Quidway-vlan10]vlan 20

[Quidway-vlan20]vlan 30

[Quidway-Ethernet1/0/10]port access vlan 10

[Quidway-Ethernet1/0/10]int eth1/0/20

[Quidway-Ethernet1/0/20]port acc

[Quidway-Ethernet1/0/20]port access vlan 20

[Quidway-Ethernet1/0/20]int eth1/0/24  

[Quidway-Ethernet1/0/24]port

[Quidway-Ethernet1/0/24]port ac

[Quidway-Ethernet1/0/24]port access vlan

[Quidway-Ethernet1/0/24]port access vlan 30

[Quidway-Ethernet1/0/22]port link-type trunk ?

 <cr>  

[Quidway-Ethernet1/0/22]port link-type trunk

[Quidway-Ethernet1/0/22]port trunk permit vlan all

Please wait........................................... Done.

(3)服务器的配置:

这里是用2003作为DHCP服务器配置的,具体操作如下;

第一步:打开控制面板----->添加/删除Windos组件,然后如图2操作:

DHCP中继的配置_交换机_02

2:添加网络和应用程序服务

此时点击详细信息可以看到DHCP已经被选上了,然后点击下一步,此时会看在安装配置组件。

第二步:安装完成后点击管理工具,会看到DHCP然后点击,接着出现一对话框,点击DHCP右击,如图3所示:

DHCP中继的配置_拓扑图_03

3:新建作用域

第四步:点击新建作用域配置VLAN10maktDHCP,具体如图4所示:

DHCP中继的配置_交换机_04

4:配置VLAN10自动获取的DHCP

第五步:点击下一步,出现排除网段的对话框,如图5所示:

DHCP中继的配置_拓扑图_05

5:排除

第六步:点击下一步,下一步一直到配置网关和DNS操作,如图6和图7所示:

DHCP中继的配置_路由器_06

6:配置默认网关配置

DHCP中继的配置_服务器_07

7DNS配置

然后点击下一步,下一步就完成了,VLAN20 tecDHCP的配置与上面类似。

然后测试DHCP服务是否能够与自己的网关能否ping通,以及能否ping通路由器的其他IP,操作如图8910所示:

DHCP中继的配置_服务器_08

8ping自己的网关

DHCP中继的配置_路由器_09

9ping 192.168.2.1

DHCP中继的配置_拓扑图_10

10ping 192.168.1.1

(4)PC-B的配置和验证DHCP的分配以及DNS的获得

用一台防火墙模拟PC-B,具体配置如下操作:

<FW-3>system-view

System View: return to User View with Ctrl+Z.

[FW-3]sysname PC-A

[PC-A]sysname PC-B

[PC-B]interface e

[PC-B]interface Ethernet0/0

[PC-B-Ethernet0/0]undo ip add

[PC-B-Ethernet0/0]undo ip add dhcp-alloc

[PC-B-Ethernet0/0]ip address dhcp-alloc

验证:

[PC-B]dis int et0/0

Ethernet0/0 current state :UP  

Line protocol current state :UP

Description : Ethernet0/0 Interface

The Maximum Transmit Unit is 1500, Hold timer is 10(sec)

Internet Address is 192.168.2.2/24, acquired via DHCP

[PC-B]dis dns server dynamic    //查看自动获取DNS

Domain-server        IpAddress

    0               1.1.1.1            

    1               2.2.2.2  

(5)PC-B的配置和验证DHCP的分配以及DNS的获得

用一台防火墙模拟PC-A,具体配置如下操作:

<PC-A>system-view

System View: return to User View with Ctrl+Z.

[PC-A]int et0/0

[PC-A-Ethernet0/0]undo ip add d

[PC-A-Ethernet0/0]undo ip add dhcp-alloc

[PC-A-Ethernet0/0]ip add dh

[PC-A-Ethernet0/0]ip add dhcp-alloc

验证:

[PC-A]dis int et0/0

Ethernet0/0 current state :UP  

Line protocol current state :UP

Description : Ethernet0/0 Interface

The Maximum Transmit Unit is 1500, Hold timer is 10(sec)

Internet Address is 192.168.1.2/24, acquired via DHCP

[PC-B]dis dns server dynamic    //查看自动获取DNS

Domain-server        IpAddress

    0               1.1.1.1            

    1               2.2.2.2