0

I'm trying to configure a dhcp server on my Debian computer in order to run a tftp server. I have 1 nic which is eth0. I followed several tutorials but none of them worked with me. I installed dhcp3-server and this is my /etc/dhcp3/dhcpd.conf file:

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;
 }

I do not need a very complicated nor secure configuration. All I need is that all the computer connected to the network will get an ip address through the dhcp server. I don't even need the service to start at startup as I'll be using it occasionally only. The network doesn't have any other dhcp server running. The problem is I can't start the service and when I have a look at /var/log/syslog, I get this error:

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!

I don't know if you need it but here is my ifconfig output:

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)
Arthur
  • 1
  • 2
  • Your server's IP is inside you allocatable range. You *probably* don't want this, and it might also be causing the failure. Shrink your range or move your Server's IP outside it and try to restart. – SmallClanger Nov 17 '11 at 19:23
  • Why is my server's IP inside my allocatable range? Isn't my server's IP 192.168.1.1? I can't see any value between 10 and 100 (allocatable range) so I don't really understand... – Arthur Nov 18 '11 at 08:54
  • It's there in your `ifconfig`: `inet addr:192.168.1.27 Bcast:192.168.1.255 Mask:255.255.255.0` - The same IP is repeated in your syslog. Can you add the contents of `/etc/network/interfaces` to your original post? – SmallClanger Nov 18 '11 at 09:28
  • Ohh don't care about that value it's because I have to connect to a different network to get the internet so my ip changes. When I'm on the testing network, my IP is set to 192.168.0.1 – Arthur Nov 18 '11 at 13:38
  • I managed to make the dhcp server running but now I struggle with the tftp server. I downloaded tftpd, tftpd-hpa and tftp (for testing) and this is my tftpd conf file (/etc/default/tftpd-hpa): RUN_DAEMON="yes" OPTIONS="-l -s /srv/tftp" TFTP_USERNAME="tftp" TFTP_DIRECTORY="/srv/tftp" TFTFP_ADDRESS="192.168.1.1:69" My first question is why are these 3 lines always comming at the server's installation whereas they never appear in the tutorials ? : TFTP_USERNAME="tftp" TFTP_DIRECTORY="/srv/tftp" TFTFP_ADDRESS="0.0.0.0:69" My second question is why are these lines always in the tutorials but not in – Arthur Nov 18 '11 at 16:29

2 Answers2

3

Add eth0 to your INTERFACES line in /etc/default/isc-dhcp-server.

MikeyB
  • 39,291
  • 10
  • 105
  • 189
0

I just recently wrote about setting up an FAI lab in VirtualBox, which includes configuring a DHCP and TFTP server. You can find the article here: http://plathrop.tertiusfamily.net/2011/11/01/fai-lab-with-virtualbox-part-i.html - you'll want to skip to the section where I configure DCHP for PXE booting.

Although the article was written for Ubuntu, the directions should work exactly the same on Debian.

Paul Lathrop
  • 1,608
  • 11
  • 11
  • Ok I tryed your tutorial but it still doesn't seems to work. This is the conf file I did: `interface=eth0 dhcp-range=eth0,192.168.0.50,192.168.0.150,12h dhcp-boot=pxelinux.0 log-dhcp enable-tftp tftp-root=/srv/tftp/` The problem is the clients don't even get an IP address... Any idea? – Arthur Nov 18 '11 at 10:07
  • Not off the top of my head. You could use wireshark to watch the DHCP transaction and see if that helps clarify the issue. Are you 100% sure there is no other DHCP server running (no connection sharing set up on a mac, for example, or your router perhaps?) – Paul Lathrop Nov 21 '11 at 18:50