简体   繁体   中英

Azure Cloud Service connected with Azure Virtual Network - is the internal IP static or dynamic?

I have deployed cloud service (NOT virtual machine) and attached it to the virtual network that I've created with following cloud service configuration:

    <NetworkConfiguration>
    <VirtualNetworkSite name="MyVirtualNetwork" />
    <AddressAssignments>
      <InstanceAddress roleName="SampleAzureVpn">
        <Subnets>
          <Subnet name="Subnet-1" />
        </Subnets>
      </InstanceAddress>
    </AddressAssignments>
  </NetworkConfiguration>

When I enter the virtual network dashboard in Azure Management panel I can see that my instance has it's IP set to 192.168.176.133.

虚拟网络仪表板-资源

Now, the question is, is this the static IP, or can it change for given instance? I need to ensure that this IP doesn't change on instance reset etc.

I had the same problem with multiple instances.

As far as I know the ips are dynamic. That's for a good reason. When dynamically adding instances for different roles, prediction of the ips would be a configuration nightmare.

I solved it via an internal load balancer. Using an internal load balancer allows you to define one static ip address that takes into account that multiple web/ worker roles can be addressed from within the VPN. Have a look here internal load balancer overview

--- update ---

To clarify: Internal load balancers on web and worker roles do work, have a look onto the pieces you have to add to make it running. Unlike the ILB for virtual machines, you don't need Powershell, just configuration.

  1. put in the loadbalancer definition to your ServiceConfiguration.Cloud.cscfg:

     <LoadBalancers> <LoadBalancer name="loadbalancername"> <FrontendIPConfiguration type="private" subnet="subnet-name" staticVirtualNetworkIPAddress="{your static ip}" /> </LoadBalancer> </LoadBalancers> 
  2. Add your inputendpoint to the web/ workerrole in question in ServiceDefinition.csdef:

     <Endpoints> <InputEndpoint name="faredb-reader-ilb-endpoint-http" protocol="http" localPort="8080" port="8080" loadBalancer="loadbalancername" /> </Endpoints> 

You have to have the subset already configured as part of the ServiceDefinition.csdef. The static ip should be part of the subnet.

Please refer to this for some more information. I also had some trouble setting it up. Documentation is not that complete.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM