I also tried reversing the order of the two rules. It seem the more specific rule should come first (as shown in my original post) but I figured I would try it.
The results are no better. It still doesn’t work.
I thought maybe there was a state table and resetting it would help. I tried:
iptables-save > /etc/sysconfig/iptables
service iptables restart
Thanks. I think I may have missed the “s” when I was transcribing this in my notes. I do have the full “–to-ports” syntax on both commands. Here is the exact syntax that is in the system.
I posted this question over at serverfaults.com. Someone was kind enough to help.
sudo yum update
sudo yum install conntrack
This utility shows the connection states. Restarting iptabes does not delete any connection state! conntrack -L will show that the state persist and if something was already being translated to upd/5000, it will continue until the sender stops sending packets and the state times out.
conntrack -F
…will flush the state table and cause the new PREROUTING REDIRECT rule to start working.
I don’t know of a way to do this without installing this additional utility.
Epic fail on iptable’s part. This should have been built into iptables. Full dumb.
Thanks for sharing ,
I haven’t had to work with PREROUTTING before in iptables. I’m learning something new also.
I was working the problem with Iptables in my lab. I did notice when I executed PREROUTTING config, and saved my configuration it showed in my iptables saved file. When I tried to remove PREROUTTING and then save my config again, it place it back in my configuration file.
For removing rules I found something that works 100%. First list all the rules, including their line number.
iptables -t nat -L -n -v --line-number
You find the line number of the rule you want to delete and then execute:
iptables -t nat -D PREROUTING {rule-number-here}
Works like a champ. I’ve never need to do the -F.
I’ve always been looking for a way to have different extractors for different types of devices, but hit a brick wall when I have multiple devices that all want to use udp/514. Now that I have the NAT REDIRECT working, sky is the limit.