Title: Automatic switch wifi/ethernet on OpenBSD | |
Author: Solène | |
Date: 30 August 2018 | |
Tags: openbsd70 openbsd networking highlight | |
Description: | |
Today I will cover a specific topic on OpenBSD networking. If you are | |
using a | |
laptop, you may switch from ethernet to wireless network from time to | |
time. | |
There is a simple way to keep the network instead of having to | |
disconnect / | |
reconnect everytime. | |
It's possible to aggregate your wireless and ethernet devices into one | |
trunk | |
pseudo device in failover mode, which give ethernet the priority if | |
connected. | |
To achieve this, it's quite simple. If you have devices **em0** and | |
**iwm0** | |
create the following files. | |
**/etc/hostname.em0** | |
up | |
**/etc/hostname.iwm0** | |
join "office_network" wpakey "mypassword" | |
join "my_home_network" wpakey "9charshere" | |
join "roaming phone" wpakey "something" | |
join "Public Wifi" | |
up | |
**/etc/hostname.trunk0** | |
trunkproto failover trunkport em0 trunkport iwm0 | |
autoconf | |
As you can see in the wireless device configuration we can specify | |
multiples | |
network to join, it is a new feature that will be available from 6.4 | |
release. | |
You can enable the new configuration by running `sh /etc/netstart` as | |
root. | |
This setup is explained in [trunk(4)](http://man.openbsd.org/trunk.4) | |
man page and in the | |
[OpenBSD FAQ](https://www.openbsd.org/faq/faq6.html#Wireless) as well. |