Skip to content

Commit 300f4e4

Browse files
jasperjonkerfabiobaltieri
authored andcommitted
doc: net: mqtt: Add info for mosquitto >= 2.0
Provide information how to configure mosquitto >= 2.0 for the mqtt publisher sample. Secondly, how to configure ethernet interface in case the board is connected directly to the host computer through LAN. Signed-off-by: Jasper Jonker <jjasper.jonker@gmail.com>
1 parent 857adb2 commit 300f4e4

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

samples/net/mqtt_publisher/README.rst

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,38 @@ of this sample application (i.e., :zephyr_file:`samples/net/mqtt_publisher`) and
9797
:goals: build flash
9898
:compact:
9999

100+
If the board is connected directly to the Linux host computer through LAN,
101+
configure the network interface:
102+
103+
.. code-block:: console
104+
105+
$ IFACE=eth0 # Change this to the interface to which the LAN cable is connected
106+
107+
$ IPV4_ADDR_1="192.0.2.2/24"
108+
$ IPV4_ROUTE_1="192.0.2.0/24"
109+
110+
$ sudo ip address add $IPV4_ADDR_1 dev $IFACE
111+
$ sudo ip route add $IPV4_ROUTE_1 dev $IFACE
112+
$ sudo ip link set dev $IFACE up
113+
114+
You can run ``sudo ip addr flush dev $IFACE`` to undo the steps above.
115+
116+
.. note::
117+
For mosquitto 2.0 and up, ensure you set unauthenticated access by
118+
adding the following to the mosquitto configuration file ``mosquitto.conf``:
119+
120+
.. code-block:: none
121+
122+
listener 1883
123+
allow_anonymous true
124+
bind_interface eth0
125+
100126
Open another terminal window and type:
101127

102128
.. code-block:: console
103129
104-
$ sudo mosquitto -v -p 1883
130+
$ sudo mosquitto -v -p 1883 # For mosquitto < 2.0
131+
$ sudo mosquitto -v -c mosquitto.conf # For mosquitto >= 2.0
105132
106133
Open another terminal window and type:
107134

0 commit comments

Comments
 (0)