Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to Tee udp packets onto a different host

I'm running some instances in Amazon's Virtual Private Cloud. One instance is inside a VPN only subnet ( connected to a corporate network ( I have no control over anything on the other end of the tunnel. I only control what's going on in the VPC.

There is a physical server that is sending UDP packets through the tunnel at a proxy server I'm trying to setup through iptables. I'm going to have several app servers in different environments that all need to receive these UDP packets (in the subnet). My first attempt at setting up iptables was:

iptables -t nat -A PREROUTING -s -p udp --dport 1360 -j DNAT --to --to

The problem is two fold. First iptables no longer supports multiple --to flags. And secondly, from my understanding it would have round-robin'd the destination but I need the UDP packets to go to both destinations simultaneously.

QUESTION: Given my constraints, how do I receive a UDP packet and send it simultaneously to two different destinations? I would prefer to keep it in iptables if possible.

EDIT (for clarification): I have UDP packets coming into the proxy (server A). I want that packet to be received by two other servers (B & C), and possibly others in the future. Source address of the UDP packets received by B & C is of no concern, and B & C will never need to send any kind of response back. This is strictly one way. Is this possible and if so how?

share|improve this question

marked as duplicate by Zoredache, Ward, mdpc, Michael Hampton, Khaled Jan 12 '13 at 7:26

This question was marked as an exact duplicate of an existing question.

Your problem isn't specified in enough detail to answer. Do you mean you want to send two copies of the unmodified packet to two destinations? Or do you mean you want to create two different packets with two different destinations? And, if the latter, what should happen if the destinations reply to those packets? – David Schwartz Jan 11 '13 at 22:11
@Zoredache I checked that question, and the associated answer. That is basically my question, but the link mentioned in that answer specifically states that "This will not work on recent kernels and is deprecated!" – Brandon Jan 12 '13 at 3:08
@DavidSchwartz I edited my post so hopefully it makes more sense now. – Brandon Jan 12 '13 at 3:15

If the packet is address to neither target, you'll have to NAT it to the first target, tee it so that it goes on towards that first target, and then NAT it to the second target.

If the packet is already to one of the targets, then just tee it to the target it is addressed to and then NAT it to the other.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.