Windows server setup dhcp server

Данная статья описывает процедуру установки и настройки DHCP сервера на базе Windows Server 2019. В статье описаны особенности установки и настройки DHCP роли, создания областей DHCP, настройки их параметров и резервации статических адресов. Мы рассмотрим как привычный способ настройки параметров DHCP сервера через графическую консоль, так и настройку DHCP из командной строки PowerShell.

Протокол DHCP (Dynamic Host Configuration Protocol) используется для автоматического назначения сетевых настроек (IP адрес, маска подсети, шлюз, DNS сервера и т.д.) устройствам в вашей сети (компьютеры, ноутбуки, сканеры, принтеры и т.д.). Также DHCP сервер позволяет более эффективно использовать адресное пространство, избегать конфликта IP адресов в сети и централизованно управлять сетевыми параметрами на клиентских устройствах.

Содержание:

  • Установка роли DHCP сервера в Windows Server 2019/2016
  • Настройка DHCP областей в Windows Server
  • Резервация IP адресов на DHCP сервере
  • Настройка и управление DHCP сервером с помощью PowerShell

Установка роли DHCP сервера в Windows Server 2019/2016

В этом примере мы установим DHCP сервер на хосте с Windows Server 2019 и IP адресом 192.168.13.4. Вы можете использовать как Server Core версию, так и Full GUI. В маленькой инфраструктуре допустимо устанавливать DHCP сервер на сервер с ролью контроллера домена Active Directory.

Обязательно назначьте статический IP адрес серверу с ролью DHCP сервер. При установке роли DHCP из консоли PowerShell на сервере с автоматическим получением IP адреса появляется предупреждение:

Configure at least one static IP address on your computer before installing DHCP.
WARNING: The following recommended condition is not met for DHCP: No static IP addresses were found on this computer. If the IP address changes, clients might not be able to contact this server. Please configure a static IP address before installing DHCP Server.

Установить роль DHCP Server можно из консоли Server Manager (Add Roles and Features -> Server Roles).

установка роли DHCP server в windows server 2019

После установки роли DHCP роли нужно выполнить Post-Deployment Configuration. Для этого в консоли Server Manager щелкните по уведомлению и выберите Complete DHCP configuration.

выберите Complete DHCP configuration

Вам будет предложено аутентифицировать новый DHCP сервер в Active Directory (экран Authorization). Для авторизации DHCP сервера в AD учетная запись должна состоять в доменной группе Enterprise Admins.

Если у вас нет прав на авторизацию DHCP в AD, вы можете указать, чтобы ваш DHCP сервер запускался без проверки авторизации в домене:

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters" -Name DisableRogueDetection -Value 1 -Force

авторизовать сервер DHCP в Active Directory

Также вы можете установить и настроить DHCP роль в Windows Server из консоли PowerShell.

Установка роли DHCP:

Install-WindowsFeature DHCP –IncludeManagementTools

Проверьте, что роль и инструменты управления RSAT-DHCP установлены:

Get-WindowsFeature -Name *DHCP*| Where Installed

установка DHCP сервера с помощью powershell

Авторизуйте DHCP сервер в Active Directory (укажите DNS имя сервера и IP адрес, который будет использоваться DHCP клиентами):

Add-DhcpServerInDC -DnsName hq-dc01.contoso.com -IPAddress 192.168.13.4

Создайте локальные группы безопасности DHCP сервера:

Add-DhcpServerSecurityGroup

Чтобы Server Manager перестал показывать уведомление о том, что DHCP роль требует настройки, выполните команду:

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\ServerManager\Roles\12 -Name ConfigurationState -Value 2

Перезапустите службу DHCPServer:

Restart-Service -Name DHCPServer -Force

База данных и логи DHCP сервера находятся в каталоге
%systemroot%\system32\dhcp
.

  • dhcp.mdb — файл базы данных сервера DHCP’;
  • j50.log – транзакционный журнал (используется при восстановлении конфигурации DHCP);
  • j50.chk — файл контрольной точки;
  • tmp.edb — временный рабочий файл DHCP-сервера.

Настройка DHCP областей в Windows Server

После установки роли DHCP вам нужно создать DHCP области (Scopes), которые описывают диапазоны IP адресов и другие настройки, выдающиеся сервером клиентам.

Для управления сервером DHCP используется консоль dhcpmgmt.msc (вы можете управлять DHCP сервером локально или с удаленного компьютера с установленным RSAT). Запустите консоль DHCP, разверните ваш сервер -> IPv4.

Чтобы создать новую область выберите New Scope.

создать новую dhcp область

Укажите название DHCP области.

название DHCP области

Укажите диапазон IP адресов, который будет выдаваться этой областью и маску сети. В этом примере я хочу использовать эту DHCP область для обслуживания подсети 192.168.100.0/24. В рамках этой сети DHCP сервером будет назначаться динамические IP адреса из диапазона 192.168.100.50 — 192.168.100.250. В следующем окне можно добавить исключения в этот диапазон (Add Exclusions and Delay).

диапазон IP адресов области DHCP

Далее нужно указать длительность аренды (Lease Duration) IP адреса DHCP клиентом (по умолчанию 8 дней, менять без особой необходимости не нужно).

срока аренды адреса на dhcp

Укажите, что вы хотите настроить дополнительный параметры DHCP области.

настроить опции dhcp области

.

Укажите IP адрес шлюза в подсети, который должен назначаться клиентам (в нашем примере это 192.168.100.1).

задать адрес шлюза по-умолчанию для dhcp области

Затем укажите имя домена и адреса DNS серверов, которые будут назначены клиентам DHCP.

настройки DNS для DHCP области

Осталось активировать DHCP область (разрешить ей обслуживать клиентов).

активировать DHCP зону

DHCP сервер может выдавать клиентам различный настройки (кроме IP адреса). Для этого используются Scope Options.

В Windows Server DHCP можно настроить глобальные настройки области или Scope Options для каждой области.

опции DHCP scope

Ранее мы уже настроили три опции области:

  • 003 Router
  • 006 DNS Server
  • 015 DNS Domain Name

Можно добавить и другие опции (NTP сервера, PXE и т.д.).

В разделе Server Options DHCP сервера можно настроить глобальные опции, которые будут наследуются всеми областями. Но вы можете переопределить глобальные настройки в настройках каждой области (опции области имеют приоритет над опциями сервера).

настроить параметры DHCP сервера

Один DHCP сервер может обслуживать сотни удаленных подсетей и VLAN. Поэтому вы можете создать на нем несколько областей. Главное, чтобы в каждой из подсетей был настроен ретранслятор (DHCP relay agent), который пересылает широковещательные DHCP-запросы на указанный DHCP сервер. В терминах Cisco DHCP ретранслятор называется ip helper. Вы можете настроить DHCP Relay даже на Windows Server.

Протокол DHCP в качестве транспорта использует протокол UDP. Пакеты от клиента к серверу передаются по порту 67 UDP, обратно через UDP 68

Резервация IP адресов на DHCP сервере

По умолчанию DCHP сервер выдает клиентам динамические адреса. Это означает что IP адрес у любого клиента может меняться. Если вы хотите, чтобы определенные устройства всегда получали от DHCP сервера один и тот же адрес, вы можете его зарезервировать (например, для сетевых принтеров, которые настроены у пользователей).

Для DHCP резервации выберите область и перейдите в секции Reservation. В меню выберите New Reservation.

При создании резервации нужно указать IP адрес, который нужно сохранить за клиентом и его MAC адрес (уникальное значение). MAC адрес в Windows можно получить из результатов команды
ipconfig /all
или с помощью PowerShell
get-netadapter|select name,macaddress
). Опционально можно указать имя и описание устройства.

Укажите MAC адрес устройства для резервации IP адреса на DHCP

Также вы можете зарезервировать текущий динамический адрес за устройством, найдя его в разделе Address Leases. Щелкните по устройству и выберите Add to Reservation.

Add to Reservation

Настройка и управление DHCP сервером с помощью PowerShell

Все операции по настройке и управлению DHCP сервером на Windows Server 2019/2016 можно выполнять из консоли PowerShell. Рассмотрим основные команды управления DHCP. Для этого используется модуль DHCPServer. Импортируйте модуль в сессию:

Import-Module DHCPServer

Вывести полный список командлетов в моделе DHCP можно так:

Get-Command -Module DHCPServer

PowerShell модуль DHCPServer

Следующая команда выведет список авторизованных DHCP серверов в Active Directory:

Get-DhcpServerInDC

Вывести список DHCP областей на указанном сервере:

Get-DhcpServerv4Scope –ComputerName msk-dhcp1

Если нужно показать все параметры области (Delay, Description, Name и т.д.):

Get-DhcpServerv4Scope –ComputerName msk-dhcp1| FL *

Список областей на DHCP сервере

Если нужно отобразить данные о IPv6 областях:

Get-DHCPServerv6Scope

Получить настройки для конкретной области:

Get-DhcpServerv4Scope –ComputerName msk-dhcp1 –ScopeID 10.10.1.0

Создадим новую (неактивную) область с диапазоном адресов с 192.168.113.50 до 192.168.113.250:

Add-DhcpServerv4Scope -Name “Brahch1 192.168.113.0” -StartRange 192.168.113.50 -EndRange 192.168.113.250 -SubnetMask 255.255.255.0 -State InActive

Настроить следующие параметры DHCP сервера: DNS сервер, домен и адрес шлюза по-умолчанию:

Set-DhcpServerv4OptionValue -ScopeID 192.168.113.0 -DnsDomain contoso.com -DnsServer 192.168.13.4 -Router 192.168.113.1

Добавить исключения в DHCP область:

Add-DhcpServerv4ExclusionRange -ScopeID 192.168.113.0 -StartRange 192.168.113.90 -EndRange 192.168.113.100

Активировать DHCP область:

Set-DhcpServerv4Scope -ScopeID 192.168.113.0 -State Active

Add-DhcpServerv4Scope - создать и настроить области на DHCP сервере командами PowerShell

Для удобства можно использовать такую команду PowerShell при создании новой области:

$HashArgs = @{
'Name' = 'EKB Office Scope';
'Description' = 'workstations';
'StartRange' = '192.168.140.10';
'EndRange' = '192.168.140.200';
'SubnetMask' = '255.255.255.0';
'State' = 'Active';
'LeaseDuration' = '1.00:00:00';
}
Add-DhcpServerv4Scope @HashArgs

Опции для DHCP сервера добавляется так (к примеру, WPAD):

Add-DhcpServerv4OptionDefinition -ComputerName msk-dhcp1 -Name WPAD -OptionId 252 -Type String

Вывести список настроенных опций DHCP сервера можно так:

Get-DHCPServerv4OptionValue -ComputerName msk-dhcp1 | Format-List

Выведем список настроенных параметров зоны:

Get-DHCPServerv4OptionValue -ComputerName msk-dhcp1 -ScopeId 10.10.1.0 | Format-List

Показать текущий список арендованных адресов для области 10.10.1.0:

Get-DHCPServerv4Lease -ScopeId 10.10.1.0 -ComputerName msk-dhcp1

Список аренд на DHCP сервере

Создать DHCP резервацию для клиента, которому назначен динамический IP адрес 10.10.1.88 (конвертировать выданный адрес в зарезервированный):

Get-DhcpServerv4Lease -ComputerName msk-dhcp1 -IPAddress 10.10.1.88| Add-DhcpServerv4Reservation -ComputerName msk-dhcp1

Можно массово зарезервировать IP адреса для компьютеров по списку из csv файла. Для этого создайте текстовый файл в формате:

ScopeId,IPAddress,Name,ClientId,Description
10.10.1.0,10.10.1.88,Client1,ba-ab-5c-3d-4e-6f,Reservation PC-msk-s1
10.10.1.0,10.10.1.89,Client2,ba-ab-5c-5d-2e-3f,Reservation PC-msk-s2

Сохраните файл с именем
c:\dhcp\DHCPReservations.csv
и запустите следующую команду, которая импортирует данные из csv файла и создаст DHCP резервации для клиентов:

Import-Csv –Path c:\dhcp\DHCPReservations.csv | Add-DhcpServerv4Reservation -ComputerName msk-dhcp1

Отключить область на DHCP сервере:

Set-DhcpServerv4Scope -ComputerName msk-dhcp1-ScopeId 10.10.1.0-State InActive

Удалить область с DHCP сервера:

Remove-DHCPServerv4Scope -ComputerName msk-dhcp1-ScopeId 10.10.1.0 -Force

Возможно получить статистику DHCP сервера (количество областей, резерваций, процент использования адресов и пр.).

Get-DhcpServerv4Statistics -ComputerName msk-dhcp1

Статистика использования DHCP сервера

Аналогичная информация для конкретной области может быть получена с помощью командлета Get-DhcpServerv4ScopeStatistics.

Конфигурацию DHCP сервера можно экспортировать в указанный XML файл с помощью команды:

Export-DHCPServer -ComputerName msk-dhcp1 -File C:\dhcp\dhcp-export.xml

Совет. Заданием с такой командой в планировщике задач можно реализовать регулярное резервное копирование конфигурации DHCP сервера.

В дальнейшем эти настройки DHCP сервера можно импортировать (перенести) на другой DHCP сервер:

Import-DHCPServer -ComputerName msk-dhcp2 -File C:\dhcp\dhcp-export.xml -BackupPath C:\dhcpbackup\

В этой статье рассмотрим полный процесс установки и настройки DHCP сервера на Windows Server 2019. Мы подробно опишем процесс установки роли DHCP, создание и настройку областей, а также резервирование статических IP-адресов. Покажем настройку DHCP через графическую консоль и PowerShell. Протокол DHCP (Dynamic Host Configuration Protocol) используется для автоматического назначения сетевых параметров, таких как IP-адреса, маска подсети, шлюз и DNS сервера. DHCP помогает централизованно управлять настройками сетевых устройств и избегать конфликта IP-адресов в сети.

Данная инструкция подойдет для Windows Server 2012 R2, Windows Server 2016, Windows Server 2019 и Windows Server 2022.

Приобрести Windows Server можно у нас в магазине от 1190 ₽.

Скачать оригинальные дистрибутивы Windows Server можно в нашем каталоге.

Установка роли DHCP сервера

Для начала, установим роль DHCP на сервере Windows Server 2019. В данном примере сервер будет иметь статический IP-адрес 192.168.13.4. Важно использовать статический IP для сервера с ролью DHCP, чтобы избежать проблем при выдаче адресов клиентам.

Процесс установки можно выполнить как через графическую консоль, так и через PowerShell. Важно, чтобы сервер имел статический IP-адрес перед установкой роли DHCP, иначе появится предупреждение:

WARNING: The following recommended condition is not met for DHCP: No static IP addresses were found on this computer.

1. Откройте консоль Server Manager, перейдите в раздел Add Roles and Features, выберите DHCP Server в списке ролей.

2. После завершения установки выполните Post-Deployment Configuration — щелкните по уведомлению и выберите Complete DHCP configuration.

3. На экране авторизации необходимо предоставить права учетной записи для авторизации сервера в Active Directory.

Если у вас нет прав на авторизацию DHCP в AD, вы можете указать, чтобы ваш DHCP сервер запускался без проверки авторизации в домене:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\DHCPServer\Parameters" -Name DisableRogueDetection -Value 1 -Force

4. Установка роли через PowerShell выполняется командой:

Install-WindowsFeature DHCP –IncludeManagementTools

5. Чтобы убедиться, что роль установлена корректно, используйте:

Get-WindowsFeature -Name *DHCP* | Where Installed

6. Авторизуйте DHCP сервер в Active Directory (укажите DNS имя сервера и IP адрес, который будет использоваться DHCP клиентами):

Add-DhcpServerInDC -DnsName hq-dc01.contoso.com -IPAddress 192.168.13.4

7. Создайте локальные групп безопасности DHCP:

Add-DhcpServerSecurityGroup

8. После этого можно завершить настройку роли, выполнив команду:

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\ServerManager\Roles\12 -Name ConfigurationState -Value 2

9. Перезапустите службу DHCP:

Restart-Service -Name DHCPServer -Force

База данных и логи DHCP сервера по умолчанию находятся в каталоге %systemroot%\system32\dhcp. Важные файлы:

dhcp.mdb — файл базы данных DHCP;

j50.log — транзакционный журнал;

j50.chk — файл контрольной точки;

tmp.edb — временный рабочий файл.

Создание и настройка DHCP областей

После установки роли DHCP необходимо создать одну или несколько областей (Scopes). Область определяет диапазон IP-адресов, которые сервер будет выдавать клиентам, а также другие сетевые настройки.

1. Откройте консоль dhcpmgmt.msc, разверните сервер и выберите IPv4.

2. Щелкните правой кнопкой мыши и выберите New Scope.

3. Укажите название области, например в нашем случае это CetralOffice.

4. Установите диапазон IP-адресов. Например, для сети 192.168.100.0/24 можно указать диапазон 192.168.100.50 — 192.168.100.250.

5. Установите параметры исключений, если необходимо. Например, исключите диапазон 192.168.100.1 — 192.168.100.10, чтобы эти адреса не выдавались.

6. Укажите длительность аренды IP-адреса (по умолчанию 8 дней).

7. Укажите, что вы хотите настроить дополнительный параметры DHCP области.

8. Укажите IP-адрес шлюза, который должен назначаться клиентам (например, 192.168.100.1).

9. Затем укажите имя домена и адреса DNS серверов, которые будут назначены клиентам DHCP.

10. После завершения активируйте область.

DHCP сервер может выдавать различные параметры, такие как:

003 Router — шлюз;

006 DNS Server — DNS серверы;

015 DNS Domain Name — домен.

Эти параметры можно настроить как для каждой области (Scope Options), так и глобально для сервера (Server Options). Глобальные параметры будут применяться ко всем областям, но их можно переопределить для каждой области отдельно.

Резервация IP-адресов

По умолчанию DHCP сервер выдает динамические адреса, но для определенных устройств можно зарезервировать статические адреса. Это полезно для сетевых принтеров и других устройств, которым необходим постоянный IP-адрес.

1. Откройте консоль DHCP, перейдите в раздел Reservations.

2. Выберите New Reservation.

3. Укажите IP-адрес, MAC-адрес устройства и его имя.

MAC-адрес устройства можно узнать с помощью команды:

ipconfig /all

Или через PowerShell:

Get-NetAdapter | Select-Object Name, MacAddress

4. Чтобы зарезервировать текущий динамический адрес, найдите его в Address Leases и выберите Add to Reservation.

Настройка DHCP через PowerShell

Все настройки DHCP сервера можно выполнить через PowerShell с помощью модуля DHCPServer. Для начала необходимо импортировать модуль:

Import-Module DHCPServer

1. Для отображения списка доступных команд:

Get-Command -Module DHCPServer

— Следующая команда выведет список авторизованных DHCP серверов в Active Directory:

Get-DhcpServerInDC

— Вывести список DHCP областей на указанном сервере:

Get-DhcpServerv4Scope –ComputerName msk-dhcp1

— Если нужно показать все параметры области (Delay, Description, Name и т.д.):

Get-DhcpServerv4Scope –ComputerName msk-dhcp1| FL *

— Если нужно отобразить данные о IPv6 областях:

Get-DHCPServerv6Scope

— Получить настройки для конкретной области:

Get-DhcpServerv4Scope –ComputerName msk-dhcp1 –ScopeID 10.10.1.0

2. Создание новой области:

Add-DhcpServerv4Scope -Name “Branch1 192.168.113.0” -StartRange 192.168.113.50 -EndRange 192.168.113.250 -SubnetMask 255.255.255.0 -State InActive

3. Настроить следующие параметры DHCP сервера: DNS сервер, домен и адрес шлюза по-умолчанию:

Set-DhcpServerv4OptionValue -ScopeID 192.168.113.0 -DnsDomain contoso.com -DnsServer 192.168.13.4 -Router 192.168.113.1

4. Добавление исключений:

Add-DhcpServerv4ExclusionRange -ScopeID 192.168.113.0 -StartRange 192.168.113.90 -EndRange 192.168.113.100

5. Активировать область можно с помощью команды:

Set-DhcpServerv4Scope -ScopeID 192.168.113.0 -State Active

Для удобства можно использовать хеш-таблицу аргументов:


$HashArgs = @{
'Name' = 'EKB Office Scope';
'Description' = 'workstations';
'StartRange' = '192.168.140.10';
'EndRange' = '192.168.140.200';
'SubnetMask' = '255.255.255.0';
'State' = 'Active';
'LeaseDuration' = '1.00:00:00';
}
Add-DhcpServerv4Scope @HashArgs

Опции для DHCP сервера добавляется так (к примеру, WPAD):

Add-DhcpServerv4OptionDefinition -ComputerName msk-dhcp1 -Name WPAD -OptionId 252 -Type String

Вывести список настроенных опций DHCP сервера можно так:

Get-DHCPServerv4OptionValue -ComputerName msk-dhcp1 | Format-List

Выведем список настроенных параметров зоны:

Get-DHCPServerv4OptionValue -ComputerName msk-dhcp1 -ScopeId 10.10.1.0 | Format-List

Показать текущий список арендованных адресов для области 10.10.1.0:

Get-DHCPServerv4Lease -ScopeId 10.10.1.0 -ComputerName msk-dhcp1

Создать DHCP резервацию для клиента, которому назначен динамический IP адрес 10.10.1.88 (конвертировать выданный адрес в зарезервированный):

Get-DhcpServerv4Lease -ComputerName msk-dhcp1 -IPAddress 10.10.1.88| Add-DhcpServerv4Reservation -ComputerName msk-dhcp1

Можно массово зарезервировать IP адреса для компьютеров по списку из csv файла. Для этого создайте текстовый файл в формате:

ScopeId,IPAddress,Name,ClientId,Description
10.10.1.0,10.10.1.88,Client1,ba-ab-5c-3d-4e-6f,Reservation PC-msk-s1
10.10.1.0,10.10.1.89,Client2,ba-ab-5c-5d-2e-3f,Reservation PC-msk-s2

Сохраните файл с именем c:\dhcp\DHCPReservations.csv и запустите следующую команду, которая импортирует данные из csv файла и создаст DHCP резервации для клиентов:

Import-Csv –Path c:\dhcp\DHCPReservations.csv | Add-DhcpServerv4Reservation -ComputerName msk-dhcp1

Отключить область на DHCP сервере:

Set-DhcpServerv4Scope -ComputerName msk-dhcp1-ScopeId 10.10.1.0-State InActive

Удалить область с DHCP сервера:

Remove-DHCPServerv4Scope -ComputerName msk-dhcp1-ScopeId 10.10.1.0 -Force

Возможно получить статистику DHCP сервера (количество областей, резерваций, процент использования адресов и пр.):

Get-DhcpServerv4Statistics -ComputerName msk-dhcp1

Экспорт и импорт конфигурации DHCP

Для регулярного резервного копирования конфигурации DHCP в указанный XML файл, можно использовать следующую команду:

Export-DhcpServer -ComputerName msk-dhcp1 -File C:\dhcp\dhcp-export.xml

В дальнейшем эти настройки DHCP сервера можно импортировать (перенести) на другой DHCP сервер:

Import-DhcpServer -ComputerName msk-dhcp2 -File C:\dhcp\dhcp-export.xml -BackupPath C:\dhcpbackup\

Настройка DHCP сервера на Windows Server 2019 позволяет автоматизировать управление IP-адресами в сети и облегчает централизованное управление сетевыми устройствами. Мы рассмотрели как установку и настройку через графический интерфейс, так и работу с DHCP с помощью PowerShell, что позволяет более гибко управлять сервером.

DHCP is a dynamic host configuration protocol that allows automating the configuration of client network parameters, such as IP address, gateway, DNS, subnet mask. The DHCP server controls the issuance of IP addresses, prevents duplication and frees unused addresses.

Below we’ll look at how to install and configure a DHCP server on Windows Server 2016 for a single subnet.

Installation process

  • Launch Server Manager and select “Add roles and features”. Choose the first item «Role-based or feature-based installation»:

Launch Server Manager and select “Add roles and features”

  • Specify the server on which we will install the DHCP role:

Specify the server

  • Next, you need to find and select the DHCP role in the list. We agree to add the components required for the DHCP service to work properly. Since the components were added at the “Server Roles” step, we skip the “Features” step:

Select the DHCP role in the list

  • The wizard reminds you to plan your subnets, areas, and exceptions:

Plan your subnets

  • We check the installed components and click «Install»:

Check the installed components

  • After the installation is complete, you can begin the initial configuration of DHCP. We follow the link «Complete DHCP configuration»:

Begin the initial configuration of DHCP

The initial setup process takes place in two stages:

1. Create a “Security Group” to manage this DHCP server. There are two of them:

  • DHCP Administrators — group members have full rights to manage the DHCP server;
  • DHCP Users — members of the group can view server settings and a list of connected devices.

2. Authorization of a DHCP server in Active Directory (if it is joined to a domain). This setting is necessary to avoid the appearance of extraneous DHCP servers on the network. The server must be authorized for the DHCP service to start:

Authorization of a DHCP server in Active Directory

  • Enter the administrator credentials and click on the “Commit” button. If the server is not joined to the domain, then select the last item:

Enter the administrator credentials

  • If everything is done correctly, the wizard notifies that the configuration was successful:

The wizard notifies that the configuration was successful

Setup process

Launch the «Server Manager». We find the DHCP item in the «Tools» drop-down list:

Launch the "Server Manager"

In our version, we are considering issuing IPv4 addresses, so we need to create a new area (Scope) — a pool of IP addresses issued to clients. Right-click on IPv4 and select “New Scope …”:

Create a new area (Scope)

The Create Area Wizard opens, where we enter the name of the pool. If necessary, you can enter a description:

The Create Area Wizard

We determine the boundaries of our pool by setting the start and end IP addresses. Also, enter the subnet mask:

Enter the subnet mask

If necessary, you can add one or more IP addresses from the created pool to the exceptions. This range may include network devices that are already assigned a static IP. There is also a parameter for delaying the response of the server before sending data to the request from the host:

Add one or more IP addresses from the created pool to the exceptions

Next, you can specify the lease time of the IP address. The default is 8 days:

Specify the lease time of the IP address

Now the Wizard will offer to specify the network parameters (Gateway, DNS, WINS) issued to clients on the network:

The Wizard will offer to specify the network parameters

Specify the address of the network gateway:

Specify the address of the network gateway

Next, enter the domain name and DNS server. DNS can be found either by server name or by specifying an IP address:

Enter the domain name and DNS server

The next step allows to add a WINS server:

The next step allows to add a WINS server

Select «Activate» the area we specified now:

Select "Activate" the area we specified now

After setting up the pool, you can check if the server is working. You can see connected clients by going to the Address Leases section. In our case, we see that one device is connected:

See connected clients by going to the Address Leases section

If we go to the client machine, we can check the correctness of the received settings:

Check the correctness of the received settings

Although we considered the configuration on Windows Server 2016, this instruction is also suitable for Windows Server 2008-2012, since the process is not much different.

Аverage rating : 3.9

Rated by: 7

1101
CT Amsterdam
The Netherlands, Herikerbergweg 292

+31 20 262-58-98

700
300

ITGLOBAL.COM NL

1101
CT Amsterdam
The Netherlands, Herikerbergweg 292

+31 20 262-58-98

700
300

ITGLOBAL.COM NL

700
300

Install and Configure DHCP Server on Windows Server is essential for managing network IP addresses. Well, DHCP allows administrators to automatically assign IP addresses to clients on the network, reducing the amount of manual configuration required. This service helps ensure that clients communicate with each other and access network resources.

Well, installing and configuring a DHCP server in Windows Server is a straightforward process that involves adding the DHCP server role, configuring basic DHCP settings, and creating and managing DHCP scopes.

Install and Configure DHCP on Windows Server

Install and Configure DHCP Server on Windows Server

Overview of the Dynamic Host Configuration Protocol

First of all, a DHCP server is a server that automatically assigns IP addresses to computers and other devices on the network. Without a DHCP server, we need to manually configure each device on the network with an IP address.

Why is a DHCP Server Needed?

Every device on the network needs an IP address to access network resources such as the internet, applications and even making phone calls. A DHCP server automates and manages this process from a centralized server. For example, mobile devices moving from one office to another may require a new IP address.

Hence, DHCP handles this automatically, by providing a new IP address when the device moves to another location. Without a DHCP server, there would be an overwhelming amount of manual configuration assigning IP addresses to devices on the network. A DHCP server is a huge time saver.

Prerequisites

If we intend to proceed step by step, we require the following:

  • A Windows Server inside of a Active Directory domain.
  • An Active Directory account that belongs to the DHCP Administrators group or something similar.

Installing the DHCP Server Role

This article uses the Windows Server 2012R2 build process. However, the steps should be similar for later server versions like 2016, 2019, and 2022.

Step 1: Click on Start, then click the Server Manager.

Click the start button then click the Server Manager

Step 2: Click Add roles and features on the server manager dashboard. This step starts the add roles and features wizard.

Add roles and features

Click Next on the Before you begin page.

Click next on the before we begin page

Step 3: Select the option and click Next.

Install and Configure DHCP Server on Windows Server Select Role-based or feature-based installation

Step 4: Choose the server we want the DHCP service installed on this page. In this example, we will select the local server.

Select the destination server

Step 5: We want to select the DHCP server roles on this page and click Next.

When we select the role, we get a pop up asking to add features required for the DHCP server. Click Add Features.

Select server roles

Go back to the Select server roles page, and click Next.

Back on the Select server roles page, click next.

Step 6: On the features screen, click Next. On the DHCP server, click Next.

On the confirmation page, we select to restart the server if required automatically.

Install and Configure DHCP Server on Windows Server Confirmation Screen

Finally, click the Install button, and the installation will start. We get an install progress page that says install succeeded when complete.

DHCP Installation Page

That completes the installation of the DHCP role on a Windows Server. Let us move on to the next section for the steps on configuring the DCHP server.

Improve your Active Directory Security & Azure AD by InfraSOS

Try us out for Free, Access to all features. – 200+ AD Report templates Available. Easily customise your own AD reports.

Configuring the DHCP Server

If we followed the steps above, we should now have the DHCP service installed. However, we can only use the DHCP service partially, as we need to configure it post-installation.

Step 1: We see a yellow notification in the server manager dashboard at the top left. Click on it. Now click on Complete DHCP configuration.

Post Installation DHCP Server

Step 2: On the description screen, click Next. On the authorization page, use AD credentials if we joined the server to the domain.

Choose Skip AD authorization, if the DHCP server is standalone and not joined to the domain. Click Commit.

Install and Configure DHCP Server on Windows Server. AD authorization in dhcp

We see a summary page of the configuration steps. Click Close.

Summary of Configuration Steps

Now we open the DHCP management console to configure DHCP scopes and other options. Click Start > Windows Administrative Tool > DHCP to access the DHCP management console.

DHCP Management Console interface

In the following section, we configure DHCP scopes to ensure clients obtain and connect to the DHCP server.

Configuring DHCP Scopes

A DHCP scope represents and contains several components, including:

  • IP addresses that the DHCP server assigns to a specific group of devices (address pools)
  • DNS server and default gateway for a client.
  • We should only assign IP addresses to particular devices (DHCP reservations).
  • Pools of addresses (groups of assignable IP addresses).

The DHCP scope is a critical network element that allows us to configure network settings that all clients share on the network.

Creating a DHCP Scope via Server Manager

Assume we’re on a test DHCP server’s Windows desktop:

1. To open the DHCP Microsoft Management Console, go to our Start menu and type dhcpmgmt.msc (MMC).
2. Once the DHCP MMC is open, select IPV4 from the dropdown menu to the left of the server name. Microsoft DHCP Server assigns IPv4 and IPv6 addresses to clients. This article solely covers IPv4 scopes.

DHCP Scopes Environment

3. To begin the New Scope Wizard, right click on IPv4, select New Scope, and then click Next on the introduction screen.

Install and Configure DHCP Server on Windows Server DHCP New Scope

4. Give us a name and a description of our choice. Once finished, click Next. Scopes are frequently assigned to physical buildings or, on occasion, IP subnets.

Provide a Scope Name

5. Next, define an IP Address Range that specifies the IP address range assigned to the DHCP server’s clients. Enter a CIDR Length or Subnet Mask on this screen, which we assign to all clients.

DHCP Scope Range

Following Steps

It is common practice to intentionally leave the beginning and end of the address pool empty to accommodate any statically assigned addresses.

6. To proceed past the Add Exclusions and Delay step, click Next. A DHCP exclusion prevents the server from attempting to assign a specific IP address in its address pool if we know of one or more IP addresses already in use within the defined address range.

Install and Configure DHCP Server on Windows Server Add exclusions and delay

7. For the time being, accept the default Lease Duration by clicking Next.

DHCP Lease Duration

8. On the Configure DHCP Options step, leave the default setting and click Next.

DHCP Scope Options

9. Next, assign the Router an IP address of 10.0.0.1. (Default Gateway). Once clients have access to the DHCP scope, the server gives this IP address as the client’s default gateway. Also, clients communicate with other networks or the Internet through the default gateway.

DHCP Router Default Gateway

10. Because this tutorial is set up in an environment with a DNS server, enter the IP address on the Domain name, and DNS Servers step. This IP address is assigned as the DNS client for DHCP clients to convert names to IP addresses.

The Parent domain should be auto-populated based on the Active Directory domain in which the DHCP server is a member.

Install and Configure DHCP Server on Windows Server Parent Domain

11. If we still have a WINS server in our environment, enter its IP address in the WINS Server step. This article does not use one, so click Next to proceed.

DHCP WINS Server

12. Finally, activate the new scope and make it available to clients by checking the box next to Yes, I want to activate this scope now. Then click Next to proceed. Following the preceding steps, we should see the new scope under IPv4, as shown below.

DHCP Scope Activation

DHCP Address Pool

Creating a DHCP Scope via PowerShell

If we don’t like the GUI or need to automate DHCP tasks, we turn to PowerShell. Let’s go over the same procedure as in the Server Manager, but this time with PowerShell.

Assume we’re on a test DHCP server’s Windows desktop:
1. As an administrator, launch Windows PowerShell.
2. To find all existing DHCP scopes, use the Get-DhcpServerv4Scope cmdlet.

As shown in the example below, this server only has the scope we defined using the GUI in the previous steps.

Install and Configure DHCP Server on Windows Server PowerShell GET DHCP Output

3. To create a new DHCP scope, use the Add-DhcpServerv4Scope cmdlet. Because this command has many parameters, save time by defining each parameter in a PowerShell hashtable and passing all parameters to the cmdlet using splatting.

				
					 $DHCPDetails = @{
     'Name' = 'Branch Office'; 
     'Description' = 'Wireless Users'; 
     'StartRange' = '10.1.0.100'; 
     'EndRange' = '10.1.0.200'; 
     'SubnetMask' = '255.255.255.0';
     'State' = 'Active'; 
     'LeaseDuration' = '1.00:00:00'; 
 }
 
 Add-DhcpServerv4Scope $DHCPDetails
				
			

4. Now, rerun Get-DhcpServerv4Scope to verify PowerShell successfully created the DHCP scope.

Install and Configure DHCP Server on Windows Server Conclusion

In conclusion, installing and configuring DHCP in Windows Server is essential in setting up a network infrastructure. DHCP provides:

  • Dynamic IP address assignment.
  • Enabling clients to receive IP addresses automatically.
  • Subnet masks.
  • Default gateways from a central server.

With proper configuration, DHCP simplifies the management of IP addresses and reduces the risk of IP conflicts. Installing and configuring DHCP in Windows Server requires a basic understanding of networking concepts and the DHCP service, as well as a hands-on approach to configuring the server and setting up scopes, options, and reservations. The result is a scalable, efficient, and robust network infrastructure that meets the organization’s needs.

Try InfraSOS for FREE

Invite your team and explore InfraSOS features for free

  • Free 15-Days Trial
  • Easy Setup
  • Full Access to Enterprise Plan

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Запуск драйвера для этого устройства заблокирован код 48 windows 10
  • Как включить hyper threading в windows 10
  • Проблема с активацией windows 7 ultimate
  • Windows защита от веб угроз
  • Служба windows audio перестала работать