所謂DHCP中繼,即是跨網段爲主機分配IP地址等配置,DHCP Server與DHCP Client處於不同的網段,這時就需要DHCP Relay。
一、實驗配置拓撲圖
圖一
實驗環境說明:由於模擬的服務器只能提供一個地址池,因此我使用兩個DHCP服務器,分別創建DHCP地址池:192.168.3.0/24:192.168.1.2及192.168.4.0/24:192.168.1.4。配置了一個DNS服務器192.168.1.3。
圖二 DHCP服務器地址池配置
圖三 DNS服務器
二、實驗配置
1、Router2的配置
Router2#sh startup-config
Using 580 bytes
!
version 12.4
service password-encryption
!
hostname Router2
!
!
enable password 7 0822455D0A16
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/3/0
ip address 192.168.2.1 255.255.255.0
clock rate 56000
!
interface Vlan1
no ip address
shutdown
!
router eigrp 10 \\啓用EIGRP路由協議
network 192.168.1.0
network 192.168.2.0
auto-summary
!
ip classless
!
!
!
!
!
line con 0
line vty 0 4
password 7 0822455D0A16
login
!
!
end
2、Router0的配置
Router0#sh startup-conf
Using 625 bytes
!
version 12.4
service password-encryption
!
hostname Router0
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
ip address 192.168.4.1 255.255.255.0
ip helper-address 192.168.1.4 \\配置DHCP中繼代理,DHCP服務器是192.168.1.4
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.3.1 255.255.255.0
ip helper-address 192.168.1.2 \\配置DHCP中繼代理,DHCP服務器是192.168.1.2
duplex auto
speed auto
!
interface Serial0/3/0
ip address 192.168.2.2 255.255.255.0
!
interface Vlan1
no ip address
shutdown
!
router eigrp 10 \\啓用EIGRP路由協議
network 192.168.3.0
network 192.168.2.0
network 192.168.4.0
auto-summary
!
ip classless
!
!
!
!
!
line con 0
line vty 0 4
password 7 0822455D0A16
login
!
!
end
3、配置DHCP Client
讓客戶PC動態獲取IP地址。
圖四
圖五
圖六 測試一下
DHCP中繼代理配置其實很簡單。ip helper-address這個命令就搞定了。