# Reliable and updatable access point

**URL:** <https://forums.balena.io/t/reliable-and-updatable-access-point/112981>\
**Category:** balenaOS\
**Created:** [May 13, 2020, 4:42pm UTC](https://forums.balena.io/t/reliable-and-updatable-access-point/112981 "2020-05-13T16:42:34Z")\
**Posts on this page:** 1\
**Showing post:** 92

<div class="post-metadata">

**Author:** ![MrBlenny](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mrblenny/32/4229_2.png) [@MrBlenny](https://forums.balena.io/u/MrBlenny)\
**Post date:** [July 28, 2020, 12:58am UTC](https://forums.balena.io/t/reliable-and-updatable-access-point/112981/92 "2020-07-28T00:58:07Z")

</div>

Thanks [bversluijs](https://forums.balena.io/u/bversluijs), very helpful. Combining that with some info above…

#### /mnt/boot/system-connections/balena-hotspot

```auto
[connection]
id=balena-hotspot
uuid=36060c57-aebd-4ccf-aba4-ef75121b5f77
type=wifi
autoconnect=true
interface-name=wlan0
permissions=
secondaries=

[wifi]
band=bg
mac-address-blacklist=
mac-address-randomization=0
mode=ap
seen-bssids=
ssid=MY_HOTSPOT_SSID

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=rsn
psk=MY_HOTSPOT_PASSWORD

[ipv4]
dns-search=
method=shared

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

```

### docker-compose.yaml

```auto
version: "2.1"
services:
  dnsmasq:
    build: ./dnsmasq
    container_name: dnsmasq
    restart: always
    network_mode: host
    entrypoint:
      - sh
      - ./start.sh
    cap_add:
      - NET_ADMIN

```

#### Dockerfile

```auto
FROM balenalib/debian:stretch

RUN apt-get update
RUN apt-get install -y dnsmasq
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

COPY dnsmasq.conf /etc/dnsmasq.conf
COPY start.sh start.sh

```

#### start.sh

```auto
echo "Starting dnsmasq - $(date)"

dnsmasq \
  --address=/#/10.42.0.1 \
  --dhcp-range=10.42.0.1,10.42.0.254 \
  --dhcp-option=option:router,10.42.0.1 \
  --interface=wlan0 \
  --keep-in-foreground \
  --bind-interfaces \
  --except-interface=lo \
  --conf-file \
  --no-hosts \
  --log-facility=-

tail -f /dev/null

```

## Some issues

When the entrypoint initialises, it says:

```auto
dnsmasq: unknown interface wlan0

```

Running `nmcli` on balena root suggests this does indeed exist. Maybe an execution order issue…

```auto
# nmcli
wlan0: connected to balena-hotspot
        "Ralink n"
        wifi (rt2800usb), 9C:EF:D5:FB:C1:D4, hw, mtu 1500
        inet4 10.42.0.1/24
        route4 10.42.0.0/24
        inet6 fe80::4da7:5750:80d8:2c99/64
        route6 fe80::/64
        route6 ff00::/8
...

```

If I run the dnsmasq command again it will says:

```auto
dnsmasq: failed to create listening socket for 10.42.0.1: Address already in use

```

In any case, its not quite working. Visiting a domain, eg) `thing.local` does not route to `localhost:80` on the balena device.

I have tried changing the `[ipv4]` hotspot settings to `method=manual` but if I do that, the hotspot does not seem to be initialised (I can’t see it on my client device).

Any ideas what the issue may be?

### EDIT:

I have been able to make it work by delaying the dnsmasq command a few seconds to avoid `unknown interface wlan0` and also changing the IPV4 config:

```auto
[ipv4]
address1=10.42.0.1/24
dns=127.0.0.1;1.1.1.1;
dns-search=
method=manual

```

Thanks for your help!

---

_[View the full topic](https://forums.balena.io/t/reliable-and-updatable-access-point/112981)._
