2

Here's the scenario:

I have a main server and a backup server park. Due to the setup, there are port forwards active on my router to one specific ip address. Of course, I could make reservations for the backup server park too, but that would mean that I would duplicate all the servers for RDP and other services to match the new ip too.

Given that they are to substitute the other in case one goes down for maintenance, I was wondering if the following scenario is possible, and what the drawbacks are:

Have both servers listed on the DHCP server to get the same MAC Address and a second ip address.

If the first server gets an ip from the DHCP server, it uses the main address from the reservations. If the second server then comes online, it tries to claim the first main address from the DHCP, but fails, then automatically gets the second IP address.

Obviously, if the first server goes offline, the second will not automatically get the other IP Address. I'm aware of that, but that's not really the issue.

Basically in case the main server goes offline, I want to log into the second server, refresh its IP and everything works again. The easiest method is simply restarting the router which causes a network wide restart of all network interfaces giving all a new ip address.

The DHCP server is on a domain controller that runs windows server 2016, though the backup one has 2008 R2, but I'm pretty sure DHCP hasn't changed.

If I were able to do portforwarding based on hostname, the problem would've been solved already, but I can't.

So, is the above possible, and if so, are there any drawbacks or things I have to keep in mind? Any advice why this is a terrible idea, feel free to place them in the comments. :)

LPChip
  • 343
  • I give fixed IP addresses to all my machines which handle forwarded ports, but I set the address manually in the machines themselves to addresses outside the DHCP pool. I have swapped by router on occasions, and all works fine provided that the new router uses the same IP address, subnet and forwarding rules, with a DHCP pool which does not encroach on my assigned addresses. It removes one level of uncertainty. – AFH Aug 20 '17 at 21:10
  • Please add some detail, like what service you have a backup for. As like a cluster use a virtual IP, and each server behind got their own IP, but the client change nothing in case of a maintenance on the server – yagmoth555 Aug 20 '17 at 22:52
  • There are 2 servers. One runs Hyper-V, the other one runs OracleVM (old environment) Both have a server that does DC and a server that does Terminal Services. There are some programs installed on either servers that require portmappings. In case of problems that do not have quick fixes, I wonder if its possible to use DHCP to automatically set the IP addresses so I can keep the portmappings the same on the router. I prefer not to manually change the ip addresses on the servers. – LPChip Aug 21 '17 at 09:33
  • Chip - So you are trying to assign the same IP to match the port forwarding rule in the router to the secondary server in the event the primary server goes down? Any you are wanting to do with with DHCP and MAC address reservations? I don't think DHCP will allow same IP assigned to different MAC addresses so I'm not sure how that'd work if that's what you are asking. Could probably batch some processes to check conditions on both and take action assigning IP address via command like for example is secondary cannot reach primary, etc. – Pimp Juice IT Sep 01 '17 at 01:29
  • @McDonald's thanks. I've toyed around with simply setting 2 static ip addresses for the servers without actually doing DHCP, but its an ugly solution, so if there's a failover DNS or DHCP solution, that would be so much better. – LPChip Sep 01 '17 at 07:52
  • Okay, maybe script out mac reservation with DHCP and have an event or condition trigger the script that will make that change at that level? Too bad you couldn't have routing take care of redundancy switch at that level since the issue is single IP address PF rule or whatever. – Pimp Juice IT Sep 01 '17 at 12:26
  • Indeed. I'm currently considering to drop the entire idea though. Seems way too much trouble for a "nice to have" backup feature. I guess I'll first toy with the dual static ip assignment and see how that works in case of fall over. I'm affraid it will fail on both ip addresses though, so the 2nd server gets none while the first gets both. I'm also toying with the idea of passing the ip address from the Hyper-V environment in a way. That would also fix the issue. – LPChip Sep 01 '17 at 13:14
  • That basically, if I run the server from Hyper-V server 1, it gets ip address x... if it runs from Hyper-V server 2, it gets ip address y... – LPChip Sep 01 '17 at 13:16

1 Answers1

1

I've found a perfect way to sort the problem out.

I have 2 servers running inside a Hyper-V VM. I want to be able to setup it so that the server automatically gets a certain IP Address depending on if its my backup server or the main one.

This can be done by combining 2 functions: 1. Predefined MAC address for each VM 2. DHCP reservation based on MAC address.

If I need to switch servers, I can simply edit the MAC address of the second servers so they get the IP address of the first, then as I work on fixing the first server, give them the mac address of the backup so I can get them up and running and fix stuff.

If all is fixed, I shut everything down, swap the mac addresses, boot it all up and the IP addresses reverse. No need to play with port forwardings etc.

Its not the ideal situation with fall-back as I hope, but this is the closest I can come up with that seems to require the least effort. The backup server will already have the same mac address set but is simply powered off. If the main server goes down, I just boot it up for quick continuation. Then altering the mac address of the main park so they get a different ip address and I can continue to work, fix the issue, shutdown both servers, and alter the mac address back.

LPChip
  • 343