Cisco IOS 静态 DHCP 池的客户端超时

网络工程 思科 ipv4 思科-ios dhcp MAC地址
2021-07-11 06:17:15

我不是网络管理员,但我的网络有一台旧的 Cisco Catalyst 3560。我已经成功设置了 DHCP 池:

ip dhcp pool 192.168.0.0
 network 192.168.0.0 255.255.255.0
 default-router 192.168.0.254
 dns-server 203.0.178.191 203.215.29.191

我的电脑可以愉快地连接并获得 IP 地址。但是我的步骤是我想在同一个子网中分配一些静态 IP 地址。这是我的开始:

ip dhcp pool Static
 host 192.168.0.11 255.255.255.0
 hardware-address xxxx.xxxx.xxxx
 default-router 192.168.0.254
 dns-server 203.0.178.191 203.215.29.191

但是,当我在 MAC 地址为 xxxx.xxxx.xxxx 的 PC 上尝试 ipconfig /renew 时,我得到以下信息:

An error occurred while renewing interface Ethernet : unable to contact your DHCP server. Request has timed out.

我觉得我可能错过了一些简单的东西。它肯定似乎正在识别 MAC 地址,因为行为与配置的静态池不同,谁能帮我弄清楚为什么 DHCP 超时?任何帮助将非常感激!

编辑:

完整配置(为了可读性/安全性略有截断):

Current configuration : 3839 bytes
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Switch
!
boot-start-marker
boot-end-marker
!
enable secret 5 xxxx
!
!
!
no aaa new-model
clock timezone UTC 10
clock summer-time UTC recurring last Sun Oct 2:00 last Sun Mar 3:00
system mtu routing 1500
ip name-server 203.0.178.191
ip name-server 203.215.29.191
!
ip dhcp pool 192.168.0.0
   network 192.168.0.0 255.255.255.0
   default-router 192.168.0.254
   dns-server 203.0.178.191 203.215.29.191
!
ip dhcp pool Static1
   host 192.168.0.1 255.255.255.0
   hardware-address aaaa.bbbb.cccc
   default-router 192.168.0.254
   dns-server 203.0.178.191 203.215.29.191
!
ip dhcp pool Static2
   host 192.168.0.11 255.255.255.0
   hardware-address dddd.eeee.ffff
   default-router 192.168.0.254
   dns-server 203.0.178.191 203.215.29.191
!
!
!
!
crypto pki trustpoint TP-self-signed-<snip>
!
!
crypto pki certificate chain TP-self-signed-<snip>
  quit
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
interface GigabitEthernet0/1
!
<snip>
!
interface GigabitEthernet0/28
!
interface Vlan1
 ip address 192.168.0.253 255.255.255.0
!
ip default-gateway 192.168.0.254
ip classless
ip http server
ip http secure-server
!
!
vstack
!
line con 0
line vty 0 4
 password xxxx
 login
line vty 5 15
 password xxxx
 login
!
end
2个回答

看起来您的 DHCP 保留配置不正确。似乎您只有硬件地址(用于 BOOTP)缺少网络类型,而不是客户端标识符(用于 DHCP)。您可能希望将01(以太网)添加到客户端标识符 MAC 地址。就像是:

ip dhcp pool Static
 host 192.168.0.11 255.255.255.0
 client-identifier 01xx.xxxx.xxxx.xx
 default-router 192.168.0.254
 dns-server 203.0.178.191 203.215.29.191

这在Cisco IOS IP 配置指南,版本 12.2 中进行了解释

指定 DHCP 客户端的唯一标识符。此命令用于 DHCP 请求。

  • DHCP 客户端需要客户端标识符。客户端的唯一标识用点分十六进制表示,例如01b7.0813.8811.66,其中01代表以太网媒体类型。
  • 有关如何确定 DHCP 客户端的客户端标识符的信息,请参阅下面的故障排除技巧”。

... 对另一个完全正确的答案的补充。

你怎么知道是使用硬件地址还是客户端标识符?

它取决于它使用的客户端,并且可能并不总是可以从文档中确定它。这对于调试 DHCP 能够查看 Cisco DHCP 服务器实际接收的内容非常有用。

在 Cisco 命令提示符下:

debug ip dhcp server packet detail
term mon

然后,您将看到调试,其中包括:

DHCPD: DHCPDISCOVER received from client 0158.0a20.87d2.28 on interface Vlan1.
DHCPD: Sending DHCPOFFER to client 0158.0a20.87d2.28 (192.168.0.128).

您将看到此客户端使用标识符 (begins 01) 来标识自己这个特定的例子是 Cisco VOIP 电话被分配了一个静态地址:

ip dhcp pool phone2
 host 192.168.0.128 255.255.255.0
 client-identifier 0158.0a20.87d2.28

如果 LAN 上有方便的主机,也可以使用数据包嗅探器(例如 wireshare/tshark/tcpdump)来查看 DISCOVER 消息。