VRRP & CARP with VMware Server

Trivia

Both the Common Address Redundany Protocol (CARP) and the Virtual Router Redundany Protocol (VRRP) map each virtual router instance to a mac address belonging to the IANA's ethernet address block (00:00:5e). The reserved block ranges from 00:00:5e:00:01:00 to 00:00:5e:00:01:ff (so you can not have more than 256 virtual routers per ethernet segment). For example, any ip address of a virtual router instance with an id of 23 is linked to the mac address 00:00:5e:00:01:17.
The routers itself communicate to each other by using the reserved multicast ip address 224.0.0.18, which is linked to the mac address 01:00:5e:00:00:12 (hint: hex(12) == dec(18)).

Symptom

At least, CARP with FreeBSD 6.2 does not work in VMware Server 1.0.4 running on Linux 2.6.22. The carp devices go into their desired states (MASTER here, BACKUP there), clients on the local net even receive arp replies for the virtual ip addresses, but you can neither ping nor use any services on these addresses.

Problem

The vmnet kernel module (part of the freely available VMware Server) drops any ethernet paket if the destination mac address is not

Additionally, the paket is let through if the interface is in promiscuous mode. But, IANA's block for VRRP is missing!

Solution

You have to recompile the vmnet kernel module after editing one of its source files, driver.c. Locate vmnet.tar (usally in lib/modules/source/ in your VMware Server directory), unpack it, change in the newly created directory, open driver.c, locate a function called VNetPacketMatch, add the following lines logically or'ed to the return statement:

((destAddr[0] == 0) && (destAddr[1] == 0) &&
 (destAddr[2] == 0x5e) && (destAddr[3] == 0) &&
 (destAddr[4] == 1))
Save driver.c, recompile (make vmnet.ko) and put it into /lib/modules/`uname -r`/misc/. Restart VMware and have fun with CARP & VRRP!

Acknowledgement

Thanks to VMware for such a great product and giving it to the masses!

Links