2

I have a machine A with local ip 192.168.0.199 - I want to clone all udp packets recieved on a local machine and forward to machine A

i tried the below in IP tables

sudo iptables -A OUTPUT -t nat -p udp -s 127.0.0.1 --dport 32000 -j TEE --gateway 192.168.0.199

on machine A - i start listening for UDP packets with netcat -l -u -p 32000

and on my local machine - i send a test udp packet

echo 'ved' | nc -u 127.0.0.1 32000

the packet seems to reach my local instance port but i cant seem to recieve the cloned packet on machine A -

Is there something else i need to be doing?

EDIT - so if i do a tcpdump on machine A - packets do seem to be arriving on the port - but not sure why this isnt captured by netcat - i tried listening on all interfaces as well

sudo tcpdump -n udp port 32000 -e

enter image description here

does seem to show incoming packets - but why isnt this captured by netcat

Could this have something to do with the source IP not being changed? tcpdump still shows 127.0.0.1 as the source IP

Jayaram
  • 153
  • 1
  • 1
  • 7

1 Answers1

0

So it looks like the problem was that the packets were getting dropped in machine A because the destination IP doesnt get changed by the TEE module

So in Machine As IP table - i had to run this sudo iptables -t nat -A PREROUTING -p udp --dport 32000 -j NETMAP --to 192.168.0.199

Jayaram
  • 153
  • 1
  • 1
  • 7