Вопрос: Пример настройки DHCP Relay, и принципиальное отличие от DHCP Local Relay

Ответ: 

Топология:

Рисунок 1.

Конфигурация:
# DGS-3627
create vlan client tag 555
config vlan client add tagged 1-12
create vlan management tag 1234
config vlan management add tagged 1-12
config vlan default delete 24
config vlan management add untagged 24
config ipif System ipaddress 10.90.90.90/24
create ipif client_gw 10.100.10.1/24 client state enable
create ipif manag_gw 192.168.0.1/24 management state enable

# DES-3200-10
config vlan default delete 1-8
create vlan client tag 555
config vlan client add tagged 9-10
config vlan client add untagged 1-8
create vlan management tag 1234
config vlan management add tagged 9-10
config ipif System ipaddress 192.168.0.170/24 vlan management
enable dhcp_relay
config dhcp_relay option_82 state enable
config dhcp_relay option_82 check disable
config dhcp_relay option_82 policy replace
config dhcp_relay option_82 remote_id default
config dhcp_relay add ipif System 192.168.0.221
config dhcp_relay ports 9-10 state disable
config dhcp_relay ports 1-8 state enable

DHCP Server (на примере isc-dhcpd 4.2.3-P2)
lease-file-name "/var/log/dhcpd.leases";
log-facility local7;
authoritative;
default-lease-time 86400;
ddns-update-style none;
local-address 192.168.0.221;
one-lease-per-client true;
deny duplicates;

if exists agent.circuit-id {
log(info, concat("Lease"," IP ",binary-to-ascii(10, 8,".",leased-address),
" MAC ",binary-to-ascii(16,8,":",substring(hardware,1, 6)),
" port ",binary-to-ascii(10,16, "",substring(option agent.circuit-id, 4,
2)),
" VLAN ",binary-to-ascii(10, 16,"",substring(option agent.circuit-id, 2, 2))
));
}

class "sw170-1" {
match if binary-to-ascii(16, 8, ":", suffix(option agent.remote-id, 5))
= "24:1:fc:8f:d8" and binary-to-ascii(10, 8, "", suffix(option
agent.circuit-id, 1)) = "1";
}
class "sw170-2" {
match if binary-to-ascii(16, 8, ":", suffix(option agent.remote-id, 5))
= "24:1:fc:8f:d8" and binary-to-ascii(10, 8, "", suffix(option
agent.circuit-id, 1)) = "2";
}

shared-network test {
stash-agent-options true;
subnet 192.168.0.0 netmask 255.255.255.0 {
deny unknown-clients;
}
subnet 10.100.10.0 netmask 255.255.255.0 {
option broadcast-address 10.100.10.255;
option domain-name-servers 10.100.10.1;
option routers 10.100.10.1;
option subnet-mask 255.255.255.0;
pool { range 10.100.10.101; allow members of "sw170-1";}
pool { range 10.100.10.102; allow members of "sw170-2";}
pool { range 10.100.10.200 10.100.10.250;}
}
}

где 24:1:fc:8f:d8 – МАК адрес коммутатора (релей агента).

Затем подключаем клиентов в соответствии с тополоигией на рисунке 1. При текущих настройках клиенты должны получить следующие адреса:
Client A: 10.100.10.101
Client B: 10.100.10.102
Client C: 10.100.10.200

Принципиальные отличия DHCP Relay от DHCP Local Relay:
1. DHCP сервер должен быть дуступен с управляющего интерфейса коммутатора.
2. При использовании DHCP Relay, коммутатор перенаправляет DHCP пакеты юникастом от своего адреса, добавляя в них опцию 82.