LoginSignup
4
0

More than 1 year has passed since last update.

Mosquitto 2.0 に外部からアクセスする

Posted at

Mosquitto 2.0 に外部からアクセスする方法です。

Ubuntu 21.04 に Mosquitto をインストールすると 2.0 系になります。

$ mosquitto -h
mosquitto version 2.0.10

mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.

インストールしたままでは、外部からアクセスができません。
次のようなログが出ます。

/var/log/mosquitto/mosquitto.log
1629166056: mosquitto version 2.0.10 starting
1629166056: Config loaded from /etc/mosquitto/mosquitto.conf.
1629166056: Starting in local only mode. Connections will only be possible from clients running on this machine.
1629166056: Create a configuration file which defines a listener to allow remote access.
1629166056: For more details see https://mosquitto.org/documentation/authentication-methods/
1629166056: Opening ipv4 listen socket on port 1883.
1629166056: Opening ipv6 listen socket on port 1883.
1629166056: mosquitto version 2.0.10 running

そこで、設定を変更します。

/etc/mosquitto/mosquitto.conf
(省略)
listener 1883
allow_anonymous true

mosquitto の再起動

sudo systemctl restart mosquitto

これで外部からのアクセスができるようになります。

参考ページ
Authentication methods

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0