iptables

* In the text below the single ‘-‘ in front of long option should be double ‘-‘, such as -dport should dash-dash-dport. WordPress messed up with double dashes.

. redirect all traffic destined to port 80 to port 22 only from a specific IP address
iptables -t nat -A PREROUTING -p tcp –dport 80 -s 127.1.1.2 -j REDIRECT –to-ports 22

. redirect all traffic destined to port 80 to port 22 only from a specific MAC address
iptables -t nat -A PREROUTING -p tcp –dport 80 -m mac –mac-source 00:06:5B:95:89:41 -j REDIRECT –to-ports 22

. list all rules in nat table
iptables -t nat -n -L

. delete rule 1 in nat table on PREROUTING chain
iptables -t nat -D PREROUTING 1

Leave a Reply