Created
September 22, 2016 07:00
-
-
Save kingtuna/6d5165537307e309c1018efeb64b1423 to your computer and use it in GitHub Desktop.
iptables rules for forwarding all ports except 22 tcp and udp to an ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 1:21 -j DNAT --to-destination 192.168.250.133:8080 | |
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 23:65535 -j DNAT --to-destination 192.168.250.133:8080 | |
iptables -A PREROUTING -t nat -i eth0 -p udp --dport 1:65535 -j DNAT --to-destination 192.168.250.133:1024 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 1:21 -j DNAT --to-destination 192.168.250.133:8080
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 23:65535 -j DNAT --to-destination 192.168.250.133:8080
iptables -A PREROUTING -t nat -i eth0 -p udp --dport 1:65535 -j DNAT --to-destination 192.168.250.133:1024
iptables -t nat -A PREROUTING -p tcp --dport 1:21 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p tcp --dport 23:65535 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p udp --dport 1:65535 -j REDIRECT --to-ports 1024