I installed the Mosquitto MQTT on my Pi and I want to test it on my Windows via Putty.

What is my MQTT server IP address and port ?

I tried ifconfig but it shows:

 inet addr : as hex like fe80::465d.... etc.
  • Which MQTT (mosquito) or some other implementation? can you post your /etc/network/interface file
    – Shan-Desai
    Mar 10, 2017 at 13:50
  • Sorry i forgot it. Its mosquitto
    – PBSDR
    Mar 10, 2017 at 14:07
  • I think you do not have any IP address, your server is binded on the localhost something like or ::1. the fe80:: is your IPv6 Link-Local Address.
    – Shan-Desai
    Mar 10, 2017 at 14:12
  • So what should i enter to puttys ip area ?
    – PBSDR
    Mar 10, 2017 at 14:14
  • add the IP address of the Pi in your /etc/mosquitto/mosquitto.conf file and it will be a server with that particular IP
    – Shan-Desai
    Mar 10, 2017 at 14:22

1 Answer 1


According to the man page for Mosquitto It is dominated by a Configuration file which is /etc/mosquitto/mosquitto.conf.

According to the man page for the mosquitto.conf:

bind_address address

Listen for incoming network connections on the specified IP address/hostname only. This is useful to restrict access to certain network interfaces. To restrict access to mosquitto to the local host only, use "bind_address localhost". This only applies to the default listener. Use the listener variable to control other listeners.

listener port [bind address/host]

Listen for incoming network connection on the specified port. A second optional argument allows the listener to be bound to a specific ip address/hostname. If this variable is used and neither the global bind_address nor port options are used then the default listener will not be started.

The bind address/host option allows this listener to be bound to a specific IP address by passing an IP address or hostname. For websockets listeners, it is only possible to pass an IP address here.

Hence your current IP address is the localhost IP address generally for IPv4 and or ::1 for IPv6. This can be seen from ifconfig lo.

Default port number for mosquitto is 1883 according to the man page

fe80:: addresses are IPv6 Link-Local Addresses which exist for each IPv6 enabled device on your Pi.

It is recommended to change the IP address and port values in your mosquitto.conf for your desired functionality and restart mosquitto again:

 /etc/init.d/mosquitto restart
  • I added "bind_address" and "listener port[]" to mosquitto.conf file . I restarted service and when i try to sub and pub to topic it says "Error:Connection refused" .
    – PBSDR
    Mar 11, 2017 at 8:09
  • 1
    Okay i changed ssh settings to enabled in preferences/interfaces menu. It's solved. Also added pi@ before ip address . Thanks a lot!
    – PBSDR
    Mar 11, 2017 at 8:26
  • If you think the answer is what you wanted then accept it for future reference.
    – Shan-Desai
    Mar 11, 2017 at 8:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.