can we have dynamic and static nat on vpn gateway together

56789 5 Reputation points
2024-08-09T09:25:27.6366667+00:00

Hi,

Question on nats on vpn gateway in azure:

Client source ip: 8.8.8.8/32

Azure VM 1: 10.180.10.1/27

Static NAT on vpn gateway :

Type:Static

Mode:EgressSnat

internal: 10.180.10.1/32

external: 2.2.2.2/32

So client can talk to 2.2.2.2/32 correctly fine (Traffic is always initiated from client source 8.8.8.8/32).

New requirement:

Azure VM 2: 10.180.10.2/27

Client Server: 9.9.9.9/32

Azure VM 2 needs to talk to 9.9.9.9/32 over vpn (Traffic will always be initiated from 10.180.10.2). Can i create dynamic nat like below and will it work?

Type:Dynamic

Mode:EgressSnat

internal: 10.180.10.0/27

external: 4.4.4.4/32

Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,543 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 46,016 Reputation points Microsoft Employee
    2024-08-09T10:56:46.9766667+00:00

    @56789 ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    From your verbatim,

    • You have an Static EgressNAT that translates 10.180.10.1/32 (Original Azure IP) to 2.2.2.2/32
      • Traffic is always initiated from OnPrem to 2.2.2.2/32 (Translated IP)
    • You have a new requirement to translate 10.180.10.2/27 to 4.4.4.4/32
      • This time, the Original Azure IP is a range (/27) and Translated IP is a single IP (/32).
      • And hence, you intend on using a Dynamic Rule

    From the docs,

    • About NAT on Azure VPN Gateway and
    • NAT on VPN FAQ
    • I don't see any limitation that a single Connection cannot have both Static Rule and Dynamic Rule
    • Only thing to note here is that When Dynamic NAT rules are used, traffic is unidirectional which means communication must be initiated from the site that is represented in the Internal Mapping field of the rule.

    Hope this helps.

    Should you face any problems, please do let me know

    Cheers,

    Kapil

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.