This post is for setting up incus in laptop for testing. This post cannot apply to incusOS, as incusOS doesn’t have a shell. This post assume you run incus in a debian laptop, and your laptop only has a wifi card and doesn’t have other network cards.
As we know people run linux in laptop with desktop environment, to setup it read:
You can skip it if you don’t want DE in your laptop if you know how to use iw command.
A full DE comes with sound, please read:
You can skip it if you don’t want sound too.
Let’s start wireless part.
We need wifi card name to be persist, so use ip a to find out the name and mac address, my is wlo1, I will not tell you what my wifi card mac address is, let’s say it’s 11:11:11:11:11:11. Udev is the one takes charge of what device name is.
sudo nano /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="11:11:11:11:11:11", NAME="wlo1"
Prepare bridge. I only use ovs bridge, don’t ask me about linux bridge.
sudo apt install openvswitch-switch -y
sudo ovs-vsctl add-br ovsbr0
sudo ovs-vsctl add-port ovsbr0 host -- set Interface host type=internal
Prepare profiles.
We don’t need incusbr0 all the time, just need it to download some packages.
name: diskonly
description: disk for container
devices:
root:
path: /
pool: default
type: disk
This is for lan. Add it to the DE container too.
name: ovs0
description: lan bridge
devices:
eth1:
name: eth1
nictype: bridged
parent: ovsbr0
type: nic
This is for wifi. Under no circumstances, do not edit this profile when it’s added to a running instance.
name: wifi
description: wifi card
devices:
wlan0:
name: wlan0
nictype: physical
parent: wlo1
type: nic
If you edited, well, you won’t be able to see wlo1 in instance or host. You need to reload kernel module, but which one, use sudo lspci -v to find your wifi card, my module is iwlwifi. To reload it if your module is iwlwifi too:
sudo modprobe -rv iwlmvm
sudo modprobe iwlmvm
Now create an openwrt container, you can use pfsense, I won’t tell you how to create a VM, research it yourself. Do not add wifi profile now, or else you will lose network.
incus launch images:openwrt/24.10 ap -p diskonly -p ovs0
incus config device add ap eth0 nic network=incusbr0 name=eth0
incus exec ap ash
Now we are running commands in container.
opkg update
opkg find wifi | grep kmod
My module is iwlwifi, so kmod-iwlwifi.
opkg install iw wpad nano kmod-iwlwifi
Openwrt need iw for scanning wifi, need wpad for wifi encryption. I don’t like vi, so nano.
nano /etc/config/network
eth0 will be interface incus. eth1 will be interface lan, and use static address. Delete config globals ‘globals’ because we won’t use ipv6, or at least I won’t write ipv6 relate thing now.
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'incus'
option proto 'dhcp'
option device 'eth0'
config interface 'lan'
option proto 'static'
option device 'eth1'
option ipaddr '192.168.10.1'
option netmask '255.255.255.0'
Restart network. /etc/init.d/network reload
We need to edit firewall or else eth0 won’t be able to connect to incusbr0.
nano /etc/config/firewall
Just add this.
config zone
option name 'incus'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'incus'
Restart firewall. /etc/init.d/firewall reload
Openwrt is going to act as a nat router, so we need dhcp enabled.
nano /etc/config/dhcp
We only need to edit this part.
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
restart dnsmasq. service dnsmasq restart
And check net.ipv4.ip_forward is enabled.
cat /etc/sysctl.d/10-default.conf
Exit openwrt.
Enter DE container. You can see eth1 with ip a right? Most incus container use systemd for network. To bring eth1 up.
cp /etc/systemd/network/eth0.network /etc/systemd/network/eth1.network
nano /etc/systemd/network/eth1.network
[Match]
Name=eth1
[Network]
DHCP=true
[DHCPv4]
UseDomains=true
UseMTU=true
[DHCP]
ClientIdentifier=mac
systemctl restart systemd-networkd
Now DE’s eth1 should get ip from openwrt(ap). If not, please debug and post what you have done so I can help you. Now, exit DE.
Go back to openwrt(ap).
Remove incus from /etc/config/network and /etc/config/firewall, remember to reload.
Exit openwrt(ap), and stop it. Remove eth0.
In host, debian use /etc/network/interfaces to manage network. So comment out wifi setting and add this.
auto host
allow-hotplug host
iface host inet dhcp
Restart network. sudo service networking restart
Add wifi profile to ap, and start it. Now under no circumstances, do not use incus restart ap to restart it, use incus stop ap and incus start ap.
Get in openwrt(ap) again.
Run this to get /etc/config/wireless.
wifi config
If you know how to use iw command, you can config wifi now. But I don’t know, that’s why I tell you how to create a DE container.
Now we don’t need to use command line anymore, if you created a DE container.
In DE gui. Open a browser, go to http://192.168.10.1 , no password. Go to Network-Wireless. Choose a radio, click scan. Join a wifi.
Recommend to tick the ‘Replace wireless configuration’.
WPA passphrase is the password of the wifi you are connecting to.
Firewall zone is wan.
After save. You will land in the client Wi-Fi settings page. I changed nothing, just save. You can edit it, remember to read this link.
If you find something missing, just reply, I edited 3 posts today, I feel dizzy.