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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章