"dhcpd failed" error when starting DHCP server

22,438

Are you trying to have a system get an address for itself via DHCP? That's a bad idea for very many reasons.

You need a DHCP server running outside of this system.

I believe the isc-dhcp-server is failing because no interface is on the same subnet as your specified DHCP scope. eth2 cannot fufill this criteria because it has no IP address. And if it had an IP address ... it wouldn't need to get one via DHCP. You can see why what you are doing makes no sense.

Do a tail -n 30 /var/log/syslog after you try to start it again to be exactly sure.

Share:
22,438

Related videos on Youtube

Newbie
Author by

Newbie

Updated on September 18, 2022

Comments

  • Newbie
    Newbie over 1 year

    I am setting up a DHCP server on Debain (virtual machine) on Ubuntu 12.04 host, but unable to get it up and running.

    My configuration is like this,

    dhcpd.conf

    ddns-update-style none;
    option domain-name "xyz.com";
    option domain-name-servers ns1.example.org, ns2.example.org;
    
    default-lease-time 600;
    max-lease-time 7200;
    
    authoritative;
    log-facility local7;
    
    subnet 172.16.101.0 netmask 255.255.255.0 {
      range 172.16.101.10 172.16.101.20;
      #option broadcast-address 172.16.101.255;
      #option subnet-mask 255.255.255.0;
      option routers 172.16.101.1;
    }
    

    For interfaces

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth2
    auto eth2
    iface eth2 inet dhcp
    

    /etc/default/isc-dhcp-server

    # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
    #   Separate multiple interfaces with spaces, e.g. "eth0 eth1".
    INTERFACES="eth2"
    

    but everytime I restart dhcp service it says,

    root@debian1:/home/user# /etc/init.d/isc-dhcp-server restart
    Stopping ISC DHCP server: dhcpd failed!
    Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!
     failed!
    

    What is wrong with this configuration?

    • Serge
      Serge over 11 years
      So, what is in the /var/log/messages?
    • Newbie
      Newbie over 11 years
      No subnet declaration for eth1 (no IPv4 addresses) Ignoring requests on eth1. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface eth1 is attached.
  • Newbie
    Newbie over 11 years
    It is already in the bridged mode. Even then the NIC card on physical machine gets IP from the DHCP.
  • Serge
    Serge over 11 years
    Then could you please clarify your question What exactly you would like to do.
  • Newbie
    Newbie over 11 years
    I am trying to bridge connect two DHCP servers (virtual machines) in different subnets to one physical NIC. But, my first DHCP server won't start unless I assign an IP to NIC interface which is bridged to physical NIC. And My physical NIC also gets a IP of that subnet. So how can I make my 2nd DHCP server run on same physical NIC?
  • Serge
    Serge over 11 years
    You even should not run a second DHCP server on the same physical segment of the network, not speaking about the same NIC. What a purpose of having a DHCP server in both VMs bridged to the same NIC of your workstation?
  • Newbie
    Newbie over 11 years
    That Physical NIC is then connected to a manageable switch (having vlans) for clients to get IP from their respective subnets.
  • Serge
    Serge over 11 years
    Then I think you need to post a new Question which clearly states the problem, like this: You have a LAN on that you would like to have several VLANs. Your current DHCP server is providing clients of your LAN with addresses. What changes should be done in the existing DHCP server configurations, and/or should the extra DHCP servers be installed. The possible question topic: "Having multiple DHCP-managed VLANs?"
  • Newbie
    Newbie over 11 years
    Yes, but i am still not sure if this addresses my problem. I have two DHCP servers as virtual machines and I need them to be briged to one physical NIC. So that I can connect my switch to that physical NIC port. Problem here is, how to bridge one physical nic to two virtual NICs, both is separate subnets.
  • Serge
    Serge over 11 years
    This is not a big question. You have to set up several addresses to this physical NIC and both Windows and Linux does allow this. But the problem is not this. First, I am not quite familiar with VLAN networking, but I know when a linux machine needs to be connected to different VLANs over the same physical NIC then you see not just one interface in the output of ifconfig but extra VLAN 'aliases' (I might be using improper terminology here) that each has its own ip address on the particular VLAN. And then I see no problem to run the dhcpd direcly... (see next comment)
  • Serge
    Serge over 11 years
    on this machine with no need to run VM's - you just define subnet range for each VLAN segment you would like to serve in the configuration of this dhcp server
  • Serge
    Serge over 11 years
    I mean that your attempt to solve your problem with running two VMs just to have two dhcp servers to supply addresses to these VLANs is an overkill in my opinion.
  • Newbie
    Newbie over 11 years
    Thank u.. I understand what you are saying. But my project involves running two VMs as server, which in future might be separate servers with other applications installed in them. First phase is to get up and running the DHCP servers on single machine.
  • Serge
    Serge over 11 years
    then, anyway, you need to bring up all necessary VLAN 'aliases' on your NIC so these VLAN's are accessible from this hosting server.
  • Newbie
    Newbie over 11 years
    Sorry for the late reply. Yes, both VMs are on the same host.
  • Serge
    Serge over 11 years
    @Newbie Then definitely you need to make the link between this host and switch a trunk link and set this host to see three VLAN's over the NIC connected to the switch. Look at man vconfig how to accomplish this. Then you will have three interfaces - one for 'regular' this host connectivity and two interfaces for VMs - one for each VM. In the networking settings of the VM when you select Bridged Network you may choose that interface in the host to use.
  • Newbie
    Newbie over 11 years
    Sorry. I do not fully understand ur reply. If u could explain more in detail and from scratch. If I am creating 2 separate subnets then why should I create Vlans? I mean Vlans will be created in switch so specific ports can be assigned their subnets. Main concern is, how to bridge two VMs (separate networks) to one physical NIC.
  • Serge
    Serge over 11 years
    if you do not tell the switch that your host should be able to talk to all three VLAN's then your VMs will be bound to the same VLAN (the default one) and they never be able to provide dhcp service on these extra VLAN's
  • Serge
    Serge over 11 years
    @Newbie read above about trunk link and VLAN-s at host - this will allow you to do what you want
  • Newbie
    Newbie over 11 years
    I have idea about trunk and vlans. But my problem remains the same, i.e. both the virtual DHCP machines want to give IPs of their network to the Physical bridged interface. How can I resolve this problem first? Is it possible to slit the physical NIC e.g 'eth1:0' in virtual interfaces and still VMs can recognize that interface?
  • Serge
    Serge over 11 years
    As I wrote above when you set up three VLAN's (the default one and two extra) you will have 3 additional interfaces. The interface for the default VLAN will be used by the host to communicate to other machines in your network. The extra VLAN interfaces you will use to set up a bridged netwoking in VM's. In the Network Settings of the VM (the settings in VirtualBox GUI) you will be able to select a particular VLAN intefrace to make a bridge. Not the NIC's interface