Skip to content

Public IPs

🎯 Lab Objectives

In this hands-on lab, you will learn how to:

  • Understand the purpose and types of Azure Public IP addresses
  • Manually provision Public IPs and Network Interfaces (NICs)
  • Associate Public IPs with NICs and attach them to Virtual Machines
  • Configure different SKUs and allocation methods for Public IPs
  • Test connectivity to VMs using the assigned Public IPs
  • Understand security implications of public IP assignment

Goal: Configure public IP connectivity for Windows and Linux VMs by creating and associating network components.


πŸ—οΈ Pre-Provisioned Environment

The following Azure resources have been pre-deployed in your environment:

Resource Overview

Resource TypeResource NameConfigurationPurpose
Resource GroupPublicIP-Lab-RGContains all lab resourcesLogical container
Virtual NetworkPublicIPLab-VNetAddress space: 10.0.0.0/16Network foundation
SubnetLabSubnetRange: 10.0.0.0/24VM network segment
Windows VMWinVMWindows Server 2019Target for RDP access
Linux VMLinuxVMUbuntu 20.04 LTSTarget for SSH access

Network Architecture

PublicIPLab-VNet (10.0.0.0/16)
└── LabSubnet (10.0.0.0/24)
β”œβ”€β”€ WinVM (No NIC/Public IP - to be configured)
└── LinuxVM (No NIC/Public IP - to be configured)

VM Details

VMOperating SystemDefault StateAccess Method
WinVMWindows Server 2019No public connectivityRDP (port 3389)
LinuxVMUbuntu 20.04 LTSNo public connectivitySSH (port 22)

πŸ” Note: VMs are deployed without NICs or Public IPs - you’ll create and attach these components during the lab.


πŸš€ Lab Exercises

Part 1: Create Public IP Addresses

Step 1: Navigate to Public IP Creation

  1. Open the Azure Portal
  2. Navigate to PublicIP-Lab-RG resource group
  3. Click + Create
  4. Search for β€œPublic IP address”
  5. Select Public IP address by Microsoft
  6. Click Create

Step 2: Create Windows VM Public IP

Configure the first Public IP:

SettingValueNotes
SubscriptionYour subscriptionPre-selected
Resource groupPublicIP-Lab-RGUse existing
NameWinVM-PublicIPDescriptive name
RegionSame as resource groupMust match VNet
IP VersionIPv4Standard protocol
SKUStandardRecommended for production
Availability zoneZone-redundantHigh availability
TierRegionalSingle region
IP address assignmentStaticPermanent IP

Step 3: Configure Additional Settings

SettingValuePurpose
Routing preferenceMicrosoft networkOptimal routing
Idle timeout4 minutesDefault value
DNS name labelwinvm-[your-initials]-[random]Optional: Creates FQDN
  1. Click Review + create
  2. Click Create

Step 4: Create Linux VM Public IP

Repeat the process with these settings:

SettingValueNotes
NameLinuxVM-PublicIPLinux VM identifier
SKUStandardSame as Windows VM
IP address assignmentStaticPermanent assignment
DNS name labellinuxvm-[your-initials]-[random]Optional FQDN

⏱️ Creation Time: Public IPs typically create within 1-2 minutes.


Part 2: Create Network Interfaces (NICs)

Step 1: Navigate to NIC Creation

  1. In PublicIP-Lab-RG, click + Create
  2. Search for β€œNetwork interface”
  3. Select Network interface by Microsoft
  4. Click Create

Step 2: Create Windows VM Network Interface

Configure the first NIC:

SettingValueNotes
SubscriptionYour subscriptionPre-selected
Resource groupPublicIP-Lab-RGUse existing
NameWinVM-NICWindows VM NIC
RegionSame as resource groupMust match VNet
Virtual networkPublicIPLab-VNetTarget network
SubnetLabSubnetVM subnet
Network security groupAdvancedConfigure NSG
Configure network security groupCreate newNew NSG for RDP

Step 3: Configure NSG for Windows

  1. Click Create new for NSG
  2. Name it: WinVM-NSG
  3. Add inbound rule:
SettingValuePurpose
SourceMy IP addressYour current IP
Source port ranges*Any source port
DestinationAnyAny destination
ServiceRDPRemote Desktop
ActionAllowPermit RDP
Priority1000Rule precedence
NameAllow-RDPDescriptive name
  1. Click OK to create NSG

Step 4: Associate Public IP

SettingValueNotes
Public IP addressAssociateEnable public IP
Public IP addressWinVM-PublicIPPreviously created IP
Private IP address assignmentDynamicDHCP assignment
  1. Click Review + create
  2. Click Create

Step 5: Create Linux VM Network Interface

Repeat the process with these settings:

SettingValueNotes
NameLinuxVM-NICLinux VM NIC
Virtual networkPublicIPLab-VNetSame network
SubnetLabSubnetSame subnet
Network security groupCreate new: LinuxVM-NSGSSH access
Public IP addressLinuxVM-PublicIPPreviously created

Step 6: Configure SSH Rule for Linux NSG

Add inbound rule for SSH:

SettingValuePurpose
SourceMy IP addressYour current IP
ServiceSSHSecure Shell
ActionAllowPermit SSH
Priority1000Rule precedence
NameAllow-SSHDescriptive name

Part 3: Attach NICs to Virtual Machines

Step 1: Stop Virtual Machines

  1. Navigate to WinVM
  2. Click Stop in the toolbar
  3. Wait for VM to fully stop (Status: Stopped (deallocated))
  4. Repeat for LinuxVM

⚠️ Important: VMs must be fully stopped (deallocated) before attaching NICs.

Step 2: Attach NIC to Windows VM

  1. Go to WinVM
  2. In the left menu, click Networking
  3. Click Attach network interface
  4. Select WinVM-NIC
  5. Click OK

Step 3: Set Primary Network Interface

  1. In WinVM networking settings
  2. Click WinVM-NIC
  3. Click Set as primary
  4. Confirm the action

Step 4: Attach NIC to Linux VM

  1. Go to LinuxVM
  2. In the left menu, click Networking
  3. Click Attach network interface
  4. Select LinuxVM-NIC
  5. Click OK
  6. Set LinuxVM-NIC as primary

Part 4: Test Connectivity

Step 1: Start Virtual Machines

  1. Navigate to WinVM
  2. Click Start
  3. Wait for VM to fully start
  4. Repeat for LinuxVM

Step 2: Get Public IP Addresses

  1. Click on WinVM-PublicIP
  2. Copy the IP address from the overview page
  3. Record: WinVM Public IP: _______________
  4. Repeat for LinuxVM-PublicIP
  5. Record: LinuxVM Public IP: _______________

Step 3: Test RDP to Windows VM

  1. Open Remote Desktop Connection on your local machine
  2. Enter the WinVM Public IP address
  3. Click Connect
  4. Use these credentials:
    • Username: azureuser
    • Password: LabPassword123!
  5. Expected Result: βœ… Successful RDP connection

Step 4: Test SSH to Linux VM

  1. Open Command Prompt or Terminal
  2. Run the SSH command:
Terminal window
ssh azureuser@[LinuxVM-Public-IP]
# Password: LabPassword123!
  1. Expected Result: βœ… Successful SSH connection

Step 5: Verify Network Configuration

From within each VM, verify the network setup:

Windows VM (Command Prompt):

Terminal window
# Check network configuration
ipconfig /all
# Test internet connectivity
ping 8.8.8.8

Linux VM (Terminal):

Terminal window
# Check network configuration
ip addr show
# Test internet connectivity
ping -c 4 8.8.8.8
# Check routing
ip route show

Part 5: Advanced Configuration & Testing

Step 1: Test DNS Resolution

If you configured DNS name labels, test FQDN access:

Terminal window
# Test with FQDN instead of IP
ssh azureuser@winvm-[your-initials]-[random].[region].cloudapp.azure.com

Step 2: Modify Public IP Properties

  1. Navigate to WinVM-PublicIP
  2. Click Configuration in the left menu
  3. Experiment with settings:
SettingOptionsImpact
AssignmentStatic vs DynamicIP persistence
Idle timeout4-30 minutesConnection timeout
DNS name labelCustom nameFQDN availability

Step 3: Monitor Public IP Usage

  1. In WinVM-PublicIP, click Metrics
  2. View available metrics:
    • Bytes In/Out
    • Packets In/Out
    • Port counts

πŸ”§ Troubleshooting Guide

Common Issues and Solutions

IssuePossible CauseSolution
Can’t attach NIC to VMVM not fully stoppedEnsure VM shows β€œStopped (deallocated)β€œ
RDP connection failsNSG rule missing/incorrectVerify RDP rule allows your IP
SSH connection failsWrong credentials/NSGCheck SSH rule and credentials
No internet from VMRoute table issuesCheck default route exists
Public IP not accessibleNSG blocking trafficReview inbound security rules

NSG Rule Verification

ProtocolPortSourceAction
RDP3389Your IPAllow
SSH22Your IPAllow
HTTP80Any (optional)Allow
HTTPS443Any (optional)Allow

πŸ§ͺ Additional Experiments

Try these optional exercises to deepen your understanding:

  1. Multiple NICs: Attach additional NICs to VMs
  2. Basic vs Standard SKU: Compare different Public IP SKUs
  3. IPv6 Support: Configure IPv6 public addresses
  4. Load Balancer Integration: Use Public IPs with load balancers
  5. NAT Gateway: Implement outbound-only connectivity

πŸŽ“ Key Takeaways

After completing this lab, you should understand:

  • Public IP addresses enable internet connectivity to Azure VMs
  • NICs (Network Interface Cards) connect VMs to virtual networks
  • NSG rules control traffic to public-facing resources
  • Standard SKU provides enhanced features and availability
  • Static assignment ensures IP addresses don’t change
  • DNS name labels provide user-friendly FQDNs
  • Security configuration is critical for public-facing resources

πŸ“Š Public IP Configuration Summary

SKU Comparison

FeatureBasic SKUStandard SKU
Assignment methodsDynamic, StaticStatic only
SecurityOpen by defaultSecure by default (NSG required)
Availability zonesNot supportedSupported
Load balancer supportBasic LB onlyBasic + Standard LB
CostLowerHigher

Allocation Methods

  • Static: IP address assigned permanently
  • Dynamic: IP address may change when VM is deallocated

πŸ“š Additional Resources