Настройка адреса интерфейса VLAN:

switch(config-if-vlan1)#ip address 192.168.1.1 255.255.255.0

Запуск службы DHCP-сервера:

switch(config)#service dhcp

Создание пула адресов:

switch#config
switch(config)#ip dhcp pool TEST
switch(dhcp-test-config)#network-address 192.168.1.0 255.255.255.0
switch(dhcp-test-config)#lease 0 0 10
switch(dhcp-test-config)#default-router 192.168.1.1
switch(dhcp-test-config)#dns-server 8.8.8.8 1.1.1.1

Настройка срока аренды (в формате Дни Часы Минуты)

switch(dhcp-test-config)#lease 0 0 10 

Либо настройка бессрочной аренды

switch(dhcp-test-config)#lease infinite

Исключение отдельного адреса из пула:

switch(config)#ip dhcp excluded-address 192.168.1.1

Исключение из пула диапазона IP адресов с 250 по 254:

switch(config)#ip dhcp excluded-address 192.168.1.250 192.168.1.254

Отключение DHCP-вещания на порту:

switch(config)#interface ethernet 1/0/10
switch(config-if-ethernet1/0/10)#ip dhcp disable

Статическая привязка физических mac-адресов к ip:
В рамках статического присвоения MAC-адресу IP-адреса необходимо создать дополнительный пул адресов. Внутри пула нужно определить аппаратный адрес - mac-адрес устройства, и хост - IP-адрес.

switch(config)#ip dhcp pool HOST1
switch(dhcp-host1-config)#hardware-address 3C-97-0E-74-66-05
switch(dhcp-host1-config)#host 192.168.1.2

Остальные настройки для данного узла будут браться из из основного пула.

Настройка дополнительных опций:

switch(dhcp-test-config)#option 43 hex 0104C0A80101

Диагностика

switch#show ip dhcp binding
Total dhcp binding items: 17, the matched: 17
IP address 		Hardware address 	Lease expiration 			Type
192.168.254.101 E4-F1-4C-39-1A-32 	Thu Dec 07 14:57:00 2022 	Dynamic

 


switch#show ip dhcp server statistics
Address pools 1
Database agents 0
Automatic bindings 1
Manual bindings 0
Conflict bindings 0
Expiried bindings 0
Malformed message 0
Message Received
BOOTREQUEST 29
DHCPDISCOVER 26
DHCPREQUEST 2
DHCPDECLINE 0
DHCPRELEASE 0
DHCPINFORM 1
Message Send
BOOTREPLY 3
DHCPOFFER 1
DHCPACK 1
DHCPNAK 1
DHCPRELAY 0
DHCPFORWARD 0

 

switch(config)#show ip dhcp conflict
IP Address Detection method Detection Time