Ping and Tracert commands on Azure VM
When data is sent over the Internet, it's sent in small blocks of data, called packets. Messages are divided into packets before they are sent, and each packet is then transmitted individually and can even follow different routes to its destination. Once all the packets forming a message arrive at the destination, they are recompiled into the original message.
Sometimes when you are trying to send or receive data over the Internet you may experience timeouts, or a Web server may be down, which prevents you from accessing services and Web sites. There are two common programs that can be used to test your Internet connection and even help you diagnose congestion between your computer (your ISP) and the destination server you're trying to reach. The programs you can use are called Ping and Traceroute.
The ping command is a very common method for troubleshooting the accessibility of devices. It uses a series of Internet Control Message Protocol (ICMP) Echo messages to determine Whether a remote host is active or inactive, the round-trip delay in communicating with the host and the packet loss.
The traceroute command is used to discover the routes that packets actually take when traveling to their destination. The device sends out a sequence of User Datagram Protocol (UDP) datagrams to an invalid port address at the remote host.
Now There might be a scenario, where you have to use these commands from Azure VM. ICMP support in Azure is blocked externally but you can allow ICMP on firewall rules in the VM and ping between VMs in the same cloud service or virtual network. If you wish to ping between Azure VMs and on-prem machines; then you can setup Point to Point IPsec tunnels or a Site to Site VPN, enable ICMP on both ends and ensure gateway-device firewall (or software VPN gateway) rules allow ICMP traffic (and have necessary routing table entries).
On more way is to use TCP for the same. There are few tools available for that which come in handy.
For Pinging –
PSPing –You just need to download, unzip and use it (copy it to your VM for outbound pinging).
For Trace route -
You can use a tool called NMAP. Again you need to download and install it. This also uses TCP port. What’s interesting is, it blocks some part of the route, maybe when it hits the datacenter.