Score:0

How to redirect UPD packages targeted for other host to localhost

pk flag

I want to sniff UDP packages targeted at port 4500 flowing from machine A -> B with a physical TAP device and receive the sniffed packages on machine C on a local port (see image). enter image description here

About the TAP Device: This is a physical device which is placed in between A and B. The traffic between A and B is not modified at all but the packages are also sent to the TAP output interface to machine C (packages received on C are still addressed to B because the TAP is not doing modifications)

My goal is to receive all data which are targeted at port 4500 on machine C in client programs like netcat.

The problem obviously is, that packages received at the NIC of C are not targeted for C and therefore the packages are dropped before coming anywhere close to the applications layers of the OSi model.

What I've already tried is using nftables to redirect packages, but somehow my netcat still doesn't get messages. Can someone help me out what I'm doing wrong or suggest what the best way is to solve this?

nft 'add chain nat udpredirect { type nat hook prerouting priority -101 ; policy accept ; }'
nft 'add rule ip nat PREROUTING udp dport 4500 redirect'
Score:0
pk flag

Answer is here: https://serverfault.com/a/1125704/570881

The netdev family must be used to modify packages already early enough before the kernel drops them.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.