Wifi-connect: Error: Cannot start HTTP server on '192.168.42.1:80': address not available

When starting wifi-connect service, I get the error below. Anyone know how to make it use another static IP address or use another IP address when this is unavailable, or pick another default IP address in general? It just gets stuck here and errors. I’m running this on a Raspberry pi 3b+ / Debian start.sh in a multi-container environment

wifi-connect Starting WiFi Connect wifi-connect WiFi device: wlan0 wifi-connect Access points: ["theInternet"] wifi-connect Starting access point... wifi-connect Access point 'WiFi Connect' created wifi-connect Starting HTTP server on 192.168.42.1:80 wifi-connect Error: Cannot start HTTP server on 192.168.42.1:80: address not available

Hi @mowi22,

You can control the portal gateway IP via either environment variables or command-line options, specifically using these options:

-g, --portal-gateway gateway, $PORTAL_GATEWAY
Gateway of the captive portal WiFi network
Default: 192.168.42.1

You can also change the listening port in a similar manner:

-o, --portal-listening-port listening_port, $PORTAL_LISTENING_PORT
Listening port of the captive portal web server
Default: 80

I hope this helps you!

1 Like

Thanks for the help, I was able to switch both via the service environment variables. However, it doesn’t matter what I change them to as the same error persists. When I check the network and there is nothing being used on those ports. Not sure how this is possible.

I found this article referencing a similar error
https://ubuntuforums.org/showthread.php?t=1473485

however, wifi-connect requires dnsmasq even though there seems to be a confilct between Network Manager’s use of dnsmasq-base and dnsmasq . I could be way off though. I can’t seems to find away around this issue. There have been tickets referencing this issue here. But no solution that I can understand at my level.

This could be an issue of timing as the dnsmasq is showing an error of dnsmasq: unknown interface wlan0 even though my ifconfig shows wlan0 interface is there.

wlan0 Link encap:Ethernet HWaddr B8:27:EB:DB:02:04 inet addr:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0 inet6 addr: fe80::8c1f:ab2:9f34:7152/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:815 errors:0 dropped:25 overruns:0 frame:0 TX packets:8448 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:135694 (132.5 KiB) TX bytes:1462230 (1.3 MiB)

This has been resolved by adding ‘network_mode: host’ to the docker-compose.yml.

1 Like

Thanks for the feedback! Yeah, that would do the trick of exposing wifi-connect to the outside world, and tap into the host OS’s networking. Will check with our team whether there’s anything that we might have missed in the documentation or can improve further.

1 Like