pawn007

OpenVPN forward port iptables rules

Jan 4th, 2019
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. -A PREROUTING -d [interal ip] -p tcp -m tcp --dport 80 -j DNAT --to-destination [client_internal_ip]
  2. -A PREROUTING -d [interal ip] -p tcp -m tcp --dport 443 -j DNAT --to-destination [client_internal_ip]
  3. -A POSTROUTING -p tcp -m tcp --dport 80 -j MASQUERADE
  4. -A POSTROUTING -p tcp -m tcp --dport 443 -j MASQUERADE
  5. --get traffic back
  6. iptables -t nat -A POSTROUTING -p tcp -d [client_internal_ip] --dport 80 -j SNAT --to-source [internal ip]
  7. iptables -t nat -A POSTROUTING -p tcp -d [client_internal_ip] --dport 80 -j SNAT --to-source [internal ip]
  8.  
  9. Explain:
  10. ----This rule will forward 80 port to 192.168.42.10
  11. iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.42.10:80
  12.  
  13. ---but this is not enough If you want to get back traffic then you should add this rule
  14. iptables -t nat -A POSTROUTING -p tcp -d 192.168.42.10 --dport 80 -j SNAT --to-source 192.168.42.1
  15.  
  16. where ip address 192.168.42.1 is your iptables computer
  17. These two rules have to solve the task.
Advertisement
Add Comment
Please, Sign In to add comment