Score:0

Linux VM movement between datacenters - different gateway IPs

us flag

I have three sites where Linux VM can move. The Linux VM has one NIC with one IP

Site A, Site B, Site C all have different gateway IPs. The last octet is incremented by one at each site (say 10.100.13.1, 10.100.13.2, 10.100.13.3). At each site the stretched VLAN is the same.

What is the most common "supported" way to dynamically set the gateway in linux based on proximity to a gateway? For example, when the VM is at Site A, it would use GW 10.100.13.1, but at Site B it would switch to 10.100.13.2 etc.

Michael Hampton avatar
cz flag
There is no "common" or "supported" way. This is a unique scenario for which you will have to devise a solution. It's also quite unusual. How is the VM supposed to know which environment it is in, so that it might change its gateway address?
in flag
There is several standard ways, rip, ospf, bgp, in this case a simple script to check MAC with arpping or just have one IP that is the same on all sites would probably be the easiest.
in flag
Not clear what you mean by 'site'. If you mean a separate physical network, then why not go with the Dynamic host configuration protocol (DHCP)? You can set reservations in your scopes if you need the VM to be at a specific IP. DHCP is used all over the place for doing IPv4 configuration. It is less common on servers, but that doesn't mean you can't use it on servers.
jc303 avatar
us flag
Site means a site like Aberdeen or Frankfurt these are geographically dispersed sites with Data Centers.
Score:-2
vn flag

If you want to delegate specific IP as specific domain name, open /etc/hosts and write lines like this

10.100.13.1  siteA
10.100.13.2  siteB
10.100.13.3  siteC
George Y avatar
vn flag
What is wrong with my answer, guys?
in flag
What is wrong with my answer,` - OP wants to set a default route per. Routes usually can't be based on DNS/name resolution. Also this doesn't really do anything so that the OS selects the correct route when the system boots on a given site.
George Y avatar
vn flag
@Zoredache That is already a bizarre request. Since None of you Can solve the problem - perhaps it is even unsolvable literally, my answer could provide a walk-around if reverse proxies such as nginx are set on those three IPs, isn't it?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.