User Tools

Site Tools


docu:csheet:net:iptables:port_redirection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
docu:csheet:net:iptables:port_redirection [2020/02/06 23:27]
127.0.0.1 external edit
docu:csheet:net:iptables:port_redirection [2020/07/19 22:32] (current)
admin
Line 12: Line 12:
 <code bash> <code bash>
 # syntax # syntax
 +iptables -t nat -A PREROUTING -d [IN_IP] -p tcp --dport 3456 -j DNAT --to-destination 2.2.2.2:1234
 iptables -t nat -A OUTPUT -d [IN_IP] -p tcp --dport [PORT] -j DNAT --to-destination [TO_IP]:[TOPORT] iptables -t nat -A OUTPUT -d [IN_IP] -p tcp --dport [PORT] -j DNAT --to-destination [TO_IP]:[TOPORT]
  
 # example: # example:
 iptables -t nat -A OUTPUT -d 127.0.0.1 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:8080 iptables -t nat -A OUTPUT -d 127.0.0.1 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:8080
 +
 +# nat 1:1 port from public to private IP space
 +iptables -t nat -A POSTROUTING -j MASQUERADE
 +iptables -t nat -A PREROUTING -d [A_PUBLIC_IP] -p tcp --dport 222 -j DNAT --to-destination [LAN_IP]:22
 </code> </code>
docu/csheet/net/iptables/port_redirection.1581031676.txt.gz · Last modified: 2020/02/06 23:27 by 127.0.0.1