Reader small image

You're reading from  Designing and Implementing Microsoft Azure Networking Solutions

Product typeBook
Published inAug 2023
PublisherPackt
ISBN-139781803242033
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
David Okeyode
David Okeyode
author image
David Okeyode

David is the EMEA Azure CTO at Palo Alto Networks. Before that, he was an independent consultant helping companies secure their Azure environments through private expert level trainings and assessments. He has authored two books on Azure security - "Penetration Testing Azure for Ethical Hackers" and "Microsoft Azure Security Technologies Certification and Beyond. He has also authored multiple cloud computing courses for popular platforms like LinkedIn Learning. He holds over 15 cloud certifications and has over a decade of experience in Cybersecurity (consultancy, design, implementation). David is married to a lovely girl who makes the best banana cake in the world. They love travelling the world together!
Read more about David Okeyode

Right arrow

Hands-on exercise – exploring private IP assignments

In this exercise, you will explore private IP assignment options for VNet resources. Here are the tasks that you will complete in this exercise:

  • Task 1 – deploying VMs with dynamic and static private IP assignments

Let’s get into this!

Task 1 – deploying VMs with dynamic and static private IP assignments

The steps are as follows:

  1. In the Azure Cloud Shell environment, enter the following commands to set the values that we will use for the following variables: resource group, location, VNet, subnet, and VM size. Replace the Standard_B2s value if you are using a different size than you verified in the previous exercise:
    group=CharisTechRG
    location=eastus
    VNet=CoreServicesVNet
    subnet=PublicWebServiceSubnet
    size=Standard_B2s
  2. Deploy a VM called WebVM0 into PublicWebServiceSubnet of CoreServicesVNet with the az vm create command. This will default to the dynamic private IP assignment method:
    az vm create -g $group -n WebVM0 --image UbuntuLTS --admin-username azureuser --generate-ssh-keys --VNet-name $VNet --subnet $subnet --size $size --public-ip-address ""

The following figure shows the output of this command. Ignore the warning about the public IP as the VM is created without a public IP assigned.

Figure 1.40 – VM creation with the default dynamic private IP assignment

Figure 1.40 – VM creation with the default dynamic private IP assignment

  1. Deploy a VM called WebVM1 into PublicWebServiceSubnet of CoreServicesVNet with the az vm create command. This time around, we will specify a static private IP assignment of 10.10.3.10:
    az vm create -g $group -n WebVM1 --image UbuntuLTS --admin-username azureuser --generate-ssh-keys --VNet-name $VNet --subnet $subnet --size $size --public-ip-address "" --private-ip-address "10.10.3.10"

The following figure shows the output of this command. Ignore the warning about the public IP as the VM is created without a public IP assigned.

Figure 1.41 – VM creation with the default dynamic private IP assignment

Figure 1.41 – VM creation with the default dynamic private IP assignment

  1. Review the private IP assignment of the VM network interfaces using the az network nic list command:
    az network nic list -g $group --query "[*].{NIC:name, PrivateIP: ipConfigurations[0].privateIpAddress, Assignment: ipConfigurations[0].privateIpAllocationMethod, IPVersion: ipConfigurations[0].privateIpAddressVersion}" -o table

The --query parameter is used to sort through the JSON array response to select the properties that we are interested in. The following screenshot shows what the output looks like:

Figure 1.42 – The VM NIC dynamic private IP assignment

Figure 1.42 – The VM NIC dynamic private IP assignment

Leave Cloud Shell open for the last exercise in this chapter.

Previous PageNext Page
You have been reading a chapter from
Designing and Implementing Microsoft Azure Networking Solutions
Published in: Aug 2023Publisher: PacktISBN-13: 9781803242033
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
David Okeyode

David is the EMEA Azure CTO at Palo Alto Networks. Before that, he was an independent consultant helping companies secure their Azure environments through private expert level trainings and assessments. He has authored two books on Azure security - "Penetration Testing Azure for Ethical Hackers" and "Microsoft Azure Security Technologies Certification and Beyond. He has also authored multiple cloud computing courses for popular platforms like LinkedIn Learning. He holds over 15 cloud certifications and has over a decade of experience in Cybersecurity (consultancy, design, implementation). David is married to a lovely girl who makes the best banana cake in the world. They love travelling the world together!
Read more about David Okeyode