vlan10---->firewall----->linux dhcp server
vlan20---------↑
두 개의 VLAN(vlan10 및 vlan20)이 있고 Linux DHCP 서버를 사용하여 IP 주소 지정을 중앙 집중화하고 싶습니다.
Fortigate 방화벽에서는 클라이언트가 dhcp ip를 얻기 위해 dhcp 릴레이를 사용합니다.
Linux dhcp 서버에서는 [host] 섹션을 사용하여 클라이언트가 고정 IP를 얻도록 제한하고 알려진 호스트가 동적 IP를 얻도록 허용합니다.
########## config start #########
subnet 192.168.10.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option domain-name-servers 192.168.8.248,192.168.8.246;
option routers 192.168.10.1;
allow unknown-clients;
range 192.168.10.11 192.168.10.210;
}
subnet 192.168.20.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.20.255;
option domain-name-servers 192.168.8.248,192.168.8.246;
option routers 192.168.20.1;
deny unknown-clients;
range 192.168.20.11 192.168.20.210;
}
host host1 {
hardware ethernet 11:11:11:11:11:11;
fixed-address 192.168.10.20;
}
host host2 {
hardware ethernet 22:22:22:22:22:22;
fixed-address 192.168.10.21;
}
host host3 {
hardware ethernet 33:33:33:33:33:33;
fixed-address 192.168.20.20;
}
host host4 {
hardware ethernet 44:44:44:44:44:44;
}
########## config end #########
이 구성에서는 모든 클라이언트가 vlan10 또는 vlan20에서 IP를 얻을 수 있지만 호스트4는 vlan20에서만 동적 IP를 얻을 수 있기를 바랍니다.
호스트4가 vlan10에 연결되면 호스트4는 DHCP 서버에서 IP 주소를 얻을 수 없습니다.
구성을 어떻게 수정할 수 있나요?
답변1
현재 이것을 테스트할 수는 없지만, 구문에 대한 약간의 조정이 필요할 수 있습니다. '그룹' 정의를 사용하고 vlan10 및 vlan20에 대한 그룹의 모든 클라이언트를 나열할 수 있지만 vlan10 파일에서는 호스트4에 '부팅 거부'를 지시합니다. 그렇게 해야 합니다.
지금은 직접 테스트할 수 없지만 시도해 볼 가치가 있을까요?
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-dhcp-configuring-server.html#group https://www.daemon-systems.org/man/dhcpd.conf.5.html부팅 거부를 위해
또한 'includes' 지시문이 작동하는지 확인하고 싶을 수도 있으므로 다음과 같이 할 수 있습니다.
dhcp.conf:
option domain-name-servers 192.168.8.248,192.168.8.246;
include "/etc/dhcp/vlan10.txt"
include "/etc/dhcp/vlan20.txt"
vlan10.txt
group {
subnet 192.168.10.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
allow unknown-clients;
range 192.168.10.11 192.168.10.210;
include "/etc/dhcp/vlan10.hosts.txt"
include "/etc/dhcp/vlan10.deny.hosts.txt"
}
}
vlan20.txt
group {
subnet 192.168.20.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.20.255;
option routers 192.168.20.1;
deny unknown-clients;
range 192.168.20.11 192.168.20.210;
include "/etc/dhcp/vlan10.hosts.txt"
include "/etc/dhcp/vlan20.hosts.txt"
}
}
vlan10.hosts.txt
host host1 { hardware ethernet 11:11:11:11:11:11; fixed-address 192.168.10.20; }
host host2 { hardware ethernet 22:22:22:22:22:22; fixed-address 192.168.10.21; }
host host3 { hardware ethernet 33:33:33:33:33:33; fixed-address 192.168.20.20; }
vlan10.deny.hosts.txt
host host4 { hardware ethernet 44:44:44:44:44:44; deny booting; }
vlan20.hosts.txt
host host4 { hardware ethernet 44:44:44:44:44:44; }
답변2
어쩌면 당신의 호스트4와 일치하는 클래스를 생성하고 "'yourClass'의 멤버를 거부합니다."라는 줄을 추가할 수도 있습니다. 서브넷 구성이 도움이 될 수 있습니다.
예:
class "raspberry"
{
# match mac starting with b8:27:eb
match if substring(hardware, 1, 3) = b8:27:eb;
}
subnet 192.168.10.0 netmask 255.255.254.0 {
option routers 192.168.10.254;
pool {
range 192.168.10.11 192.168.10.210;
deny members of "raspberry";
}
}