Azure VM ICMP

Handian Sudianto 4,471 Reputation points
2024-07-19T05:49:08.16+00:00

Hello,

I need to check if our VM is having internet connection or not by running script to monitor status icmp reply to 8.8.8.8 for example. This iscript is running well on onprem vm but not on azure vm due in azure vm we can't do the icmp.

So it's possible to setup azure vm can do icmp to the internet?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,562 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,289 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 103.8K Reputation points MVP
    2024-07-19T06:45:05.4566667+00:00

    Hi @Handian Sudianto ,

    using ICMP in an Azure VM should be possible.

    As an alternative you can use the PowerShell cmdlet Test-NetConnection for testing.

    ping 8.8.8.8
    
    if ((Test-NetConnection -ComputerName 8.8.8.8 -Port 53).TcpTestSucceeded){
    Write-Host "Internet connection is working (tested Google DNS successfully)"}
    
    

    enter image description here


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten


1 additional answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 41,071 Reputation points Microsoft Employee
    2024-07-19T07:44:50.2833333+00:00

    @Handian Sudianto ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to know if you could make outbound ICMP Pings from an Azure VM.

    This is possible, provided you are "not" using Default outbound access.

    While there are different explicit outbound connectivity methods, only Standard Public IP can support outbound ICMP Pings.

    i.e.,

    • Associate a Standard public IP to any of the virtual machine's network interfaces (if there are multiple network interfaces, having a single NIC with a standard public IP prevents default outbound access for the virtual machine).

    Not Supported (even if they are explicit outbound connectivity):

    Kindly let us know if this helps or you need further assistance on this issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.