In this tutorial, we will learn how to assign a fixed IP address to an Azure VM using the Azure admin interface rather than guest OS settings.
When deploying a virtual machine on a hypervisor, be it Hyper-V, VMware or another platform, it is customary to define the static IP address from the system parameters, in the interface options network. On Microsoft’s Azure Cloud, it’s different. It is recommended to set the static (primary) IP address in the Azure console so that the virtual machine inherits it, somewhat in the same spirit as a DHCP reservation. Although it is possible to set the IP address in the VM, it is a potential source of problems (poor configuration = total loss of connectivity).
By default, the Azure virtual machine has a dynamic IP address distributed according to the virtual subnet on which the VM is attached. This same virtual machine can also benefit from a public IP address, if it is activated in the options.
II. Azure VM: set a static IP address
In this example, we will configure a static IP address for the “SRV-ADDS-02” VM. From the Azure portal (portal.azure.com), navigate to the relevant resource, i.e. the virtual machine to be configured.
Within the settings of the “SRV-ADDS-02” VM, click on “Networking“left then”Network Interface: srv-adds-02162” on the right. Like this:
This allows toaccess the parameters of the network interface attached to this virtual machine. On the left, click on “Configurations IP“then on the line”ipconfig1” corresponding to the one and only network card of the VM.
Under the section “Private IP Address Settings“, we can see “Assignment: Dynamic“, which corresponds to the default configuration (IP address distributed by Azure DHCP). The idea is to switch to assignment mode”Static” then define the IP address to assign to the machine. In this example, it is the IP address “10.10.100.11“. Which give :
Validity. The default gateway and subnet mask remain inherited from the Azure subnet. Following this modification, the “SRV-ADDS-02” VM is accessible via its new IP address and the connection is operational.
III. Azure VM: use a custom DNS server
On this same VM, we can also modify the DNS parameters. Still in the network interface to attach to the VM “SRV-ADDS-02”, you must click on “DNS servers” on the left. By default, the VM inherits the DNS server configured in the subnet settings, as shown by the “Inherit from VNet“.
The objective is to modify this configuration so as to switch to “Custom“. Thus, in the section “DNS server” which is just below, we can add our own custom DNS servers.
Once it is done, you must validate. Again, the virtual machine will restart in order to apply the change. It may seem surprising, but it is not possible to do otherwise.
It’s done, your Azure virtual machine has a static IP configuration! You can use a static IP address, without using a custom DNS server to maintain your VNet’s legacy.
#configure #static #address