在 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 上应该完全相同。

相关内容