Forum SubscriptionsForum Subscriptions   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
cisco/vyatta VRRP incompatibility - MAC address

 
Post new topic   Reply to topic    Vyatta.org Forum Index -> Hackers
View previous topic :: View next topic  
Author Message
unrouteable
Elite Member
Elite Member


Joined: 01 May 2009
Posts: 83

PostPosted: Thu Apr 15, 2010 9:12 am    Post subject: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

The protocol standards for VRRP (and its Cisco-specific predecessor, HSRP) say that the virtual router IP address should be assigned a special MAC address, so that when there is a transition between the primary and backup routers, the other devices on the network do not need to learn a new MAC address to route traffic.

This is how the protocol is implemented on a Cisco router, and it works just great. When there is a router transition, your network switch learns that the MAC address has moved to a new port, and none of your computers on the network notice any problems.

Alas, Linux does not support using more than one MAC address on the same interface, so the Linux implementation of VRRP (used by Vyatta), keepalived, uses a "trick" instead - it issues gratuitous ARPs to all the hosts on the network whenever keepalived has transited to master or won a router election.

This is nowhere near as reliable as its supposed to be according to the standard - when using the virtual MAC address, only your network switch needs to do anything for a router transition. With the Linux keepalived, every host on your network needs to update their ARP tables for the transition to work.

I'm currently supporting a network that is converting from Cisco to Vyatta - the catch is, during the interim they're using the Cisco as the backup failover if something goes wrong with the Vyatta. But thanks to the non-standard VRRP implementation of Linux/keepalived, there are a few problems:

* when there is a transition from Cisco master to Linux master, some traffic gets lost until all the clients have updated their ARP tables, as the Cisco once it has resigned the master role will not accept traffic on the virtual MAC address that was formerly used for the master. Going the other way is OK as long as the Linux router is still up and routing, since out-of-date clients are sending to the same MAC address as the router's regular interface on that subnet, so it receives the traffic and routes it.

* sometimes the ARP tables of the network devices don't get updated fast enough, or don't get updated at all. If the transition was from the Cisco to the Linux router, then those devices are off the air. I'm still tracking this one down - I think the gratuitous ARP messages from the Linux box are either getting lost or ignored. It varies among different OS's - we haven't seen any Linux boxes fail to update their ARP caches, but have had trouble with Solaris and NetBSD.

Any ideas on how to make the Cisco/Vyatta VRRP work smoother?
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1284
Location: silicon valley

PostPosted: Thu Apr 15, 2010 9:30 am    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

unrouteable wrote:

Any ideas on how to make the Cisco/Vyatta VRRP work smoother?

I wonder if a mac-vlan could be assigned the vmac on state transition?

Anyway, just yesterday one of the keepalived developers mentioned that they're considering adding support for vmac.
http://sourceforge.net/mailarchive/message.php?msg_name=x2jf41ac2851004141123s3aa5cc35jc37b9d612090a870@mail.gmail.com
Back to top
View user's profile Send private message
unrouteable
Elite Member
Elite Member


Joined: 01 May 2009
Posts: 83

PostPosted: Thu Apr 15, 2010 1:12 pm    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

stig wrote:
unrouteable wrote:

Any ideas on how to make the Cisco/Vyatta VRRP work smoother?

I wonder if a mac-vlan could be assigned the vmac on state transition?

Anyway, just yesterday one of the keepalived developers mentioned that they're considering adding support for vmac.
http://sourceforge.net/mailarchive/message.php?msg_name=x2jf41ac2851004141123s3aa5cc35jc37b9d612090a870@mail.gmail.com


That should work, in theory (although in theory, everything works).
And it all seems doable inside transition scripts.

Looks like first do "insmod macvlan" followed by:

Code:

# ip link add link eth0 name eth0_macalias type macvlan
# ip link set eth0_macalias address 00:00:5e:00:01:XX


where XX is the hex number of the VRRP group.

Then we need another transition script to destroy the macvlan when the master resigns, which might be this code:

Code:

# ip link delete eth0_macalias


The above examples seem to work on the command line, but I haven't built the lab environment yet to test it. Will let you know.

Speaking of transition scripts, it doesn't look like there's a way to put parameters in the transition scripts, or any kind of environment vars that tell you what the virtual IP or interface is? As it stands now I have to write a separate transition script for each VRRP group (which gets old quickly, I've got a dozen or more), or do dirty tricks with the name of the script and symlinks.
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1284
Location: silicon valley

PostPosted: Thu Apr 15, 2010 1:31 pm    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

unrouteable wrote:
Speaking of transition scripts, it doesn't look like there's a way to put parameters in the transition scripts, or any kind of environment vars that tell you what the virtual IP or interface is? As it stands now I have to write a separate transition script for each VRRP group (which gets old quickly, I've got a dozen or more), or do dirty tricks with the name of the script and symlinks.
I haven't actually tested this, but perhaps this quick hack would be useful:
Code:
vyatta@R1:/opt/vyatta/sbin$ diff -u vyatta-vrrp-state.pl.bak vyatta-vrrp-state.pl
--- vyatta-vrrp-state.pl.bak    2010-04-15 14:26:26.000000000 -0700
+++ vyatta-vrrp-state.pl        2010-04-15 14:27:44.000000000 -0700
@@ -88,7 +88,7 @@
 }
 
 if (!($vrrp_transitionscript eq 'null')){
-    exec("$vrrp_transitionscript");
+    exec("$vrrp_transitionscript $vrrp_state $vrrp_intf $vrrp_group");
 }
Back to top
View user's profile Send private message
unrouteable
Elite Member
Elite Member


Joined: 01 May 2009
Posts: 83

PostPosted: Thu Apr 15, 2010 7:48 pm    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

stig wrote:
unrouteable wrote:
Speaking of transition scripts, it doesn't look like there's a way to put parameters in the transition scripts, or any kind of environment vars that tell you what the virtual IP or interface is? As it stands now I have to write a separate transition script for each VRRP group (which gets old quickly, I've got a dozen or more), or do dirty tricks with the name of the script and symlinks.
I haven't actually tested this, but perhaps this quick hack would be useful:
Code:
vyatta@R1:/opt/vyatta/sbin$ diff -u vyatta-vrrp-state.pl.bak vyatta-vrrp-state.pl
--- vyatta-vrrp-state.pl.bak    2010-04-15 14:26:26.000000000 -0700
+++ vyatta-vrrp-state.pl        2010-04-15 14:27:44.000000000 -0700
@@ -88,7 +88,7 @@
 }
 
 if (!($vrrp_transitionscript eq 'null')){
-    exec("$vrrp_transitionscript");
+    exec("$vrrp_transitionscript $vrrp_state $vrrp_intf $vrrp_group");
 }


Yes, that works very well! Thanks!
Back to top
View user's profile Send private message
unrouteable
Elite Member
Elite Member


Joined: 01 May 2009
Posts: 83

PostPosted: Thu Apr 15, 2010 7:54 pm    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

unrouteable wrote:


Looks like first do "insmod macvlan" followed by:

Code:

# ip link add link eth0 name eth0_macalias type macvlan
# ip link set eth0_macalias address 00:00:5e:00:01:XX


where XX is the hex number of the VRRP group.

Then we need another transition script to destroy the macvlan when the master resigns, which might be this code:

Code:

# ip link delete eth0_macalias


The above examples seem to work on the command line, but I haven't built the lab environment yet to test it. Will let you know.


Yes, it all seems to work, except I also had to do "ip link set eth0_macalias up". So it should be possible to provide Cisco compatibility by adding or removing the VRRP virtual MAC address in a transition script, where the transition script also does "arping -U -I eth0_macalias -s <VRRP-IP> <TARGET-IP>" for every TARGET-IP on different network switch segments (i.e. you don't need to bop every host on the LAN, just send out enough packets so that all your switches map the VRRP virtual MAC to the correct port).

This is still an awful kludge - hopefully the keepalived folks will make this unnecessary by adding the necessary functionality to keepalived.
Back to top
View user's profile Send private message
unrouteable
Elite Member
Elite Member


Joined: 01 May 2009
Posts: 83

PostPosted: Tue Jul 27, 2010 3:48 pm    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

unrouteable wrote:
stig wrote:
unrouteable wrote:
Speaking of transition scripts, it doesn't look like there's a way to put parameters in the transition scripts, or any kind of environment vars that tell you what the virtual IP or interface is? As it stands now I have to write a separate transition script for each VRRP group (which gets old quickly, I've got a dozen or more), or do dirty tricks with the name of the script and symlinks.
I haven't actually tested this, but perhaps this quick hack would be useful:
Code:
vyatta@R1:/opt/vyatta/sbin$ diff -u vyatta-vrrp-state.pl.bak vyatta-vrrp-state.pl
--- vyatta-vrrp-state.pl.bak    2010-04-15 14:26:26.000000000 -0700
+++ vyatta-vrrp-state.pl        2010-04-15 14:27:44.000000000 -0700
@@ -88,7 +88,7 @@
 }
 
 if (!($vrrp_transitionscript eq 'null')){
-    exec("$vrrp_transitionscript");
+    exec("$vrrp_transitionscript $vrrp_state $vrrp_intf $vrrp_group");
 }




Will the very effective and highly desirable patch above go into Larkspur? Wasn't there when I checked a couple of weeks ago.
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1284
Location: silicon valley

PostPosted: Sun Aug 1, 2010 10:14 am    Post subject: Re: cisco/vyatta VRRP incompatibility - MAC address Reply with quote

unrouteable wrote:
Will the very effective and highly desirable patch above go into Larkspur? Wasn't there when I checked a couple of weeks ago.
It didn't make it for the first beta, but I just committed it so it'll be in the final 6.1 version.
http://suva.vyatta.com/git/?p=vyatta-cfg-system.git;a=commitdiff;h=1b22d1bbcf8146736d9f69d1edb57a36e55f6fdc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Vyatta.org Forum Index -> Hackers All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum