Debian 11 2つ以上のクライアントネットワークにDHCPを設定する

Debian 11 2つ以上のクライアントネットワークにDHCPを設定する

Proxmoxサーバーには2つのブリッジ(vmbr1 vmbr2)があります。

vmbr1 IP:NATクライアント用192.168.106.1

vmbr2 IP:192.168.107.1ローカルのみ

DHCPサーバー(isc-dhcp-server)を設定しましたが、1つのネットワークセグメント(vmbr1)と完全に機能します。

2番目のネットワークセグメント(vmbr2)を設定しようとすると、次のメッセージでDHCPサーバーが失敗します。

No subnet declaration for vmbr2 (no IPv4 addresses).
** Ignoring requests on vmbr2.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface vmbr2 is attached. **

このエラーの場合は、次の文で問題を明確に解決できます。

subnet-mask 255.255.255.0;

ただし、エラーは次のとおりです。

 isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
 If you think you have received this message due to a bug rather
 isc-dhcp-server.service: Failed with result 'exit-code'.
 than a configuration issue please read the section on submitting
 Failed to start LSB: DHCP server.
 bugs on either our web page at www.isc.org or in the README file
 before submitting a bug.  These pages explain the proper
 process and the information we find helpful for debugging.

 exiting.

これは動作する/etc/default/isc-dhcp-serverです:

INTERFACESv4="vmbr1"
#INTERFACESv4="vmbr1 vmbr2"
#INTERFACESv6=""

これは動作する/etc/dhcp/dhcpd.confです:

option domain-name "mydomain.ca";
option domain-name-servers 8.8.8.8,8.8.4.4;
  
subnet 192.168.106.0 netmask 255.255.255.0 {
range 192.168.106.20 192.168.106.150;
#subnet-mask 255.255.255.0;
option routers 192.168.106.1;
}

#subnet 192.168.107.0 netmask 255.255.255.0 {
#range 192.168.107.20 192.168.107.150;
#subnet-mask 255.255.255.0;
#option routers 192.168.107.1;
#}

問題を引き起こすオプションはコメントアウトされました。

どんなアイデアがありますか?

ベストアンサー1

いいえ、行を追加するように求められません。

subnet-mask 255.255.255.0;

そのようなディレクティブはありませんsubnet-mask。と思うかもしれませんoption subnet-mask。ただし、マスクはすでにsubnet x.x.x.x netmask y.y.y.y { ... }サブネット宣言(ブロックなど)で指定されているため、これは必要ありません。

現在設定されている設定と一致するネットワークアドレスとマスクを持つブロックを見るとはどういう意味ですかNo subnet declaration for vmbr2dhcpdsubnet ... { ... }vmbr2

dhcpd.conf両方のサブネットを提供する準備のための変更された作業バージョンは次のとおりです。

option domain-name "mydomain.ca";
option domain-name-servers 8.8.8.8,8.8.4.4;
  
subnet 192.168.106.0 netmask 255.255.255.0 { # <-- subnet mask already specified here
range 192.168.106.20 192.168.106.150;
##subnet-mask 255.255.255.0;  <--- this line should be deleted
option routers 192.168.106.1;
}

subnet 192.168.107.0 netmask 255.255.255.0 { # <-- subnet mask already specified here
range 192.168.107.20 192.168.107.150;
##subnet-mask 255.255.255.0;  <--- this line should be deleted
option routers 192.168.107.1;
}

明らかに出力を介してエラーメッセージを表示していますsystemctl status isc-dhcp-server.service。実際の出力の最後の10行だけが表示されることに注意してください。 DHCPサーバーの構成構文が正しいことを確認するためのより良い方法-tdhcpd

元の「作業中の/etc/dhcp/dhcpd.conf」を として保存し、/tmp/dhcpd.conf.test最初の行subnet-maskのコメントを解除して実行すると、dhcpd -cf /tmp/dhcpd.conf.test -t全体の出力は次のようになります。

# dhcpd -cf /tmp/dhcpd.conf.test -t
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
/tmp/dhcpd.conf.test line 6: semicolon expected.
subnet-mask 255.
             ^
Configuration file errors encountered -- exiting

If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug.  These pages explain the proper
process and the information we find helpful for debugging.

exiting.

最後に出てくるフレーズは、重要な部分を見逃す可能性があります。

/tmp/dhcpd.conf.test line 6: semicolon expected.
subnet-mask 255.
             ^
Configuration file errors encountered -- exiting

subnet-maskこのように使用しないことを示します。

おすすめ記事