Добрый день! Есть такой конфиг DHCP
log-facility local7;
option domain-name-servers 1.1.1.1, 8.8.8.8;
shared-network BNET {
interface bce1;
option routers 172.21.0.1;
default-lease-time 2400;
max-lease-time 1800;
subnet 172.21.64.0 netmask 255.255.192.0 {
range 172.21.100.2 172.21.114.254;
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set SwitchMac = "";
set SwitchPort ="";
if exists agent.circuit-id
{
set SwitchMac = binary-to-ascii(16, 8, ":", option agent.remote-id);
set SwitchPort = binary-to-ascii(10, 8, ":", suffix(option agent.circuit-id, 1));
}
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "commit",
ClientIP, ClientMac, SwitchMac, SwitchPort);
}
on expiry {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "expiry", ClientIP);
}
on release {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "release", ClientIP);
}
}
subnet 172.21.0.0 netmask 255.255.192.0 {
deny unknown-clients;
range 172.21.0.2 172.21.63.254;
{% for user in users %}
{% eval i = 0 %}
{% for ip in user.ips %}
{% if ip.type eq 'static' && user.mac. %}
host host{{ip.ipa}} { hardware ethernet {{user.mac.|pretty_mac}}; fixed-address {{ip.ipa}}; }
{% eval i = i + 1 %}
{% endif %}
{% endfor %}
{% endfor %}
}
}
Тоесть делаеться выбор из базы мак+IP.
Но сеть нужно поделить на VLAN-ы.
Привести к похожему виду:
log-facility local7;
option domain-name-servers 1.1.1.1, 8.8.8.8;
shared-network BNET {
interface bce1;
option routers 172.20.64.1;
default-lease-time 2400;
max-lease-time 1800;
subnet 172.20.64.0 netmask 255.255.192.0 {
range 172.20.64.2 172.20.64.254;
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set SwitchMac = "";
set SwitchPort ="";
if exists agent.circuit-id
{
set SwitchMac = binary-to-ascii(16, 8, ":", option agent.remote-id);
set SwitchPort = binary-to-ascii(10, 8, ":", suffix(option agent.circuit-id, 1));
}
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "commit",
ClientIP, ClientMac, SwitchMac, SwitchPort);
}
on expiry {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "expiry", ClientIP);
}
on release {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
execute("/usr/bin/perl", "/usr/local/nodeny/modules/dhcp/events.pl", "release", ClientIP);
}
}
}
shared-network 0-124 {
interface vlan124;
option routers 172.20.124.1;
default-lease-time 2400;
max-lease-time 1800;
subnet 172.20.124.0 netmask 255.255.255.0 {
deny unknown-clients;
range 172.20.124.4 172.20.124.254;
{% for user in users %}
{% eval i = 0 %}
{% for ip in user.ips %}
{% if ip.type eq 'static' && user.mac. %}
host {{ip.ipa}} { hardware ethernet {{user.mac.|pretty_mac}}; fixed-address {{ip.ipa}}; }
{% eval i = i + 1 %}
{% endif %}
{% endfor %}
{% endfor %}
}
}
Вопрос в следующем, как отфильтровать выбор IP, для подсети 172.20.124.0/24, для этой части shared-network 0-124
что бы в каждой shared-network был свой диапазон и свой роут