如何配置具有多个 VLAN 的 DHCP 中继代理?

网络工程 思科 VLAN dhcp 数据包追踪器
2021-07-30 16:29:49

我有一个带有 2 个路由器的网络。路由器 0 是 DHCP 服务器,我认为路由器 1 应该是中继代理。我使用的路由协议是 EIGRP。

问题是vlan 15和vlan 20中的PC无法从dhcp服务器获取IP地址。我发现我们可以在交换机上配置 ip-helper 但它也不起作用。sh ip route 命令显示它可以看到所有网络。我已经为 vlan 15 和 20 配置了 dhcp 池。

我想我错过了一些关于 vlan 或其他东西的信息。有人能指出我问题出在哪里吗?

这是我的拓扑: 网络拓扑结构

以下是我在拓扑中使用的一些配置:

开关0

en 
conf t
int fa 0/1
switchport access vlan 5
!
int fa 0/2
switchport access vlan 10
!
int gig 0/1
switchport mode trunk
!
int range fa 0/3 - 24
switchport access vlan 99
!
int gig 0/2 
switchport access vlan 99
!
end

路由器

en
conf t
int gig 0/1
no shut
!
int gig 0/1.5
encapsulation dot1q 5 
ip address 195.165.85.62 255.255.255.224
!
int gig 0/1.10
encapsulation dot1q 10
ip address 195.165.85.94 255.255.255.224
!
exit
!
ip dhcp pool vlan5
network 195.165.85.32 255.255.255.224
default-router 195.165.85.62
!
ip dhcp pool vlan10
network 195.165.85.64 255.255.255.224
default-router 195.165.85.94
!
end

路由器 1 'show-running config'

interface GigabitEthernet0/0
ip address 195.165.85.30 255.255.255.252
duplex auto
speed auto
!
interface GigabitEthernet0/1
no ip address
ip helper-address 195.165.85.29
duplex auto
speed auto
!
interface GigabitEthernet0/1.15
encapsulation dot1Q 15
ip address 195.165.85.126 255.255.255.224
!
interface GigabitEthernet0/1.20
encapsulation dot1Q 20
ip address 195.165.85.158 255.255.255.224
!
1个回答

在 Cisco 路由器上配置 DHCP 中继非常简单。ip helper-address <DHCP server address>在第 3 层接口上使用该命令。辅助地址的地址必须可以从配置了辅助地址的路由器到达,例如 Router0 接口到 Router1。

您将帮助程序地址放在没有 VLAN 的物理接口上。您需要将帮助程序地址放在各个子接口上(每个子接口可以使用不同的 DHCP 服务器)。

您的 DHCP 服务器必须对它作为 DHCP 服务器的每个网络都有一个范围。

顺便说一句,永远不要在问题中使用图片作为文本。只需复制文本并将其粘贴到您的问题中,突出显示文本,然后使用预格式化文本按钮:{}

编辑:

您的 Router0 需要 VLAN 15 和 20 的范围:

ip dhcp pool vlan15
 network 195.165.85.96 255.255.255.224
 default-router 195.165.85.126

ip dhcp pool vlan20
 network 195.165.85.128 255.255.255.224
 default-router 195.165.85.158

Router1 需要接口上的帮助程序地址:

interface GigabitEthernet0/1.15
 encapsulation dot1Q 15
 ip address 195.165.85.126 255.255.255.224
 ip helper-address 195.165.85.29

interface GigabitEthernet0/1.20
 encapsulation dot1Q 20
 ip address 195.165.85.158 255.255.255.224
 ip helper-address 195.165.85.29

您还需要确保Router0 可以ping 通Router1 中的G0/1.15 和G0/1.20 接口。