在 Cisco DHCP 服务器上为客户端保留 IP

网络工程 思科 dhcp 顺式催化剂 cisco-ios-12
2022-02-13 11:25:48

所以我想我知道如何在我的 3550 交换机上设置我的 DHCP 服务器并为客户端保留 IP。

我进入了需要保留 IP 的池,但我没有像过去在 IOS 上那样使用地址命令作为选项来执行此操作。

xxx3550#sh version 
Cisco IOS Software, C3550 Software (C3550-IPSERVICES-M), Version 12.2(35)SE5, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Thu 19-Jul-07 21:08 by nachen
Image text-base: 0x00003000, data-base: 0x00D45C28
ROM: Bootstrap program is C3550 boot loader
xxx3550 uptime is 1 year, 30 weeks, 6 days, 2 hours, 3 minutes
System returned to ROM by power-on
System restarted at 07:35:09 EDT Thu Oct 22 2015
System image file is "flash:c3550-ipservices-mz.122-35.SE5/c3550-ipservices-mz.122-35.SE5.bin"
Cisco WS-C3550-24-PWR (PowerPC) processor (revision L0) with 65526K/8192K bytes of memory.
Processor board ID CAT0937R3D4
Last reset from warm-reset
Running Layer2/3 Switching Image

这是 DHCP 池配置

ip dhcp pool data
   network 192.168.5.0 255.255.255.0
   default-router 192.168.5.1 
   dns-server xxx.xxx.xxx.x xxx.xxx.xxx.x 
   lease 8

当我进入 dhcp 池配置时,我确实有以下可用:

xxx3550(config)#ip dhcp pool data 
xxx3550(dhcp-config)#?
DHCP pool configuration commands:
  bootfile             Boot file name
  client-identifier    Client identifier
  client-name          Client name
  default-router       Default routers
  dns-server           DNS servers
  domain-name          Domain name
  exit                 Exit from DHCP pool configuration mode
  hardware-address     Client hardware address
  host                 Client IP address and mask
  import               Programatically importing DHCP option parameters
  lease                Address lease time
  netbios-name-server  NetBIOS (WINS) name servers
  netbios-node-type    NetBIOS node type
  network              Network number and mask
  next-server          Next server in boot process
  no                   Negate a command or set its defaults
  option               Raw DHCP options
xxx3550(dhcp-config)#

我只需要为特定的 MAC 地址保留一个 IP 地址。我通常会 Address xxx.xxx.xxx.xx Hardware-Address AABB.CC00.11FF

2个回答

您必须使用client-identifier您的客户端 ID 创建另一个池,通常默认为带有 01(以太网客户端)的 MAC,或者hardware-address您的 MAC,如下所示:

ip dhcp pool my-host
    host 10.0.0.1 255.255.255.0
    client-identifier 01AA.BBCC.0011.FF

如果您更喜欢手动配置,请查看:

ip dhcp excluded-address <first IP> <last IP>

有一种解决方案可以避免多次手动绑定。

这是有关 DHCP 源和数据库文件的 Cisco 文档的链接:

http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr_dhcp/configuration/15-mt/dhcp-15-mt-book/config-dhcp-server.html

本质上,您需要一个 tftp/ftp 服务器,将来自 DHCP 服务器的租约记录在 Cisco 设备上的数据库文件(文本文件)中,并读取您创建所需的所有手动绑定的原始文件(也是文本文件)。

在 Cisco DHCP 服务器意外重启的情况下,我将其用作灾难恢复工具:

  • 绑定数据库使网络免受 DHCP 风暴和随后的针对 DHCP 服务器的拒绝服务(在没有绑定数据库的情况下自行施加)。
  • 原始文件允许我的静态绑定存在并且可以通过编程方式进行编辑,因为它只是一个文本文件。

上面的链接包含示例和进一步阅读链接。对于较旧的 IOS 版本(至少回到 12.4),您可以参考类似的在线资源。