angelnu / pod-gateway

Container image used to set a pod gateway
Apache License 2.0
56 stars 29 forks source link

Add option to use SNAT instead of Masquerading #41

Closed antoncuranz closed 12 months ago

antoncuranz commented 1 year ago

Description of the change

I introduced a new variable _SNATIP. If set to a source IP, the outbound NAT will be configured to use SNAT instead of masquerading.

Can be tested with port-checker as described in the gluetun-wiki. This verifies that the port-forwarding works and responds with the incoming IP address.

Benefits

Possible drawbacks

None, as SNAT will only be used if explicitly configured.

Applicable issues

Additional information

I don't know why SNAT seems to have a positive impact on p2p performance. Maybe someone else has some insights?

Ruakij commented 5 months ago

Hey, I dont understand why a blanket masquerade is used instead of a more refined one towards the VPN/Outgoing-Interface (or atleast NOT masquerading towards the local vxlan network)?

That way outgoing traffic gets masqueraded, but incoming ones keeps their source. This should work perfectly fine? Its kind of an expectation of forwarded traffic to be routed as-is with only DNAT being applied. (at least for me)

I think we should have an option to either:

angelnu commented 5 months ago

Masquerading everything is a safe default because it cal also help when the internal k8s network overlap with the vpn network.

This being said i see the value of adding options as you propose. So if you are able to raise a PR we can add it.