I'm trying to redirect a incoming udp traffic (514) to two ports (10514 and 10515) with iptables. On the man page of iptables-extensions for the target REDIRECT the syntax is "--to-ports port[-port]"
It is mentionned that you can specify a single port but also a range, but i can't manage to make it work on a range. It seem to only take the first port of the range.
The software is listening on the two ports
Here is the rules i am using and a iptables -nvL:
iptables -A INPUT -p udp --dport 10514 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p udp --dport 10515 -s 10.0.0.0/8 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p udp --dport 514 -j REDIRECT --to-ports 10514-10515
Chain PREROUTING (policy ACCEPT 1550 packets, 93888 bytes)
pkts bytes target prot opt in out source destination
424 72586 REDIRECT udp -- eth0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:514 redir ports 10514-10515
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
68854 14M ACCEPT udp -- * * 10.0.0.0/8 0.0.0.0/0 udp dpt:10514
0 0 ACCEPT udp -- * * 10.0.0.0/8 0.0.0.0/0 udp dpt:10515