I am trying to use socat to redirect the traffic from UDP 162 to 10162 port. I can do so by using this:
sudo socat UDP4-RECVFROM:162,fork UDP4-SENDTO:localhost:10162
Then I am sending an SNMP trap to port UDP 162 from the host dummy.foo. The problem is that the UDP datagram comes as following:
PDU INFO:
notificationtype TRAP
version 0
receivedfrom UDP: [127.0.0.1]:46960->[127.0.0.1]:10162
errorstatus 0
messageid 0
community public
transactionid 8
errorindex 0
requestid 0
How can I "preserve" the sender IP address (dummy.foo) instead of showing the loopback interface (127.0.0.1)?
Thanks!