Cisco交换机2960-x上的DHCP服务器基于端口的地址分配

我正在尝试在Cisco 2960-X交换机上configurationDHCP服务器以实现基于端口的地址分配。 我希望分配给连接到该端口的任何设备的IP地址每次都是相同的。

我已经使用以下指南来实现这一点: configurationDHCPfunction和IP Source Guard

使用的命令在这里详细解释: Cisco IOS IP寻址服务命令参考

我也尝试了以下命令的各种迭代,以find一些工作:address ip-address client-id string [ascii]

我不确定的是客户端ID后面的string。 它是否必须匹配你的接口名称? 如果没有,DHCP服务器如何知道分配的IP地址与哪个接口相关联。

这是我的跑步configuration:

otg#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Gi1/0/1, Gi1/0/3, Gi1/0/4 Gi1/0/5, Gi1/0/6, Gi1/0/7 Gi1/0/8, Gi1/0/9, Gi1/0/10 Gi1/0/11, Gi1/0/12, Gi1/0/13 Gi1/0/14, Gi1/0/15, Gi1/0/16 Gi1/0/17, Gi1/0/18, Gi1/0/19 Gi1/0/20, Gi1/0/21, Gi1/0/22 Gi1/0/23, Gi1/0/24, Gi1/0/25 Gi1/0/26, Gi1/0/27, Gi1/0/28 2 VLAN0002 active Gi1/0/2 140 VLAN0140 active 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 2 enet 100002 1500 - - - - - 0 0 VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 140 enet 100140 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 1004 fdnet 101004 1500 - - - ieee - 0 0 1005 trnet 101005 1500 - - - ibm - 0 0 Remote SPAN VLANs ------------------------------------------------------------------------------ Primary Secondary Type Ports ------- --------- ----------------- ------------------------------------------ --------------------------------------------------------------------------------------------------------------------- otg#show ip dhcp pool Pool otgpool : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 0 Excluded addresses : 1 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased/Excluded/Total 192.168.100.1 192.168.100.1 - 192.168.100.254 0 / 1 / 254 1 reserved address is currently in the pool : Address Client 192.168.100.100 Gi1/0/2 --------------------------------------------------------------------------------------------------------------------- otg#sh run Building configuration... Current configuration : 4058 bytes ! ! Last configuration change at 06:04:30 UTC Tue Jan 5 2016 ! NVRAM config last updated at 23:29:56 UTC Mon Jan 4 2016 ! version 15.0 no service pad service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname otg ! boot-start-marker boot-end-marker ! enable secret 5 $1$43Kk$SyzqQc5biarBjD2TD9Hw0/ enable password otgswitch ! no aaa new-model clock timezone UTC -5 0 clock summer-time UTC recurring switch 1 provision ws-c2960x-24ts-l ip dhcp use subscriber-id client-id ip dhcp subscriber-id interface-name ! ip dhcp pool otgpool network 192.168.100.0 255.255.255.0 default-router 192.168.100.1 reserved-only address 192.168.100.100 client-id "Gi1/0/2" ascii ! ! ! ! crypto pki trustpoint TP-self-signed-1160303744 enrollment selfsigned subject-name cn=IOS-Self-Signed-Certificate-1160303744 revocation-check none rsakeypair TP-self-signed-1160303744 ! ! crypto pki certificate chain TP-self-signed-1160303744 certificate self-signed 01 3082022B 30820194 A0030201 02020101 300D0609 2A864886 F70D0101 05050030 31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274 69666963 6174652D 31313630 33303337 3434301E 170D3136 30313035 30343239 35365A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649 4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D31 31363033 30333734 3430819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281 810081CE C80CB939 C1722AA5 E3167E22 23DE4A5F EBB8168C 0DEF4392 F4624590 11282956 58E0A473 806BBC5E 65E228F4 8FF553ED B1A07A46 CBBC80BA 22C16838 11EEFA3B 9CD7290D D79CAEDC 4F259F57 8F30CC84 6125CD18 90917913 ECE9B8BA DE9F2BDC 21F62BCC 424D5D19 8FEEE8F5 E5A86568 DAF3EE8A 4CD5BE74 63E14AED C9BB0203 010001A3 53305130 0F060355 1D130101 FF040530 030101FF 301F0603 551D2304 18301680 14E50E89 9DFB34B0 F88C367D D1DFE392 1849468B BC301D06 03551D0E 04160414 E50E899D FB34B0F8 8C367DD1 DFE39218 49468BBC 300D0609 2A864886 F70D0101 05050003 81810077 5FCAF4BC 7ABCDE2E 69FFB95E 1BBE6CE6 584B0392 998CD1FB 226E9767 F400304B 36C1692F 54B4CF09 F461AE69 097E47F3 64D8EB80 4CDB1E87 0FD375A7 DF45B8B0 72B6630E 5D29A00A 1679F321 CBED7B18 370AC2D0 D8DD2DA5 AF7FECFD 44DE20D0 6D991B2F BFDA7E64 791ACC01 22031B34 7C1FB7EC C2EAD9DC 45CB4261 00795F quit spanning-tree mode pvst spanning-tree extend system-id ! ! ! ! ! ! vlan internal allocation policy ascending ! ! ! ! ! ! interface FastEthernet0 no ip address ! interface GigabitEthernet1/0/1 ! interface GigabitEthernet1/0/2 description cart2 switchport access vlan 2 switchport mode access switchport port-security maximum 2 switchport port-security ip dhcp server use subscriber-id client-id storm-control broadcast level 10.00 storm-control multicast level 10.00 spanning-tree portfast spanning-tree bpduguard enable ! interface GigabitEthernet1/0/3 ! interface GigabitEthernet1/0/4 ! interface GigabitEthernet1/0/5 ! interface GigabitEthernet1/0/6 ! interface GigabitEthernet1/0/7 ! interface GigabitEthernet1/0/8 ! interface GigabitEthernet1/0/9 ! interface GigabitEthernet1/0/10 ! interface GigabitEthernet1/0/11 ! interface GigabitEthernet1/0/12 ! interface GigabitEthernet1/0/13 ! interface GigabitEthernet1/0/14 ! interface GigabitEthernet1/0/15 ! interface GigabitEthernet1/0/16 ! interface GigabitEthernet1/0/17 ! interface GigabitEthernet1/0/18 ! interface GigabitEthernet1/0/19 ! interface GigabitEthernet1/0/20 ! interface GigabitEthernet1/0/21 ! interface GigabitEthernet1/0/22 ! interface GigabitEthernet1/0/23 ! interface GigabitEthernet1/0/24 ! interface GigabitEthernet1/0/25 ! interface GigabitEthernet1/0/26 ! interface GigabitEthernet1/0/27 ! interface GigabitEthernet1/0/28 ! interface Vlan1 ip address 192.168.200.245 255.255.255.0 ! interface Vlan2 ip address 192.168.100.254 255.255.255.0 no ip route-cache ! ip default-gateway 192.168.100.1 ip http server ip http secure-server ! ! ! banner motd ^Cto # Welco^C ! line con 0 line vty 0 4 password otgswitch login line vty 5 15 login ! end 

请告诉我可能做错了什么。 将不胜感激您的帮助。

由于dhcp绑定表中的信息丢失,我遇到了问题。 简而言之,自动生成的订阅者ID与我的预订不符。 这里有些例子:

 port# interface received SID(hex) expected SID(hex) 2 Gi1/0/2 0047-6931-2f30-2f 0047-6931-2f30-2f32 13 Gi1/0/13 0047-6931-2f30-2f31 0047-6931-2f30-2f31-33 24 Gi1/0/24 0047-6931-2f30-2f32 0047-6931-2f30-2f32-34 

我在15.0版本中遇到了IOS错误。 我更新我的IOS到15.2和问题解决!