I was looking at setting up our out of band network and was wondering if I could configure DHCP on the switch and have it hand out an address to a specific port. For example I would like port gi1/0/1 to get the IP of 10.0.0.1, port gi1/0/27 to get IP 10.0.0.17. In doing some searching I found a config guide for doing exactly that. It’s called ‘DHCP Server Port-Based Address Allocation’. Here’s an example:
Global Config Commands-
ip dhcp use subscriber-id client-id ip dhcp subscriber-id interface-name ip dhcp pool PortDHCPPool network 10.0.0.0 255.255.255.0 default-router 10.0.0.254 domain-name packetpros.network lease 8 address 10.0.0.9 client-id "Gi1/0/9" ascii address 10.10.0.10 client-id "Gi1/0/10" ascii
Under each interface you need to add-
ip dhcp server use subscriber-id client-id
You can verify by running the following command-
Switch#sho ip dhcp pool PortDHCPPool Pool PortDHCPPool : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 0 Excluded addresses : 2 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased/Excluded/Total 10.0.0.1 10.0.0.1 - 10.0.0.254 0 / 2 / 254 2 reserved addresses are currently in the pool : Address Client 10.0.0.9 Gi1/0/9 10.0.0.10 Gi1/0/10
Here you can see I have two ports configured and each is associated with it’s matching interface. Under the DHCP server, the client id should start with either Gi or gi.