Could You Please Tell Me Again How to Configure My OpenWrt?

Everytime a new OpenWrt release is out, I’ve the same question: How do I upgrade and reconfigure my wireless access point the exact same way it was before? Yeah, it sucks not being able to simply do a sysupgrade or a apt-get dist-upgrade and be done with it. But that’s how it works with OpenWrt: when you upgrade to a major release version, the configuration is gone.

Anyway, I do need a very simple configuration. It’s just that I never remember how to set it up. Hence, I’m dumping it in the blog so that next time it’ll be easy. Hopefully.

Scenario description

I want my access point configured as a Dumb Access Point. This means it will not do any routing, or provide any services such as DHCP or DNS. Instead, it’ll rely on those services being provided by a main router, to which it is connected to.

I have a small little box running OpenBSD that acts as a router, firewall, DNS and DHCP server, and a few other things. My wireless access point will simply connect to it through ethernet and transparently provide all these services through wireless (and through its other ethernet ports). This means that all devices connected to it will see any other devices connected to the main router (the OpenBSD box) as they will be in the same network.

Manual configuration

So, upgrading the access point firmware is really easy. I’ve used the web frontend (LuCI) just because it’s handy. I explicitly disabled keeping the configurations as the OpenWrt documentation states that this should be used only on minor updates. Which wasn’t the case.

Before rebooting into the new firmware, I disconnected the access point from the network (i.e. from the OpenBSD router) and connected my laptop to one of the ethernet slots (not the WAN one!). Then, I was able to ssh into the access point to start the configuration:

orpheu:~$ ssh root@

BusyBox v1.35.0 (2022-09-03 02:55:34 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 OpenWrt 22.03.0, r19685-512e76967f
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.

I followed the wise advice and changed the password for the root user.

Then, the configuration. Which is actually quite simple, although it took me some time to figure out. The only files I need to touch are /etc/config/network and /etc/config/wireless.

Here’s the network file:

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr ''
        option netmask ''

config globals 'globals'
        option ula_prefix 'fd7f:6a7a:db77::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1 eth0.2'
        option proto 'dhcp'

config device
        option name 'eth0.2'
        option macaddr 'a4:2b:b0:b2:89:bf'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4 6t'

The wireless file is much easier to understand:

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'pci0000:00/0000:00:00.0/0000:01:00.0'
        option channel '36'
        option band '5g'
        option htmode 'VHT80'
        option cell_density '0'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid '<my-ssid>'
        option encryption 'psk2'
        option key '<my-key>'

config wifi-device 'radio1'
        option type 'mac80211'
        option path 'platform/10180000.wmac'
        option channel '1'
        option band '2g'
        option htmode 'HT20'
        option disabled '1'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

That’s right, the AP has two radios, but I’m using a single one. Why should I use both? Actually, I should be using the second radio, with the 2G band as it probably saves a bit more energy.

Finally, I want to disable the DHCP servers (both v4 and v6) and the dnsmasq:

root@OpenWrt:~# /etc/init.d/odhcpd disable
root@OpenWrt:~# /etc/init.d/odhcpd stop
root@OpenWrt:~# uci set dhcp.lan.ignore=1
root@OpenWrt:~# uci commit dhcp
root@OpenWrt:~# /etc/init.d/dnsmasq disable
root@OpenWrt:~# /etc/init.d/dnsmasq stop

And done! Rebooting at this point made everything working as expected. And hopefully next time it won’t take me hours again to figure this out again.


Feel free to comment by sending me an email or pinging me at Mastodon.