DHCP 监听问题

网络工程 思科 转变 路由器 dhcp 监听
2022-02-09 10:45:57

我在使用非常简单的 DHCP 侦听配置时遇到了一些问题。

我的拓扑

我正在使用一个非常简单的拓扑,使用棒上的路由器。我使用 VLAN 10 和 VLAN 20。

当我的交换机上未启用 dhcp snooping 时,我的客户端可以从我的路由器获取 DHCP,但是当我启用 snooping 时,他们无法再获得 IP。

我的交换机有接口 f0/6 和 f0/11 作为接入端口,f0/6 在 vlan 10 上,f0/11 在 vlan 20 上。f0/1 处于中继模式。

我的交换机配置:

Switch DHCP snooping is enabled
DHCP snooping is configured on following VLANs:
1-100
Insertion of option 82 is enabled
Option 82 on untrusted port is not allowed
Verification of hwaddr field is enabled
Interface                  Trusted    Rate limit (pps)
-----------------------    -------    ----------------
FastEthernet0/1            yes        unlimited       

未启用 DHCP 侦听时我有完全连接,所以我只是问为什么启用侦听时它不起作用。

我在交换机上的“显示运行”配置:

!
ip dhcp relay information trust-all
!
ip dhcp snooping vlan 1-100
ip dhcp snooping
!
interface FastEthernet0/1
 switchport trunk native vlan 99
 ip dhcp snooping trust
 switchport mode trunk
!
interface FastEthernet0/6
 switchport access vlan 10
 switchport mode access
!
interface FastEthernet0/11
 switchport access vlan 20
 switchport mode access
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan10
 no ip address
 ip helper-address 192.168.1.1
!
interface Vlan20
 no ip address
 ip helper-address 192.168.2.1
!
interface Vlan99
 ip address 192.168.99.99 255.255.255.0
!
end

我在路由器上的“显示运行”配置:

ip dhcp relay information trust-all
!
ip dhcp excluded-address 192.168.1.1
ip dhcp excluded-address 192.168.2.1
!
ip dhcp pool VLAN10
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
ip dhcp pool VLAN20
 network 192.168.2.0 255.255.255.0
 default-router 192.168.2.1
!
interface GigabitEthernet0/0.10
 encapsulation dot1Q 10
 ip address 192.168.1.1 255.255.255.0
!
interface GigabitEthernet0/0.20
 encapsulation dot1Q 20
 ip address 192.168.2.1 255.255.255.0
4个回答

这似乎是数据包跟踪器的限制。我很快在 PT 7.0 中复制了您的设置,但没有成功。

如果您将服务器放在新的交换机端口上,请将端口放在正确的 vlan 上并将该端口标记为受信任的 DHCP 即可正常工作。我想如果你用真正的套件来做这个,它会工作得很好。

如果您使用以下命令,您的问题将得到解决。

 no ip dhcp snooping information option

例如,我的配置:

sw1-f1-msh-p#show run | s snooping 
ip dhcp snooping vlan 201,706,3200-3272 
no ip dhcp snooping information option 
ip dhcp snooping trust  

在使用 DHCP snooping 时,我经常看到您需要应用以下命令来禁用 DHCP 选项 82 到 DHCP 服务器的中继才能使其实际工作。当然,除非您的 DHCP 服务器是针对选项 82 设置的,但您的情况并非如此。

no ip dhcp snooping information option

看路由器。下面的调试告诉您它是否正在接收 DHCP 请求。[来源思科]

在全局配置模式下,输入以下访问列表:

access-list 100 permit ip host 0.0.0.0 host 255.255.255.255

在 exec 模式下,输入以下调试命令:

debug ip packet detail 100

样本输出:

Router#debug ip packet detail 100
IP packet debugging is on (detailed) for access list 100
Router#
00:16:46: IP: s=0.0.0.0 (Ethernet4/0), d=255.255.255.255, len 604, rcvd 2
00:16:46: UDP src=68, dst=67
00:16:46: IP: s=0.0.0.0 (Ethernet4/0), d=255.255.255.255, len 604, rcvd 2
00:16:46: UDP src=68, dst=67