divzeroweb

2f30.org website
git clone git://git.2f30.org/divzeroweb
Log | Files | Refs | README | LICENSE

trunk.md (2396B)


      1 ### Trunk failover setup on OpenBSD
      2 
      3 I have a dedicated machine at home that I use mainly for sending and
      4 receiving e-mails.  The machine has one wired interface as well as a
      5 wireless interface.  My wired interface goes over a powerline adapter.
      6 For various reasons every once in a while, the powerline adapter loses
      7 sync and as a result I cannot access my machine remotely.
      8 One way to solve this problem is to take advantage of the wireless interface
      9 and transparently switch over to it whenever the wired interface becomes unavailable.
     10 To do this we'll use a simple form of interface aggregation, also known as
     11 trunk failover.  For the gory details please refer to:
     12 
     13     # man 4 trunk
     14 
     15 #### Setting up the interfaces
     16 
     17 /etc/hostname.alc0:
     18 
     19     up
     20 
     21 /etc/hostname.athn0:
     22 
     23     nwid <ESSID>
     24     wpakey <your-key>
     25     chan <your-channel>
     26     up
     27 
     28 /etc/hostname.trunk0:
     29 
     30     trunkproto failover
     31     trunkport alc0
     32     trunkport athn0
     33     inet 192.168.1.2 255.255.255.0 NONE media 100baseTX mediaopt full-duplex
     34 
     35 Setting up the wired and wireless interfaces is straightforward and not
     36 particularly interesting.
     37 Our trunk setup is using the failover mode and is specified via `trunkproto`.
     38 We have two allocated ports, the master port is hooked up to the wired interface
     39 and the failover port is attached to the wireless interface.
     40 In my setup I use a static IP address for the trunk interface but it is also
     41 possible to use DHCP.
     42 
     43 At this point restart the interfaces:
     44 
     45     # sh /etc/netstart
     46 
     47 #### Testing the trunk interface
     48 
     49 Generate some network activity by copying a large file via scp and pull the
     50 ethernet cable from your machine.  The copy operation might stall but it will automatically
     51 switch over to the wireless interface.  If you plug your ethernet cable back in
     52 it will switch to the wired interface.
     53 
     54 A sample ifconfig follows from my particular setup:
     55 
     56     trunk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
     57             lladdr 90:e6:ba:74:0e:38
     58             priority: 0
     59             trunk: trunkproto failover
     60                     trunkport athn0 
     61                     trunkport alc0 master,active
     62             groups: trunk egress
     63             media: Ethernet autoselect
     64             status: active
     65             inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
     66             inet6 fe80::92e6:baff:fe74:e38%trunk0 prefixlen 64 scopeid 0x5
     67 
     68 That's all :)
     69 
     70 Cheers!
     71 
     72 sin@