Wireshark not capturing MQTT data over Ethernet with port mirroring

asked 2024-10-11 10:22:55 +0000

learner2424 gravatar image

I have a setup where I am using Mosquitto server and Node-RED on a single machine, which is configured with the machine's IP address. The connection is via Ethernet, and I have a switch and two machines connected to each other. The machines can ping each other without any issues.

To monitor the MQTT traffic, I used the port mirroring feature of my switch, and I mirrored the machine running Node-RED and Mosquitto (Port 1) to another machine where I have Wireshark (Port 8)installed.

However, when I start capturing traffic on Wireshark using the Ethernet interface, I don't see any MQTT traffic (no packets using port 1883). Here's a summary of my setup: - Mosquitto server and Node-RED on the same machine. - Machines connected through Ethernet, using a switch. - Port mirroring set up to mirror traffic to a machine running Wireshark. - Machines can successfully ping each other.

I expected to see MQTT data on Wireshark, but it's not showing up. What could be the reason for Wireshark not capturing the MQTT packets? Am I missing any configuration or step in Wireshark or port mirroring?

Things I've tried: - Checked the port mirroring configuration on the switch. - Verified that the machines are on the same network and can communicate (ping works fine). - Filtered for MQTT packets in Wireshark (mqtt or tcp.port == 1883).

Any insights or suggestions would be greatly appreciated!

edit retag flag offensive close merge delete

Comments

no, this is not a continuation

learner2424 gravatar imagelearner2424 ( 2024-10-11 10:33:32 +0000 )edit

Can you see the ping (icmp) traffic in the packet capture?

SYN-bit gravatar imageSYN-bit ( 2024-10-11 10:35:44 +0000 )edit

Yes I can see protocols such as ICMP(only when pinging from M1 to M2), ARP, STP.

learner2424 gravatar imagelearner2424 ( 2024-10-11 10:38:18 +0000 )edit

I assume either M1 or M2 is the Moquitto server?

Are you using any capture filters? Is there vlan tagging involved? Are you using encrypted MQTT (port 8883)? Are you using a custom port for MQTT? Do you see any other traffic between your test machine and the MQTT machine in the packet capture on the machine on port 8?

SYN-bit gravatar imageSYN-bit ( 2024-10-11 10:42:59 +0000 )edit
  • M1 is with mosquitto server and M2 is with wireshark
  • No I am not using any capture filters.
  • I am using MQTT on port 1883. Following are the steps i have taken with switch:
  • I am using 3COM 3CDSG8 managed switch. using console port I assigned IP to switch. the details are Ip:192.168.. subnet 255.255.. vlan id 1 , and then using gui of switch I port mirrored the data from port 1 to port 8.
  • Ip of both the machines are in same subnet.
learner2424 gravatar imagelearner2424 ( 2024-10-11 10:48:52 +0000 )edit

If the ping was done from the wireshark system (M2), then it was not in the packet capture because of the port mirror, but because of it being sent from the capturing machine. Can you attach a system (M3) to port 2 and do a ping from M3 to M1 and see if it is visible in the packet capture on M2? Then at least we know if it is a general port mirror issue or a specific MQTT issue...

SYN-bit gravatar imageSYN-bit ( 2024-10-11 11:21:33 +0000 )edit

I tried pinging M2(wireshark machine) from M1(machine with node-red and mosquitto) and i can see ICMP traffic in wireshark

learner2424 gravatar imagelearner2424 ( 2024-10-11 12:38:36 +0000 )edit

As you are capturing on M2, the ping from or to M2 will always be visible, whether or not the span/mirror port is working correctly. The interesting part is if a ping was done from M1 to another machine (M3) is visible on M2, as that would prove the span/mirror is working correctly.

Which system is sending receiving MQTT traffic to M1? And on which port is it connected to the switch?

SYN-bit gravatar imageSYN-bit ( 2024-10-11 13:47:49 +0000 )edit

I have a 8port switch. M1(on which MQTT is being generated) is connected on port 1 and m2(having wireshark) is connected to port8. Port 1 data is mirrored to port 8. I can see Icmp traffic in wireshark(M2) while pinging M3 from M1.

learner2424 gravatar imagelearner2424 ( 2024-10-11 14:25:02 +0000 )edit

I'm a bit confused, can you confirm both MQTT and Node Red are on the same machine and if so what the OS is on that machine?

grahamb gravatar imagegrahamb ( 2024-10-11 15:16:20 +0000 )edit

Yes, node-red and MQTT broker are on same machine running on windows operating system.

learner2424 gravatar imagelearner2424 ( 2024-10-11 15:22:54 +0000 )edit