I have a device sending UDP syslog messages to my server on port 514. I have confirmed this traffic is reaching my server by checking with ifconfig as well as running my collector software under root for testing.
To avoid having to run my collector as root I want to forward incoming traffic on port 514 to something else. However for some reason I can't get IPtables to do this despite having used the same commands before with success.
Rules I created:
iptables -t nat -I PREROUTING --src 0/0 --dst 127.0.0.1 -p udp --dport 514 -j REDIRECT --to-ports 9901
and
iptables -I INPUT 1 -p udp -m udp --dport 9901 -j ACCEPT
What am I missing? As the collector is picking up the data when checking on port 514 (even with the above rules in place) I figure somehow IPtables if failing to forward the traffic.