Title : Automatic switch wifi/ethernet on OpenBSD
Author: Solène
Date  : 30 August 2018
Tags  : openbsd66 openbsd network highlight

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.




    join "office_network"  wpakey "mypassword"
    join "my_home_network" wpakey "9charshere"
    join "roaming phone"   wpakey "something"
    join "Public Wifi"


    trunkproto failover trunkport em0 trunkport iwm0

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.