How to assign public ip directly to virtual network interface (virtual machine)

John 0 Reputation points
2023-08-14T12:40:45.33+00:00

Hello!

How to assign public IP directly to virtual network interface (or virtual machine). I need it for IPsec that specifically does NOT work behind NAT (or if it does, Azure does not have the tools to work around that). Port mappings (forwarding) won't work. As an example on a simple VM - Oracle Virtualbox - there is the option to have a NAT network or Bridged network. I could not find any such function on Azure.

I could not find any instances mentioned here: https://learn.microsoft.com/en-us/answers/questions/938566/how-to-assign-public-ip-to-virtual-machine-scale-s

I also can't create a network interface without it being in virtual network. A virtual network also has to have a private address subnet. I am pulling out my hair. Please help me. Thank. You.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,399 questions
{count} votes

1 answer

Sort by: Most helpful
  1. msrini-MSFT 9,281 Reputation points Microsoft Employee
    2023-08-21T19:17:47.01+00:00

    Hi,

    In Azure, SDN takes care of the Public IP to the private IP mapping. Azure VM's guest OS doesn't even know its public IP. To create IPSEC tunnel, between your on-Prem and Azure VM, you can simply use the Public IP of your VM as peer and provide the IP address range of your VNET as the peer IP space.

    Regards,

    Karthik Srinivas

    0 comments No comments

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.