0

I am looking for a solution where TCP packets need to be forwarded or broadcasted to multiple destinations. Using nftables, I managed to forward packets to another machine with the following rule:

nft -- add chain ip nat prerouting { type nat hook prerouting priority -100 \; } nft add chain ip nat postrouting { type nat hook postrouting priority 100 \; } nft add rule ip nat prerouting tcp dport 9000 dnat to 172.19.0.2 nft add rule ip nat postrouting ip daddr 172.19.0.1 masquerade 

I am not sure how to forward the same packet to other destinations, for example, 172.19.0.2. I tried the rule nft add rule nat prerouting dport 9000 dup to 172.20.0.2 in various ways, but it did not work. Can anyone help with this? Or is there any similar tool in Linux that I can use to achieve the same result?

Note: I have tried socat in combination with tee. However, I am not considering that as an option since using the fork option creates numerous child processes if one of the destinations is down.

1
  • 3
    You can't. TCP is a point to point connection. It includes handshakes and positive connection setup between two points, not three or more. Thus you have to set up be connections, using a tool such as socat. Why do you want this? I smell a x-y question. Commented Mar 18 at 0:21

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.