3

I have only One dhcp server which has only one interface with ip address 10.0.0.1/24. The dhcpd.conf are like:

subnet 10.0.0.0 netmask 255.255.255.0 {                 <-------working
   host yyy {
         hardware ethernet BB:BB:BB:BB:BB:BB;
         fixed-address 10.0.0.53;
   }
}

subnet 192.168.0.0 netmask 255.255.255.0 {              <--------not working, why?
     host xxx {
         hardware ethernet AA:AA:AA:AA:AA;
         fixed-address 192.168.0.53;
     }
}

When the host xxx try to request a dhcp, the dhcp server shows error: DHCPDISCOVER from AA:AA:AA:AA:AA via eth0: network 10.0.0.1/24: no free leases.

But when the host yyy ask for a ip address, the dhcp server do give out a DHCP offer.

Can I assign 192.168.0.0/24 address within a dhcp server only have 10.0.0.0/24 interface? How can I configure to make it work?

valpa
  • 319
  • 9
  • 15
  • 1
    Are these two physically distinct subnets? Are they VLANs? Do they share an Ethernet segment? We need to understand your network topology to give you a useful answer. – David Schwartz Dec 13 '11 at 02:19
  • please visit this page for full configuration and description http://superuser.com/questions/74013/how-to-setup-a-dhcp-server-who-serves-to-different-ip-ranges-e-g-192-168-1-x-a – DEEPAK GEORGE Dec 13 '11 at 04:47
  • Yes, you are right, add an eth0:1 with ip address 192.168.0.1/24 will make DHCP server send out the DHCPOFFER. But I cannot do that. – valpa Dec 14 '11 at 05:32
  • Add a dhcp helper address to the router on the 192.168.0.0 network. That helper address should be the server's IP on the 10.0.0.0 subnet. Also make sure that dhcpd is bound to 0.0.0.0 via `netstat -anp`. – ewwhite Dec 14 '11 at 06:11

4 Answers4

7

Welcome to serverfault!
Yes, you can issue IP Addresses for subnets on which the server itself does not have an interface.

When a client tries to obtain an IP Address, it sends a broadcast looking for a DHCP server. When there is no DHCP server available on the local network, a router can be configured as a DHCP helper such that when it receives a DHCP broadcast, it will create a unicast packet destined for the DHCP server with the original client's information (mac, network). Using the network information, the DHCP server can determine from which scope to issue a lease to the client. It sends this info back to the router which sends it back to the client.

If you move your additional clients to another vlan or on another network segment and setup a router with an interface in each subnet, then configure the router's DHCP helper with the IP of your DHCP server, you should be in business.

Paul Ackerman
  • 2,729
  • 1
  • 16
  • 23
  • 1
    +1 You need an relay agent or an interface on that subnet. – Zoredache Dec 13 '11 at 01:25
  • I have cisco ip helper. I have everything ready! But the DHCP server that cannot send a DHCPOFFER out when it gets the DHCPREQUEST. – valpa Dec 14 '11 at 05:24
  • You talking about the client and network part. But my problem is a DHCP server problem. If DHCP server don't send the DHCPOFFER out, it fails. – valpa Dec 14 '11 at 05:36
  • I see but the server must receive the request correctly to begin with. Have you setup the networking such that clients are behind a router in the 192.168.0.X/24 subnet? If so, the server should be getting a unicast request from the router which would match the second scope you have created and an IP should be offered. Since you state the error says "network 10.0.0.1/24: no free leases", this indicates the request does not include the correct subnet. – Paul Ackerman Dec 14 '11 at 16:19
  • I don't understand, the request is a BROADCAST message, why and how it include the correct subnet? The server surely get the REQUEST message, then it can show "no free leases". – valpa Jan 05 '12 at 23:30
  • The original request from the workstation is, in fact a broadcast. However, when the router is configured as a DHCP relay agent, it creates a unicast message directly to the DHCP server and includes the subnet on which the request came in. It does appear that the DHCP server is getting a request but it is coming in on the same subnet as the DHCP server rather than going through the router. You need to separate the networks using vlans or multiple switches. The problem is the network topology. – Paul Ackerman Jan 06 '12 at 20:38
1

Your problem here is that you don't have any free leases, as indicated by "no free leases".

That means that your DHCP scope on the 10.0.0.0 network is completely exhausted. You didn't include the IP ranges in your post, but can you post that information? If not, just see if you can expand the IP range to provide more room for the host you're trying to configure. After you make that change, restart the DHCP daemon and check to see if your client can obtain an IP.

Skyhawk
  • 14,200
  • 4
  • 53
  • 95
ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • While that is true, that isn't really what his question was asking. He was asking 'why isn't the second range I have defined working?' – Zoredache Dec 13 '11 at 01:33
  • But his errors indicate that's why he's not able to server clients. I don't think he's trying to add a new subnet because he's trying to address a different location or network (based on his comment on the oldest post). I think it's exhaustion of DHCP leases. And in any case, the clients on the original subnet should have some breathing room. – ewwhite Dec 13 '11 at 01:42
1

It can serve as many network ranges as you need to serve. :)

But in your problem, perhaps the IP Address 192.168.0.53 which you wish to lease to the xxx host is already leased to another client as you said:

When the host xxx try to request a dhcp, the dhcp server shows error: DHCPDISCOVER from AA:AA:AA:AA:AA via eth0: network 10.0.0.1/24: no free leases.

"No free leases" means what it means :).
Human translation here is: Via eth0 interface 10.0.0.1/24 I have received a DHCPDISCOVER FROM a client AA:AA:AA:AA:AA but I DON'T have any free address to lease to it!

Try to select different address for the host that hasn't been leased already ex: 192.168.0.250 may work. Alternatively you can add an excluded range of addresses in a DHCP and assign the IP address to the host manually.

NOTE:
Also be advised that on some DHCP servers, if the host already has the address (in your case 192.168.0.53) and you add the same address as a fixed address in the server YOU WILL GET THE ERROR MESSAGE. From a point of view the server is correct IT CAN NOT lease an already leased address!
So you may want to free the IP address first from the pool and try the procedure again.
ipconfig /release on the client may do the trick :)

Spirit
  • 1,154
  • 8
  • 25
  • 45
0

Short answer: Yes it's possible

Long answer: You'd better offer those 192.168.0.0/24 clients a valid gateway or they're probably going to be unhappy.

Joel E Salas
  • 5,572
  • 16
  • 25