Auto Update HostFile

Jason Harding 1 Reputation point
2021-12-06T14:53:22.913+00:00

Hi there,

We have a scenario:

  1. On-Prem Server
  2. Azure VM

We have an Azure PtS VPN between the two above servers.
There is a piece of software on the VM that relies on communicating with the On-Prem.

The issue is, the IP that gets assigned to the VPN 'adapter' on the On-Prem when the VPN gets connected, changes between 6 values and I cannot reduce the subnet from /29 to /30 in the Azure VPN PtS config as /29 is the lowest value one can use.

In essence, is there a way to query an IP address assigned to the VPN adapter on the On-Prem and then updates the hostfile on the VM?
Or is there another way one can have multiple IP's for a single hostname in the hostfile and it rotates? Overall, need to find a way that keeps the HostFile on the VM updated with the IP from the VPN adapter on the physical.

Kind Regards,
Jason

Azure Dedicated Host
Azure Dedicated Host
An Azure service that provides a dedicated physical server to host Azure virtual machines for Windows and Linux.
43 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. msrini-MSFT 9,246 Reputation points Microsoft Employee
    2021-12-07T04:44:06.263+00:00

    @Jason Harding ,

    In On-Premises, write a script which performs "ipconfig/all" and parse the PPP adapter IP and store it in a location. Run this script every 30 mins or and keep updating the file in a Storage Account in Azure.

    From Azure, try to read the file in Storage Account and update the host name with this IP.

    Let me know if you have any questions.

    Regards,
    Karthik Srinivas

    0 comments No comments