Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. ssh remoteuser@40.40.40.40 -L 3306:127.0.0.1:3306 -N
  2.  
  3. $ mysql -udb_user -h127.0.0.1 -p
  4. Enter password:
  5. Welcome to the MySQL monitor. Commands end with ; or g.
  6. [...]
  7.  
  8. # iptables -t nat -A PREROUTING -d 40.40.40.40 -p tcp --dport 3306 -j DNAT --to-destination 127.0.0.1:3306
  9.  
  10. # iptables -L -t nat
  11. Chain PREROUTING (policy ACCEPT)
  12. target prot opt source destination
  13. DNAT tcp -- anywhere 40.40.40.40 tcp dpt:mysql to:127.0.0.1:3306
  14.  
  15. Chain INPUT (policy ACCEPT)
  16. target prot opt source destination
  17.  
  18. Chain OUTPUT (policy ACCEPT)
  19. target prot opt source destination
  20.  
  21. Chain POSTROUTING (policy ACCEPT)
  22. target prot opt source destination
  23.  
  24. #cat /proc/sys/net/ipv4/ip_forward
  25. 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement