1
votes

I have two Azure VMs behind the load balancer. VMs don't have any public IP, only LB has one static public IP address.

Sometimes VM gets outgoing public IP 13.93.5.128, which is not right. When I restart one VM, it gets right IP but second VM get this bad IP. It changes even without restart.

According this - https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-outbound-connections - I think I'm using Load-balanced VM (no Instance Level Public IP address on VM) (SNAT).

Trying outgoing IP with dig myip.opendns.com @resolver1.opendns.com .

How can I have outgoing IP for all VMs behind Load Balancer always the same (load balancer's one)?

1

1 Answers

0
votes

This maybe over elaborate for your requirements but if your VMs are hosted using ARM (as opposed to CLASSIC) then you can reserve a public IP address for the LOAD BALANCER. If you are unhappy with the allocated address for whatever reason reserve and allocate a new one.

Example

  • Create a resource group
  • Create a virtual network inside the resource group
  • Create a subnet inside the virtual network
  • Create a public IP
  • Create a load balancer under the resource group
  • Create Front-end IP pool inside the load balancer and assign the newly created public IP to it.
  • Create a Backend IP pool inside the load balancer
  • Create rules for the load balancer
  • Create Inbound NAT rules inside the load balancer
  • Create probes for the load balancer
  • Create a NIC under the resource group. NIC must be under the created Resource group, Vnet, and subet.
  • Also, it must be attached with the backend pool from the load balancer and the inbound NAT rules from the load balancer.
  • Create a new VM and attach the newly created NIC

Reference

These are worth reading:

https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-get-started-internet-arm-ps

https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-arm