閉じる

複数のネットワークのDHCPサーバーの構築・設定

/etc/sysconfig/dhcpd を編集します。

DHCPDARGS="enp1s0f1 enp1s0f0"

↑ 上記のように、ネットワークインタフェース名を複数指定します。複数ある場合は、” ”で囲む必要があります。環境に合わせて設定して下さい。

/etc/dhcp/dhcpd.conf を編集します。

#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#

not authoritative;
log-facility local7;

default-lease-time 3600;
max-lease-time 3600;

subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.20 192.168.100.99;
option domain-name "zoah.lan";
option domain-name-servers 192.168.100.200 192.168.100.200;
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.100.255;
option netbios-name-servers 192.168.100.200;
option netbios-node-type 8;
option ntp-servers 192.168.100.200;
#option netbios-dd-server 192.168.1.1;
#option netbios-scope "";
ddns-update-style interim;
ddns-domainname "zoah.lan";
ddns-updates on;
ignore client-updates;
}

subnet 192.168.102.0 netmask 255.255.255.0 {
range 192.168.102.20 192.168.102.99;
#option domain-name "zoah.alt";
#option domain-name-servers 192.168.102.200;
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.102.255;
#option netbios-name-servers 192.168.102.200;
#option netbios-node-type 8;
#option netbios-dd-server 192.168.1.1;
#option netbios-scope "";
#ddns-update-style interim;
#ddns-domainname "zoah.alt";
#ddns-updates on;
#ignore client-updates;
}

zone zoah.lan. {
primary 192.168.100.200;
}

zone 100.168.192.in-addr.arpa. {
primary 192.168.100.200;
}

#zone zoah.alt. {
# primary 192.168.102.200;
# }

#zone 102.168.192.in-addr.arpa. {
# primary 192.168.102.200;
# }

/etc/named.conf を編集します。

options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
version "T_T";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
recursion yes;
allow-query { any; };
allow-recursion { localhost; localnets; 192.168.100.0/24; 192.168.102.0/24; };
//allow-query-cache { localhost; localnets; 192.168.100.0/24; 192.168.102.0/24; };
dnssec-validation auto;
bindkeys-file "/etc/named.root.key";
tkey-gssapi-keytab "/usr/local/samba/bind-dns/dns.keytab";
minimal-responses yes;
};

logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
category lame-servers { null; };
};

view "internal" {
match-clients {
localhost;
127.0.0.1;
192.168.100.0/24;
192.168.102.0/24;
};
zone "." IN {
type hint;
file "named.ca";
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update {
none;
};
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update {
none;
};
};
//zone "255.in-addr.arpa" IN {
// type master;
// file "named.broadcast";
// allow-update {
// none;
// };
// };
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update {
none;
};
};
//zone "0.in-addr.arpa" IN {
// type master;
// file "named.zero";
// allow-update {
// none;
// };
// };
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update {
none;
};
};
zone "zoah.lan" {
type master;
file "zoah.lan.hosts";
allow-update { 192.168.100.0/24; 127.0.0.1; };
};
zone "100.168.192.in-addr.arpa" {
type master;
file "zoah.lan.rev";
allow-update { 192.168.100.0/24; 127.0.0.1; };
};
//zone "zoah.alt" {
// type master;
// file "zoah.alt.hosts";
// allow-update { 192.168.102.0/24; };
// };
//zone "102.168.192.in-addr.arpa" {
// type master;
// file "zoah.alt.rev";
// allow-update { 192.168.102.0/24; };
// };
};

view "external" {
match-clients { any; };
match-destinations { any; };
zone "zoah.net" {
type master;
file "zoah.net.hosts";
allow-update { none; };
allow-transfer{
153.120.38.37;
160.16.54.90;
};
notify yes;
};
zone "126.209.179.115.in-addr.arpa" {
type master;
file "zoah.net.rev";
allow-update { none; };
};
};

include "/usr/local/samba/bind-dns/named.conf";


/var/named/ 以下に、zoah.alt.hosts と zoah.alt.rev を作成し、編集します。

↓ zoah.alt.hosts を編集します。

$ORIGIN .
$TTL 600 ; 10 minutes
zoah.alt IN SOA server1.zoah.alt. rezo.zoah.net. (
2023094909 ; serial
600 ; refresh (10 minutes)
600 ; retry (10 minutes)
172800 ; expire (2 days)
3600 ; minimum (1 hour)
)
NS server1.zoah.alt.
server1.zoah.alt. A 192.168.102.200

↓ zoah.alt.rev を編集します。

$ORIGIN .
$TTL 600 ; 10 minutes
102.168.192.in-addr.arpa IN SOA server1.zoah.alt. rezo.zoah.net. (
2023094131 ; serial
600 ; refresh (10 minutes)
600 ; retry (10 minutes)
172800 ; expire (2 days)
3600 ; minimum (1 hour)
)
NS server1.zoah.alt.
200 PTR server1.zoah.alt.

[root@server1 ~]# systemctl restart dhcpd ← dhcpdを再起動します。

[root@server1 ~]# systemctl restart named ← DNSサーバーを再起動します。

© 2025 Linuxで自宅サーバー(ホームサーバー)-構築・設定方法- | WordPress テーマ: CrestaProject の Annina Free