Skip to content

Azure-Samples/network-java-use-network-watcher-to-check-connectivity

Repository files navigation

page_type languages products extensions
sample
java
azure
services platforms
Network
java

Getting Started with Network - Verify Network Peering With Network Watcher - in Java

Azure Network sample for verifying connectivity between two peered virtual networks using Azure Network Watcher.

Summary ...

- This sample uses Azure Network Watcher's connectivity check to verify connectivity between two peered virtual networks.

Details ...

1. Define two virtual networks network "A" and network "B" with one subnet each

2. Create two virtual machines, each within a separate network - The virtual machines currently must use a special extension to support Network Watcher

3. Peer the networks... - the peering will initially have default settings: - each network's IP address spaces will be accessible from the other network - no traffic forwarding will be enabled between the networks - no gateway transit between one network and the other will be enabled

4. Use Network Watcher to check connectivity between the virtual machines in different peering scenarios: - both virtual machines accessible to each other (bi-directional) - virtual machine A accessible to virtual machine B, but not the other way

Running this Sample

To run this sample:

See DefaultAzureCredential and prepare the authentication works best for you. For more details on authentication, please refer to AUTH.md.

git clone https://github.com/Azure-Samples/network-java-use-network-watcher-to-check-connectivity.git

cd network-java-use-network-watcher-to-check-connectivity

mvn clean compile exec:java

More information

For general documentation as well as quickstarts on how to use Azure Management Libraries for Java, please see here.

If you find bug in the sample, please create an issue here.

Start to develop applications with Java on Azure here.

If you don't have a Microsoft Azure subscription you can get a FREE trial account here.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.