How to set up an MQTT Broker and Clients in Cisco Packet Tracer
Cisco Packet Tracer offers the opportunity to simulate IoT networks from version 7.1 onwards. As I tried my first steps with this simulation, I had trouble finding a way to set up MQTT Brokers and Clients on the devices, Cisco offers. If you just use the devices given and start a simulation, “IoT-TCP-Packets” are used and displayed. But Packet Tracer actually offers the option to use the MQTT protocol, and here’s how.
1. Setup your network with all the devices you need and make sure, they have a connection. In my case, I used the devices displayed and connected them via WLAN.
2. On the device that you want to use as a broker, e.g. a laptop or smartphone, you go to Desktop and start the User Apps Manager. Wait a short time, until it is fully loaded. Now you should be able to see an MQTT Broker app as well as an MQTT Client app, as shown below.
3. Choose the broker, click on install, close the User Apps Manager and you should see the icon of the MQTT Broker app on your desktop. Now you can start the broker and already give it all the information it needs.
Next, you will have to set up the clients. This is mostly similar to the broker, apart from some steps you have to take, before you can start the User Apps Manager.
4. When opening the device configuration, you won’t be able to see a desktop on any of the IoT devices. To change that, you click the Advanced button down on the right. After changing to the advanced mode, your window should look something like in this example of a lamp.
5. Now, go to the I/O Config tab. Here you will find an option called Desktop. Tick the checkbox, and a new tab Desktop should appear in the top navigation bar. Now you can proceed the same way as you did with the broker (step 2 and 3 in this article), only that you now should install the MQTT Client instead of the broker.
Given you use the right connection data and your network is configured correctly, the devices should be able to communicate with each other instantly. Now, MQTT packets should appear in simulation mode.
I hope, this helped you to start your simulation of an IoT network with Cisco Packet Tracer.