在 debian 上安裝 dhcp/tftp 伺服器

在 debian 上安裝 dhcp/tftp 伺服器

我正在嘗試在 Debian 電腦上配置 dhcp 伺服器以運行 tftp 伺服器。我有 1 張網卡,即 eth0。我遵循了幾個教程,但沒有一個對我有用。我安裝了 dhcp3-server,這是我的 /etc/dhcp3/dhcpd.conf 檔案:

subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.10 192.168.1.100;
 option domain-name-servers 192.168.1.1;
 option netbios-name-servers 192.168.1.1;
 option routers 192.168.1.1;
 option subnet-mask 255.255.255.0;
 option broadcast-address 192.168.1.255;
 default-lease-time 86400;
 max-lease-time 676800;
 }

我不需要非常複雜也不安全的配置。我所需要的只是所有連接到網路的電腦都將透過 dhcp 伺服器獲得 IP 位址。我甚至不需要在啟動時啟動該服務,因為我只是偶爾使用它。該網路沒有任何其他 dhcp 伺服器正在運作。問題是我無法啟動服務,當我查看 /var/log/syslog 時,出現以下錯誤:

Nov 17 19:15:58 debian dhcpd: Not configured to listen on any interfaces!
Nov 17 19:17:01 debian /USR/SBIN/CRON[2311]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Nov 17 19:18:43 debian dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
Nov 17 19:18:43 debian dhcpd: Copyright 2004-2010 Internet Systems Consortium.
Nov 17 19:18:43 debian dhcpd: All rights reserved.
Nov 17 19:18:43 debian dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Nov 17 19:18:43 debian dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
Nov 17 19:18:43 debian dhcpd: Copyright 2004-2010 Internet Systems Consortium.
Nov 17 19:18:43 debian dhcpd: All rights reserved.
Nov 17 19:18:43 debian dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Nov 17 19:18:43 debian dhcpd: Wrote 0 leases to leases file.
Nov 17 19:18:43 debian dhcpd: 
Nov 17 19:18:43 debian dhcpd: No subnet declaration for eth0 (192.168.1.27).
Nov 17 19:18:43 debian dhcpd: ** Ignoring requests on eth0.  If this is not what
Nov 17 19:18:43 debian dhcpd:    you want, please write a subnet declaration
Nov 17 19:18:43 debian dhcpd:    in your dhcpd.conf file for the network segment
Nov 17 19:18:43 debian dhcpd:    to which interface eth0 is attached. **
Nov 17 19:18:43 debian dhcpd: 
Nov 17 19:18:43 debian dhcpd: 
Nov 17 19:18:43 debian dhcpd: Not configured to listen on any interfaces!

我不知道你是否需要它,但這是我的 ifconfig 輸出:

eth0      Link encap:Ethernet  HWaddr f0:4d:a2:f1:38:dc  
          inet addr:192.168.1.27  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2a01:e35:8bb7:2480:f24d:a2ff:fef1:38dc/64 Scope:Global
          inet6 addr: fe80::f24d:a2ff:fef1:38dc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2733 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2697 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1110122 (1.0 MiB)  TX bytes:476771 (465.5 KiB)
          Interrupt:18 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:126 errors:0 dropped:0 overruns:0 frame:0
          TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:7884 (7.6 KiB)  TX bytes:7884 (7.6 KiB)

答案1

新增eth0到您的INTERFACES行中/etc/default/isc-dhcp-server

答案2

我最近剛寫了一篇關於在 VirtualBox 中設定 FAI 實驗室的文章,其中包括配置 DHCP 和 TFTP 伺服器。您可以在這裡找到這篇文章:http://plathrop.tertiusfamily.net/2011/11/01/fai-lab-with-virtualbox-part-i.html- 您需要跳到我為 PXE 啟動配置 DCHP 的部分。

儘管本文是為 Ubuntu 編寫的,但這些說明在 Debian 上應該完全相同。

相關內容