大网数据广告活动
服务器运维问答

DHCP reservations for same IP on first come, first serve, basis?

· 52CE 我爱测

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, bu…

问题原文

原帖链接 · LPChip · CC BY-SA 3.0

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 · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-08-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。