Description
This guide is aimed at troubleshooting about Milesight gateway connect with ChirpStack platform failed problem.
Solution
Tip 1. Go to gateway web GUI: Maintenance > Tools > Ping, ping to ChirpStack server address to check the network status.
If ping is failed, refer to this troubleshoot the gateway network issues.
Note: When the network between the gateway and ChirpStack is fine or the ChirpStack server can ping to gateway IP address but gateway not, it likely caused by the firewall of ChirpStack server, you can check it by below command:
- Get firewall status: sudo ufw status
- Disable all firewall: sudo ufw disable
Tip 2. Access to gateway web GUI, go to Packet Forwarder > General, click edit, check all ChirpStack server settings are correct first.
Server address: The IP address or domain of ChirpStack server.
MQTT Port: Default port number is 1883. If it’s modified, fill the latest value in gateway also.
User Credentials: Disabled by default. If the server needs User Credentials, fill in account and password here.
TLS Authentication: Disabled by default. If the server needs TLS authentication, enable TLS authentication here.
Tip 3. Go to gateway web GUI: Maintenance > Log > Log Settings: change the Log Severity to Debug first, then wait for 10 mins later, download log file, and open ChirpStack-gateway-bridge.log to check.
Trouble Shooting Examples:
Symptom 1. Timeout or Connection refused
time="2021-12-14T19:34:22+08:00" level=error msg="integration/mqtt: connection error" error="Network Error : dial tcp 192.168.23.186:1886: connect: connection refused"
time="2021-12-15T11:28:16+08:00" level=error msg="integration/mqtt: connection error" error="Network Error : dial tcp 192.168.22.199:1883: i/o timeout"
Analysis: The ChirpStack IP address or MQTT port configured are unreachable.
Solution: Check network status between gateway and server, you can open ChirpStack mosquitto.conf file to check or modify MQTT port.
Symptom 2. Not Authorized
time="2021-12-15T16:23:00+08:00" level=error msg="integration/mqtt: connection error" error="Not Authorized"
time="2021-12-15T16:23:02+08:00" level=error msg="integration/mqtt: connection error" error="Not Authorized"
Analysis: The Chirpstack server has disabled “allow_anonymous” option, and create user credential to access. But user didn’t enable User credential option or filled in correct user name and password in Milesight gateway web GUI.
Solution:
1) Enable the user credential option, and filled in correct user and password.
2) If the password of user has been forgotten, please access to ChirpStack server, modify “allow_anonymous” as “true”.
Or find password_file path from mosquitto.conf file, then using below command to fill in a new password:
mosquitto_passwd -c {password_file path} {user}
And reboot ChirpStack server to make it effective:
mosquitto -c /etc/mosquitto/mosquitto.conf –d
Symptom 3. Connection reset by peer or x509 certificate signed by unknown authority
time="2021-12-15T17:52:27+08:00" level=error msg="integration/mqtt: connection error" error="Network Error : read tcp 192.168.23.143:57028->192.168.23.186:1883: read: connection reset by peer"
time="2021-12-15T17:33:02+08:00" level=error msg="integration/mqtt: connection error" error="Network Error :x509: certificate signed by unknown authority”
Analysis: TLS certification failed.
Solution:
1) Open ChirpStack mosquitto.conf file, if tls_enabled=false, disable TLS Authentication; if tls_enabled=true, check if there is any effective cert and key file path.
2) When TLS Authentication and CA signed Server certificate are selected, please ensure the CA file of ChirpStack was certified by an authoritative institution.
If ChirpStack do not have CA file certified by an authoritative institution, you need change Mode to “Self signed certificates”, and upload all files to solve that. Refer this to generate.