Jump to content
RESET Forums (homeservershow.com)
t2clej

Network with 2 DHCP servers

Recommended Posts

t2clej

I have two networks working on same network, 10.0.0.1/24, 255.255.255.0.

 

Network 1 - unifi USG, switch and AP

Network 2 - Asus router

 

Currently, the UniFi USG acts as DHCP server handing out IP addresses between 10.0.0.51-200. I have several static ip assigned below 10.0.0.50.

 

Yesterday, I enabled the DHCP server on the Asus router only allowing it to give out ip addresses 10.0.0.225-226.

 

All seemed to be working until I started noticing some devices (iPhone, Samsung TV) not getting an ip address (instead getting 169.x.x.x).

When I disabled the Asus DHCP server, everything seemed to work again.

 

So my question is: Is it possible to run TWO dhcp servers? If it is, can someone give me pointers on how to properly setup?

 

Thank you.

Share this post


Link to post
Share on other sites
jmwills

First question is why? You can do this but you would need different subnets. Only one primary DCHP server per subnet can work.

Share this post


Link to post
Share on other sites
GotNoTime

Firstly, why are you doing this? Your configuration is very odd as your second DHCP IP pool is tiny compared to the first one.

 

For a home or small office network, you generally don't need or want multiple DHCP servers. It is a single point of failure but if the DHCP server is on the router then your network is down anyway if DHCP is down so you usually don't care. If you're doing this for a learning experience then that is fine obviously.

 

So my question is: Is it possible to run TWO dhcp servers?

Yes assuming you've correctly configured it.

 

As your DHCP servers aren't linked together, clients will broadcast trying to find a DHCP server and will pick up an IP from the first DHCP server it gets a response from. You have two separate IP pools and devices will bounce between them depending on which DHCP server replies first.

 

Your two DHCP servers can't be linked since they're integrated into your router and firewall however. ISC dhcpd can be linked together and share a global pool. The DHCP servers will operate concurrently and communicate with each other to update their own internal state of what devices are on what IPs. I assume Windows can do it as well but I've no experience of it.

 

My guess is that your DHCP server running on the Asus is giving a failure reply because its pool is only 2 IPs which is full. This is causing your devices to just give up entirely and automatically assign itself a linklocal IPv4 address.

Share this post


Link to post
Share on other sites
itGeeks

I have two networks working on same network, 10.0.0.1/24, 255.255.255.0.

 

Network 1 - unifi USG, switch and AP

Network 2 - Asus router

 

Currently, the UniFi USG acts as DHCP server handing out IP addresses between 10.0.0.51-200. I have several static ip assigned below 10.0.0.50.

 

Yesterday, I enabled the DHCP server on the Asus router only allowing it to give out ip addresses 10.0.0.225-226.

 

All seemed to be working until I started noticing some devices (iPhone, Samsung TV) not getting an ip address (instead getting 169.x.x.x).

When I disabled the Asus DHCP server, everything seemed to work again.

 

So my question is: Is it possible to run TWO dhcp servers? If it is, can someone give me pointers on how to properly setup?

 

Thank you.

Like all others y do you want to do this? It never a good idia to try and run 2 DHCP servers on the same network or you could end up with strange problems as your seeing. Your 2nd DHCP is only handing out 2 IP's so y not just assign the 2 devices manually and be done with it?

Share this post


Link to post
Share on other sites
t2clej

I was attempting to use the two dhcp servers to solve a problem I've had for several months. I have some devices that do not allow manually setting an ip and gateway. With the Asus router and its small ip pool, I was attempting to use assign those two ip addresses to the devices that do not allow manual configuration. 

 

I have two internet connections on the same network. The networks are linked with the unifi USG acting as dhcp server with ip 10.0.0.1 and the Asus at 10.0.0.5, both on 255.255.255.0

 

I can manually change the gateway (10.0.0.1 vs 10.0.0.5) depending on what internet connection I want to use. Works great for almost all my devices. A few however, do not allow manual setup therefore I was looking for solution. The 2 dhcp server setup seems to work for a short period of time then strange connection issues arise. 

 

The Asus which only should give out 2 ip addresses has BOTH of them static. 

Share this post


Link to post
Share on other sites
GotNoTime

I have two internet connections on the same network. The networks are linked with the unifi USG acting as dhcp server with ip 10.0.0.1 and the Asus at 10.0.0.5, both on 255.255.255.0

The UniFi USG can do static assignments for DHCP IPs it gives out. You don't need this kludge with another router.

 

I can manually change the gateway (10.0.0.1 vs 10.0.0.5) depending on what internet connection I want to use.

DHCP is a broadcast on the network segment. The clients will just use whoever replies first. You have to separate your networks if you don't want the other server to reply at all. The alternative is to shrink the pool on the USG and grow the pool on the Asus so both can assign dynamic IPs. The best solution is just to do the static assignments on the USG and get rid of the Asus entirely though.

 

The 2 dhcp server setup seems to work for a short period of time then strange connection issues arise.

Your DHCP leases are expiring and they're bouncing to the other DHCP server on the Asus. The clients presumably are repeatedly getting the Asus DHCP server and timeout which results in the linklocal IPv4 addresses.

Share this post


Link to post
Share on other sites
t2clej

The UniFi USG can do static assignments for DHCP IPs it gives out. You don't need this kludge with another router.

 

DHCP is a broadcast on the network segment. The clients will just use whoever replies first. You have to separate your networks if you don't want the other server to reply at all. The alternative is to shrink the pool on the USG and grow the pool on the Asus so both can assign dynamic IPs. The best solution is just to do the static assignments on the USG and get rid of the Asus entirely though.

 

Your DHCP leases are expiring and they're bouncing to the other DHCP server on the Asus. The clients presumably are repeatedly getting the Asus DHCP server and timeout which results in the linklocal IPv4 addresses.

 

 

GotNoTime:

 

1 - the USG can do static IP but it CAN NOT assign a specific gateway. So all the static ip I assign all go thru the 10.0.0.1 gateway. I can not manually assign 10.0.0.5 gateway when assigning static ip thru the USG.

 

2 - If the USG can only assign from 51-200 and the Asus from 253-254 (10.0.0.x) AND the Asus has both if its ip addresses manually assigned, should this not work?

 

3 - the Asus can only dhcp addresses between 10.0.0.253-254. Both of these are static/manually assigned. 

And why don't you want all the addresses on the same subnet?  What model Asus router is this?  Is there a way to setup VLANs using the  UniFi device? 

 

Good article here:  http://serverfault.com/questions/368512/can-i-have-multiple-dhcp-servers-on-one-network

 

I do want all addresses on same subnet, right?

 

Asus RT-AC68 with merlin firmware.

 

I tried the VLAN approach but there is NO setting for assigning the gateway (as far as I could tell).

Edited by t2clej

Share this post


Link to post
Share on other sites
GotNoTime

1 - the USG can do static IP but it CAN NOT assign a specific gateway. So all the static ip I assign all go thru the 10.0.0.1 gateway. I can not manually assign 10.0.0.5 gateway when assigning static ip thru the USG.

Ah. You've actually got two WAN connections? It wasn't very clear from your original post as you only mentioned a single gateway IP.

 

2 - If the USG can only assign from 51-200 and the Asus from 253-254 (10.0.0.x) AND the Asus has both if its ip addresses manually assigned, should this not work?

Depending on how the specific DHCP server setup inside the Asus is configured, it may still reply to DHCP client requests. If it just replies with an error and the client gives up or ignores the USG then it'll eventually timeout and get a linklocal address. It sounds like that is what is happening. To confirm, you'll need to dig around in the DHCP RFCs to see what exactly happens in this situation.

 

You're doing something odd which isn't a normal configuration. The proper way would be to setup the USG in dual WAN mode and leave it as the default gateway for your entire network. The USG would then decide to use which WAN connection depending on the client. However, only the USG Pro supports dual WAN. The small USG doesn't do it.

Share this post


Link to post
Share on other sites
t2clej

jmwills - thanks for the link.

 

Below is what I'm trying to accomplish. I have a feeling the UniFi USG does not handle another dhcp server well.

 

"In other words, if you have a range of DHCP addresses to issue to clients from 192.168.1.100 to 192.168.1.200, then both servers should be configured to serve separate parts of that range, so the first server might use parts of that scope from 192.168.1.100 to 192.168.1.150 and the second server would then issue 192.168.1.151 to 192.168.1.200."

Edited by t2clej

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...