22 April 2020

Azure IP Address Type Confusion

Azure throws IP addressing terms and mechanisms into a bit of a spin, and it is worth looking closely at the terminology used.


Those of us from a traditional infrastructure background remember two types of IP address allocation in earlier days:

  • Static
  • Dynamic


Static addresses were assigned to a network interface manually, by a server administrator. Dynamic addresses were distributed automatically, using the Dynamic Host Configuration Protocol (DHCP). There was actually a third, middle ground, called reservations. Reservations effectively ensured DHCP issued the same address to the same network interface every time, making it a dynamically configured static address of sorts.

Azure throws this into a bit of a spin for some techs, and it is worth looking more closely at the terminology used, as it seems familiar, but can mean different things to what one might otherwise assume.


So how does it work then?

At the OS level, Microsoft recommends that, except under very special circumstances, all network interfaces be set to use DHCP, so from the get-go, everything is dynamic to some degree.

At the Azure level, the terms private and public are applied, along with the terms static and dynamic.

Private IPs fall within the standard range of addresses reserved for private use:
  • 192.168.0.0 - 192.168.255.255 (65,536 IP addresses)
  • 172.16.0.0 - 172.31.255.255 (1,048,576 IP addresses)
  • 10.0.0.0 - 10.255.255.255 (16,777,216 IP addresses)
Public IPs are basically any address outside of those ranges. There are a few other reserved addresses, but we're not going to talk about those today.

In Azure, both private and public IPs can be either static or dynamic. However, the meanings for static and dynamic are not fully consistent between private and public addresses. 


Sum It Up


Here is the low down on how each configuration works within Azure:

Private IP
Static:

  • You select exactly which IP in the range you want.
  • Will it change? No. It will only be given back when the NIC it is assigned to is destroyed.
  • In the OS, NIC IP address is set to DHCP

Dynamic:

  • You let Azure select which IP in the range you get.
  • Will it change? No. It will only be given back when the NIC it is assigned to is destroyed.
  • In the OS, NIC IP address is set to DHCP

Public IP
Static:

  • You get whatever Azure allocates to you.
  • Will it change? No. It will only be given back when the Public IP Address resource it is part of is destroyed.
  • In the OS, NIC never sees this address. NAT is used to send traffic to the NIC's private IP address instead.

Dynamic:

  • You get whatever Azure allocates to you.
  • Will it change? Yes, potentially, but I don't remember the scenarios. I need to find out and edit this article.
  • In the OS, NIC never sees this address. NAT is used to send traffic to the NIC's private IP address instead.

Conclusion
So there you have it. Azure has four main types of IP address split between public and private, and dynamic and static. Understanding the difference is important, to ensure you get the result you want and don't waste time on tasks you don't need to. Now what happens if you want to assign multiple IP addresses to a single NIC? That's a question for another post.