How do I get an iptables redirect to survive a reboot on SuSE 11?

0

I've set up iptables to forward from port 80 to port 8090:

iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8090

However the redirect is gone after rebooting. What's the canonical SuSE place to save iptables configs and where's the place to configure them to be reloaded on reboot?

Robert Atkins

Posted 2011-06-15T06:07:42.690

Reputation: 145

Answers

2

Tables are flushed after each reboot but there are ways to save the config and load it again at startup.

iptables-save > /path/to/file

To load the config you simply use:

iptables-restore < /path/to/file

The best way to load this is to put the restore command in the interface config; that way it will only load when your interface goes up.

Jonas N

Posted 2011-06-15T06:07:42.690

Reputation: 21

See edit, I was after a more detailed SuSE-specific answer. – Robert Atkins – 2011-06-16T09:35:47.830