Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Should the inbound rule use --source-port, then? Commented Dec 30, 2017 at 8:59
  • I want to use source port, the issue is that the packet's source port is a random port. I'm trying to setup a rule so that the packet's source port is maintained when it leaves the client so that when it reaches the server it can be identified from other TCP traffic with different source ports. The SNAT rule doesn't seem to set the source port Commented Dec 30, 2017 at 9:02
  • I suppose you've already tried with MASQUERADE instead of SNAT? Commented Dec 30, 2017 at 10:19
  • I've looked into it, though I can't seem to figure out why/how to use it in this context. I thought it was for when the destination IP could change? My guess from your suggestion is to replace the SNAT rule with iptables -t nat -I POSTROUTING -j MASQUERADE? Commented Dec 30, 2017 at 15:05