Dhcp中继服务器实现dhcp服务(三)

Dhcp中继服务器实现dhcp服务

试验目的:中继实现dhcp服务器的ip地址分配

试验环境:linux5.4 操作系统、华为路由器R2621 、华为交换机S2000 windows客户机

网线数条和usb Serial 线 一根

实验拓扑图:


试验步骤:

首先配置华为S2000 交换机:

[Quidway]vlan 10

[Quidway-vlan10]port e1/0/10

[Quidway-vlan10]vlan 20

[Quidway-vlan20]port e1/0/20

[Quidway-vlan20]vlan 30

[Quidway-vlan30]port e1/0/22

[Quidway-vlan30]int e1/0/24

[Quidway-Ethernet1/0/24]port link-

[Quidway-Ethernet1/0/24]port link-type trunk#24端口打trunk#

[Quidway-Ethernet1/0/24]port trunk permit vlan all#允许所有vlan通过#

查看一下交换机配置:

<Quidway>dis vlan 10

VLAN ID: 10

VLAN Type: static

Route Interface: not configured

Description: VLAN 0010

Name: VLAN 0010

Tagged   Ports:

 Ethernet1/0/24          

Untagged Ports:

 Ethernet1/0/10          

<Quidway>dis vlan 20

VLAN ID: 20

VLAN Type: static

Route Interface: not configured

Description: VLAN 0020

Name: VLAN 0020

Tagged   Ports:

 Ethernet1/0/24          

Untagged Ports:

 Ethernet1/0/20          

<Quidway>dis vlan 30

VLAN ID: 30

VLAN Type: static

Route Interface: not configured

Description: VLAN 0030

Name: VLAN 0030

Tagged   Ports:

 Ethernet1/0/24          

Untagged Ports:

 Ethernet1/0/22    

<Quidway>dis ine e1/0/24

PVID: 1

Mdi type: normal

Port link-type: trunk

 VLAN passing  : 1(default vlan), 10, 20, 30  #现在有的vlan 102030都可以通过。#

 Trunk port encapsulation: IEEE 802.1q

再来华为路由器,型号:R3621

[Router]int e0.1#配置子接口#

[Router-Ethernet0.1]vlan-type dot1q vid 10#把这个子接口划分到vlan10#

[Router-Ethernet0.1]ip add 192.168.10.1 24#子接口配置vlan 10ip#

[Router]int eth0.2

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

[Router-Ethernet0.2]ip add 192.168.20.1 24

[Router-Ethernet0.2]int e0.3

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

[Router-Ethernet0.3]ip add 192.168.30.1 24

#配置中继ip地址#

[Router]int eth0.1

[Router-Ethernet0.1]ip relay-address 192.168.30.100

[Router-Ethernet0.1]int eth0.2

[Router-Ethernet0.2]ip relay-address 192.168.30.100

路由器完整配置:

[Router]dis cu

 Now create configuration...

 Current configuration

 !

   version 1.74

   undo pos-server addr-switch

   firewall enable

   aaa-enable

   aaa accounting-scheme optional

 !

 controller e1 0

 !

 interface Aux0

   async mode flow

   link-protocol ppp

 !

 interface Ethernet0

 !

 interface Ethernet0.1

   vlan-type dot1q vid 10

   ip address 192.168.10.1 255.255.255.0

   ip relay-address 192.168.30.100

 !

 interface Ethernet0.2

   vlan-type dot1q vid 20                

   ip address 192.168.20.1 255.255.255.0

   ip relay-address 192.168.30.100      

 !                                      

 interface Ethernet0.3

   vlan-type dot1q vid 30                

   ip address 192.168.30.1 255.255.255.0

 !                                      

 interface Ethernet1

 !                                      

 interface Serial0

   link-protocol ppp                    

 !                                      

 interface Serial1

   link-protocol ppp                    

 !                                      

 Return

交换机路由器配置好后,我们来到linux上配置dhcp服务器。

现在我们来修该配置文件:

Vim  /etc/dhcpd.conf

启动dhcp服务器:

Service dhcpd restart

这时我们用windows server 2003 客户机测试下dhcp服务器的服务是否正常。

测试:

[Router]ping 192.168.30.1  #vlan 30 可以通信#

 PING 192.168.30.1: 56  data bytes, press CTRL_C to break

   Reply from 192.168.30.1: bytes=56 Sequence=0 ttl=255 time = 1 ms

   Reply from 192.168.30.1: bytes=56 Sequence=1 ttl=255 time = 1 ms

   Reply from 192.168.30.1: bytes=56 Sequence=2 ttl=255 time = 2 ms

   Reply from 192.168.30.1: bytes=56 Sequence=3 ttl=255 time = 1 ms

Reply from 192.168.30.1: bytes=56 Sequence=4 ttl=255 time = 1 ms

--- 192.168.30.1 ping statistics ---

   5 packets transmitted

   5 packets received

   0.00% packet loss

   round-trip min/avg/max = 1/1/2 ms

[Router]ping 192.168.20.1#vlan 20可以通信#

 PING 192.168.20.1: 56  data bytes, press CTRL_C to break

   Reply from 192.168.20.1: bytes=56 Sequence=0 ttl=255 time = 1 ms

   Reply from 192.168.20.1: bytes=56 Sequence=1 ttl=255 time = 1 ms

   Reply from 192.168.20.1: bytes=56 Sequence=2 ttl=255 time = 1 ms

   Reply from 192.168.20.1: bytes=56 Sequence=3 ttl=255 time = 1 ms

   Reply from 192.168.20.1: bytes=56 Sequence=4 ttl=255 time = 1 ms

 --- 192.168.20.1 ping statistics ---

   5 packets transmitted

   5 packets received

   0.00% packet loss

   round-trip min/avg/max = 1/1/1 ms

[Router]ping 192.168.30.100#和中继服务器也可以实现通信#

 PING 192.168.30.100: 56  data bytes, press CTRL_C to break

   Request time out

   Request time out

   Request time out

   Request time out

   Request time out

 --- 192.168.30.100 ping statistics ---

   5 packets transmitted

   0 packets received

   100.00% packet loss

下面用客户机测试是否能够获取linux 5.4 上的dhcp服务器能否为客户机自动分配ip

这样看来我们的dhcp服务器可以自动给客户机分配地址池中ip


你可能感兴趣的:(windows,华为交换机,交换机配置,华为路由器,实现dhcp服务器分配ip)