NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Automatic switching between PPP, LAN, WLAN



Hi,

I'm currently experimenting to find a way to make my notebook always select
the best network connection possible. The priority should be:

1. LAN
2. WLAN
3. PPP (UMTS, LTE, etc.)

With LAN and WLAN alone I can use ifwatchd(8) calling scripts for carrier
and no-carrier detected, as suggested on hubertf's blog:
  http://www.feyrer.de/NetBSD/bx/blosxom.cgi/nb_20070816_1133.html

The following example works more or less.
gem0 is my LAN, bwi0 my WLAN interface:

---8<---
#!/bin/sh

case $0 in
*-up)
    pkill dhclient
    case $1 in
    gem*)
        logger LAN detected: stopping wpa_supplicant
        /etc/rc.d/wpa_supplicant stop
        ;;
    esac
    /etc/rc.d/network restart
    /sbin/dhclient $1
    ;;
*-down)
    pkill -x ssh
    case $1 in
    gem*)
        logger LAN disconnected: starting wpa_supplicant
        /etc/rc.d/wpa_supplicant start
        ;;
    esac
    ;;
*)
    logger "$0 $@": unknown
    ;;
esac
logger "$0 $@" done.
---8<---


With PPP as third option it is getting complicated. I have to make sure that
"/etc/rc.d/ppp start" is executed when both, LAN and WLAN lost carrier. And
"/etc/rc.d/ppp stop" must be run when one of LAN or WLAN is becoming
available again. How to do that?

Has anybody already worked out a good solution?

-- 
Frank Wille



Home | Main Index | Thread Index | Old Index