4

I've got two Ubuntu-Servers, each of them with two Ethernet cards. I'm trying to switch from one to the other for high availability purposes. Unfortunately, when querying arp I always get the MAC address of the first card (eth0) and not the one of the second card (eth1) whose IP-address has been dynamically assigned. What can I do?

Example:

Server 1:

Eth0

  • MAC: 00:11:11:11:11:11
  • IP: 192.168.0.1

Eth1

  • MAC: 02:33:33:33:33:33
  • IP: 192.168.0.3

Server 2:

Eth0

  • MAC: 00:22:22:22:22:22
  • IP: 192.168.0.2

Eth1

  • down (goes up with MAC and IP from server1 eth1 when server1 goes down)

When I execute the arp -a 192.168.0.3 command from a Windows machine, the result is 00:11:11:11:11:11 (eth0) and not 02:33:33:33:33:33 (eth1)

splattne
  • 103
  • 4
dan
  • 41
  • 3

2 Answers2

2

What you're trying to do is not impossible, but not optimal neither...

Back in the XXth century, we used to do exactly what you're trying to do now, but now in the XXIst century, we use bonding which gives you both reliability and higher throughput when both cards are up.

So forget about 2 IP addresses on 2 NICS, go for 1 IP address on both NICS and take advantage of double the throughput!

:-)

Fabby
  • 34,341
  • 38
  • 97
  • 191
  • And as you've never accepted an answer on this site, don't forget to click the little grey checkmark to the left of this answer turning it into a beautiful green! **;-)** – Fabby Nov 04 '16 at 21:24
  • Thx for the answer, but I need high availability between two server and not between two NICs. I will switch the MAC and IP from eth1 server 1 to eth1 server 2 – dan Nov 07 '16 at 16:10
  • Are these 2 nics on 2 different switches? @dan – Fabby Nov 07 '16 at 20:03
  • No, they are on the same switch – dan Nov 08 '16 at 11:18
  • @dan then implement above solution: double the throughput and double the resilience . If on 2 different switches: yes you need 2 different IPs... – Fabby Nov 08 '16 at 17:41
0

What you are trying to do is called a "high-availability cluster". The basic idea of a high-availability cluster is that each cluster member has it's own IP address (usually used only for management) and the cluster has its own different IP address.

Usually this kind of setup is managed by dedicated software, but you can try to play with home-grown scripts.

Basically:

  • On each server, bond the two NICs, obtaining a highly available NIC on each server.
  • Assign the cluster IP to this new NIC on server A. Check that you can access the services.
  • De-assign the cluster IP from server A, assign it on server B. Check that you can access the services.

Now continue by figuring how to make sure that only one of the two servers has possession of the cluster IP, how to make sure that the server which does not have the cluster IP refuses to accept requests, how to synchronize the state between the servers etc. etc.

AlexP
  • 10,037
  • 1
  • 32
  • 39
  • This works. My problem is, that when I switch the ip, the switch don't clear the ARP Cache and g-arp doesn't work. For this, I try to switch the MAC Address with the IP Address from one server to the other. But the result from `arp -a` is the MAC Address from eth0 and not from eth1 – dan Nov 16 '16 at 08:47
  • Use `arping` to let the switch know of the new cluster interface? – AlexP Nov 16 '16 at 11:48
  • I use arping, but the switch doesn't accept these packages – dan Nov 16 '16 at 13:43