How to capture Microsoft 365 connection traffic using Wireshark
Overview
Microsoft 365 connectivity troubleshooting may require an in-depth look at the traffic packets between the client PowerShell modules or API components and Microsoft 365 cloud services. This article describes the steps required to collect traffic using Wireshark. Wireshark is an open-source network protocol analyzer recommended by Microsoft as a replacement for their tools. Learn more in: Microsoft Message Analyzer Blog. Refer to the steps below to use Wireshark to collect network traffic information required to troubleshoot connectivity issues.
Preparation steps
Download and install Wireshark from: https://www.wireshark.org/#download on the machine running the Cayosoft Administrator server.
-
While on the same server, open a command prompt and execute this command:
Copyping login.microsoftonline.comNOTE: The URL may differ depending on the original connectivity issue. Consult Cayosoft Support for details.
Copy the resolved IP address. The IP in the featured screenshot is 20.190.151.69.
-
Add the resolved IP to the
hostsfile:Run Notepad as administrator.
Open the %windir%\System32\drivers\etc\hosts file.
Add an entry for the resolved IP as follows: 20.190.151.69 ping login.microsoftonline.com
Save the
hostsfile.
Using Wireshark
Run Wireshark as administrator.
-
Set the filter to include only traffic to the IP resolved in the previous section using "host <ip address> and select the network interface used to connect to the Internet:
Start capturing packets by clicking Capture > Start or
Ctrl+E:-
Open a PowerShell prompt and run the test commands:
-
For example, to capture network operations when connecting from MSOL PowerShell module, execute this command:
CopyConnect-ExchangeOnline When prompted, login using the same Microsoft 365 account as used in the Cayosoft Administrator Service.
Execute:
Get-Mailbox
-
-
Return to Wireshark and stop the packet capture.
Go to File > Save, specify a location and file name, for example, MSOLtraffic.pcap.
Send this file to Cayosoft Support.
-
Remove the
login.microsoftonline.comentry from thehostsfile.Run Notepad as administrator.
Open the %windir%\System32\drivers\etc\hosts file.
Remove the new entry added in the preparation section.
Save the
hostsfile.
Comments
0 comments
Please sign in to leave a comment.