LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   packet cloning and routing with single NIC (https://www.linuxquestions.org/questions/linux-networking-3/packet-cloning-and-routing-with-single-nic-500353/)

gianman 11-10-2006 10:33 AM

packet cloning and routing with single NIC
 
Hi,
I need help to setup a linux box with a single NIC to solve this problem:
On the same LAN ( 10.10.10.0) there are one ethernet device and 2 PCs connected with a switch.
The device act as a server on port 5000 but can accept only 1 connection ( unfortunately is proprietary software...)
Te PCs are windows machine, and works in mirror, for redundancy purpose, and they must have the same data input from the server, but for the server limitation, only one of them can connect to.

the idea is to put a linux box with its NIC connected to the switch on the same LAN, in order to receive packets from PCs and route them to the device and viceversa, take the packet from the device and route to both PCs.
I've seen the iptables, I'm completely new about it, so I ask help...

First problem:
I'm triyng to realize the ip and port redirection from Pc to device using PREROUTING and DNAT, but it doesn't work...
10.10.10.2 : device ip
10.10.10.3 : Pc1 ip
10.10.10.4 : Pc2 ip
10.10.10.10 linux box ip

PC1 connection on linux box is on port 5500
PC2 connection on linux boxis on port 5501

iptables -D PREROUTING -t nat -p tcp -d 10.10.10.10 --dport 5500 -j DNAT --to 10.10.10.2:5000
iptables -D PREROUTING -t nat -p tcp -d 10.10.10.10 --dport 5501 -j DNAT --to 10.10.10.2:5000

this rules works only for port redirection, not for IP redirection...
where am I wrong?

Second problem:
I have no idea on how realize the data flow Device --> PCs , cloning the packet from the device.
Infact each PC must have the same tcp packet in input to work for redundancy.
I'have seen the mangle -tee option, but I'm quite confusing on how to use it.
Can someone clarify ( maybe with some examples..)?

Is there any other way to do this job?

Tnks


All times are GMT -5. The time now is 09:18 PM.