ctx->guides->trunk
Trunk failover setup on OpenBSD
I have a dedicated machine at home that I use mainly for sending and receiving e-mails. The machine has one wired interface as well as a wireless interface. My wired interface goes over a powerline adapter. For various reasons every once in a while, the powerline adapter loses sync and as a result I cannot access my machine remotely. One way to solve this problem is to take advantage of the wireless interface and transparently switch over to it whenever the wired interface becomes unavailable. To do this we'll use a simple form of interface aggregation, also known as trunk failover. For the gory details please refer to:
# man 4 trunk
Setting up the interfaces
/etc/hostname.alc0:
up
/etc/hostname.athn0:
nwid <ESSID>
wpakey <your-key>
chan <your-channel>
up
/etc/hostname.trunk0:
trunkproto failover
trunkport alc0
trunkport athn0
inet 192.168.1.2 255.255.255.0 NONE media 100baseTX mediaopt full-duplex
Setting up the wired and wireless interfaces is straightforward and not
particularly interesting.
Our trunk setup is using the failover mode and is specified via trunkproto
.
We have two allocated ports, the master port is hooked up to the wired interface
and the failover port is attached to the wireless interface.
In my setup I use a static IP address for the trunk interface but it is also
possible to use DHCP.
At this point restart the interfaces:
# sh /etc/netstart
Testing the trunk interface
Generate some network activity by copying a large file via scp and pull the ethernet cable from your machine. The copy operation might stall but it will automatically switch over to the wireless interface. If you plug your ethernet cable back in it will switch to the wired interface.
A sample ifconfig follows from my particular setup:
trunk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 90:e6:ba:74:0e:38
priority: 0
trunk: trunkproto failover
trunkport athn0
trunkport alc0 master,active
groups: trunk egress
media: Ethernet autoselect
status: active
inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
inet6 fe80::92e6:baff:fe74:e38%trunk0 prefixlen 64 scopeid 0x5
That's all :)
Cheers!
sin@