Created
October 18, 2018 05:06
-
-
Save bilxio/eeb7fa2d292d2169e8efd3b69fe0a5a4 to your computer and use it in GitHub Desktop.
TCP traffics forwarding via iptables-nat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 将 12XXX 端口转发至 100.XX.XX.XX:2XXX | |
| iptables -t nat -A PREROUTING -p tcp --dport 12XXX -j DNAT --to-destination 100.XX.XX.XX:2XXX | |
| # 将 100.XX.XX.XX:2XXX 回复的数据包源地址修改为 139.XX.XX.XX | |
| # 注意:如果是 ECS 等网卡不是公网地址的,请设置为网卡实际地址 | |
| iptables -t nat -A POSTROUTING -p tcp -d 100.XX.XX.XX --dport 2XXX -j SNAT --to-source 139.XX.XX.XX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment