Skip to content

Instantly share code, notes, and snippets.

@twelvejie
Created May 10, 2024 09:59
Show Gist options
  • Save twelvejie/8a9aa3bd53b48b85017f9b535646b43e to your computer and use it in GitHub Desktop.
Save twelvejie/8a9aa3bd53b48b85017f9b535646b43e to your computer and use it in GitHub Desktop.

ssh端口转发 转发的端口:localhost:需要转发的端口

ssh -L  8086:localhost:8086 root@192.168.1.125

iptable端口转发 所有经过63306的流量转发到 192.168.1.2:3306

iptables -t nat -A PREROUTING -p tcp --dport 63306 -j DNAT --to-destination 192.168.1.2:3306

socat端口转发 所有经过81的流量转发到 127.0.0.1:80 应该可以用iptable实现

socat TCP-LISTEN:81,fork TCP:127.0.0.1:80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment