netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michele Codutti <michele.codutti@uniud.it>
To: Grant Taylor <gtaylor@riverviewtech.net>
Cc: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: [SOLVED] Re: ClusterIP and MAC NAT
Date: Mon, 08 Nov 2010 17:36:20 +0100	[thread overview]
Message-ID: <1289234180.6644.33.camel@nerino> (raw)
In-Reply-To: <4CC70D22.20109@riverviewtech.net>

> I have an install that is dealing with a cranky switch that can't see 
> the same MAC addresses on multiple VLANs where I am doing almost exactly 
> this for 30(ish) VLAN interfaces.  It has been in production for five 
> years and working great.  (Recently I upgraded the system, carrying the 
> old ARPTables / EBTables / IPTables scripts / configs forward.)
> 
> > Now the problem is with the arp queries. In need to "NAT" also the 
> > queries substituting the mac address also in the payload of the 
> > packet not only in the header. Can i do that?
> 
> You will need to use ARPTables to help EBTables with the ARP problem.  I 
> will go through my backups and see if I can't find an example set of 
> rules for you to gander at.
> 
> Here's a +1 on what you are wanting to do can be done and does work. 
> You just need to look at ARPTables to assist with the ARP specific problem.

Hello everyone today I managed to nat a multicast address of a clustered
ip. So I'm writing to the ML to keep track of the solution.
The servers and the bridges all are Debian Lenny with only packaged
software, the router is a Cisco 7200 VXR.
There are only 3 ebtables rules to do the trick:
   ebtables -t nat -A PREROUTING \
      --in-interface "$OUTERFACE" \
      --protocol arp \
      --arp-opcode Request \
      --arp-ip-dst "$ip" \
      --jump arpreply \
      --arpreply-mac "$UMAC_OUI:" \
      --arpreply-target DROP
   ebtables -t nat -A PREROUTING \
      --in-interface "$OUTERFACE" \
      --destination "$UMAC_OUI:$MAC_EUI" \
      --jump dnat 
      --to-destination "$MMAC_OUI:$MAC_EUI" \
      --dnat-target ACCEPT
   ebtables -t nat -A POSTROUTING \
      --out-interface "$OUTERFACE" \
      --protocol arp --arp-opcode Request \
      --arp-ip-src "$ip" \
      --jump snat \
      --snat-arp \
      --to-source "$UMAC_OUI:$MAC_EUI" \
      --snat-target ACCEPT
Where:
 - $ip is the cluster ip shared by servers;
 - $OUTERFACE is the interface of the bridge connected
   on router ethernet segment;
 - $MMAC_OUI is the multicast OUI part of the MAC address;
 - $MMAC_OUI is the unicast OUI part of the MAC address;
 - $MAC_EUI is the final part of the MAC address.

Special thanks to Grant Taylor.


  reply	other threads:[~2010-11-08 16:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 14:30 ClusterIP and MAC NAT Michele Codutti
2010-10-26 17:17 ` Grant Taylor
2010-11-08 16:36   ` Michele Codutti [this message]
2010-11-12 22:28     ` [SOLVED] " Grant Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289234180.6644.33.camel@nerino \
    --to=michele.codutti@uniud.it \
    --cc=gtaylor@riverviewtech.net \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).