This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Snat vs masquerating

what's the difference between


This thread was automatically locked due to age.
  • Good question!  I hope someone from Astaro will tell us how masquerading is done any differently in the Astaro than the following:

    Network definition: Internet = 0.0.0.0/0 bound to interface 'External'
    SNAT: 'Internal (Network) -> Any -> Internet' change source to 'External (Address)'.

    Cheers - Bob
  • Yes there is a difference. While your posted SNAT rule only translates the IP address, with Masquerading, IPs and Ports are _dynamically_ chosen at the Gateway to allow several connections from the same source port from different computers at once.

    Also, with SNAT, the Gateway has no clue where to send server responses to because the original client IP is not stored in the NAT table.

    Think of SNAT/DNAT/FNAT as a static translation.
  • Thanks, Mario, for the explanation of how Astaro does masquerading.  I'm confused about S/DNAT being static; if that's the case, then how can hundreds of public clients connect to an internal webserver via a DNAT from a public IP on an external Astaro interface?

    Cheers - Bob
  • Thanks, Mario, for the explanation of how Astaro does masquerading.  I'm confused about S/DNAT being static; if that's the case, then how can hundreds of public clients connect to an internal webserver via a DNAT from a public IP on an external Astaro interface?


    Hi Bob,

    Imagine clients A, B, and C connect to Web Server W.
    W is actually the firewall address.
    S is a DNAT'd web server behind the firewall.

    DNAT doesn't change the source address for A,B,C; it only changes the destination address. The server S still sees the source addresses for A, B, C, and the original client port #s.

    If the server needs to make outgoing connections, then SNAT should work for a single server, or MASQ for a server or network.

    Barry
  • See, Barry, that's the key question: isn't masqing just SNATting a subnet?  I bet that it appears the same from outside, but that doesn't mean that it's implemented the same way in the Astaro as the definition and SNAT in my post #2 above.

    Cheers - Bob
  • As Mario said, MASQ changes the source ports, whereas SNAT doesn't.

    I'm no expert; You might want to read the Linux kernel / netfilter site for more details, e.g. netfilter/iptables project homepage - Documentation about the netfilter/iptables project

    Barry
  • I don't think SNAT'ing a network would be reliable, if it works at all.

    Barry
  • Barry, if it didn't work, then you couldn't send HTTP traffic out a secondary WAN connection with SNAT, could you?

    I don't know the answer, I'm just trying to understand.

    Cheers - Bob
  • Not sure, but wouldn't policy routing work for that?

    Barry
  • Yeah, but isn't the "standard" approach, recommended in a knowledgebase article, the SNAT instead of a policy route?*

    Cheers - Bob
    * You're tempting me to ask how Astaro implements that differently, aren't you?...