Change subnet of the AutoPi Hotspot

Hi all,
I have been trying to change the subnet of the AutoPi’s own Hotspot, but without success. I would like to change the subnet from 192.168.4.0/24 to something like 192.168.3.0/24. The files that appear to be relevant to me are the /etc/dnsmasq.conf, /etc/dnsmasq.hosts and /etc/dhcpcd.conf. The changes I have tried so far in these config files are:

dnsmasq.conf:
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h → dhcp-range=192.168.3.2,192.168.3.20,255.255.255.0,24h
On line 18

dnsmasq.hosts:
192.168.4.1 local.autopi.io → 192.168.3.1 local.autopi.io

dhcpcd.conf:
static ip_address=192.168.4.1/24 → static ip_address=192.168.3.1/24
on line 63

When restarting the dongle I can log onto the hotspot, but can’t communicate with the AutoPi.
This is probably related to me not configuring dnsmasq in a correct way but I don’t understand how. The behavior expected is that the subnet for the uap0 interface is allocated to a new IP-space and that my connecting computer will be given a new IP-address for this subnet.

I know dnsmasq.conf is changed by the SaltStack. This might be the issue? How does one manipulate files in /etc by the use of SaltStack?

I’m using a Gen 2 AutoPi with software version: f0446804 with 4G/LTE capabilities, running AutoPi-core.

Update: When restarting the dnsmasq.service and dhcpcd.service the AutoPi gets the 192.168.3.1 IP-address for the uap0 interface, as well as the 192.168.4.1 address. When connecting with my computer to the AutoPi I get served an IP in the correct IP-address space. But in my routing table there is no defualt gateway. When I try to add 192.168.3.1 or 192.168.4.1 as default gateway it doesn’t work.

Routing table from computer connecting to AutoPi:
~ sudo route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 20600 0 0 wlp6s0
192.168.3.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp6s0
~ sudo route add -host default gw 192.168.3.1
~ sudo route add -host default gw 192.168.4.1
SIOCADDRT: Network is unreachable
~ sudo route  7
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 _gateway 255.255.255.255 UGH 0 0 0 wlp6s0
default _gateway 0.0.0.0 UG 20600 0 0 wlp6s0
192.168.3.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp6s0

Update 2:
Unlike the route command ip route show (from iputils2) does show a functioning route, with the correct subnet.

When checking the systemd logs of a boot with the new subnet configured, no errors could be detected. From what I could see in the logs dnsmasq and dhcpcd was functioning and acting properly with the new subnet. But I still can’t SSH or access the web interface for the AutoPi when changing the subnet of uap0.

Hey @sandorstorm!

Have you checked out our new DHCP settings in my.autopi.io? You can check the documentation for them here.

Best regards
Nikola

2 Likes

Hi @Nikola,
I have checked these settings and tried them without success. But it makes sense that it wouldn’t work just changing these settings at my.autopi.io.

As far as I’ve understood these settings change the behavior of the default DHCP-server, dnsmasq for AutoPi-core. The DHCP range setting corresponds to range setting in /etc/dnsmasq.conf and the DNS hosts setting corresponds to the /etc/dnsmasq.hosts.

While these settings will definitely change the subnet provided on the uap0 network interface they won’t change the statically set IP-address for the uap0 interface. From what I can see this IP (192.168.4.1) is set in the dhcpcd config file in /etc/dhcpcd.conf. If this isn’t changed to be within the subnet which is provided by dnsmasq it would mean that when connecting to the uap0 WiFi-hotspot the clients would have a default gateway on a different subnet than provided by DHCP-server. That doesn’t work.

Have I understood how the AutoPi-core works correctly? Or does the settings you mentioned automatically change the statically assigned IP-address for uap0 to a correct one?

Best regards,
Sandor

Hi @sandorstorm

Unfortunately the static ip_address=192.168.4.1/24 in dhcpcd.conf is not configurable from my.autopi.io at the moment. You can modify it manually but be aware that changes will be reverted during next update of release.

Best
Nikola

I see. But even when configuring everything manually the change of subnet doesn’t work.
I’m not able to SSH into the AutoPi or access local.autopi.io over WiFi.

There is also no indication of errors for dnsmasq or dhcpcd when checking the systemd logs so I’m really stumped what to do?

Best regards,
Sandor

This may be a red herring, but I took a look through the UI code a while back to see if I could work out how it functioned. I noted at least one occasion (in mainxxxxx.js) where the IP address 192.168.4.1 is hard-coded. On that basis, changing the subnet definition for uap0 is going to break things.

Ah, that explains some things. It would make sense that I would be served a correct IP-address in the subnet when connecting to the hotspot. But not be able to connect to the AutoPi because the software needs a ceartain IP-address set on uap0.

Hmm, maybe I could search through the git-repo of AutoPi-core to find all the instances of hardcoded IP-addresses.

Thank you so much!

Where is mainxxxxx.js located?

mainxxxx.js can be found in the root web directory: /var/www/html

The UI is in a different, private, repo on gitlab. the js is obfuscated.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.