1

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!

  • This does not answer your question but it is related to SNMP problems where [IP Source Address](https://stackoverflow.com/q/53767608/3972710) matters – NGI Feb 16 '19 at 21:34
  • A quick search on other SO sites lead to [socat udp packet forwarding with source address](https://serverfault.com/a/697956/383881) – NGI Feb 16 '19 at 22:25

0 Answers0