openrc-discuss

Re: openrc-0.5 new network

Roy Marples

Tue Nov 10 19:17:01 2009

On Saturday 07 November 2009 14:40:00 Roman wrote:
> Another question on that matter: What is the prefered way to automatically
> poweroff the wireless if i connect a lan-cable, so that always only one of
> the network interfaces is powered?

You could write a dhcpcd.exit-hook like so

#!/bin/sh

if [ "$interface" = lan0"]; then
   case "$reason"
      CARRIER) iwconfig wlan0 power off;;
      NOCARRIER) iwconfig wlan0 power on;;
   esac
fi

> 
> Currently i start ifplugd via local and basically the following
>  net-scripts:
> 
> net.eth0:
> start(){
> 	iwconfig wlan0 down;
> }
> ...
> 
> net.wlan0:
> start(){
> 	iwconfig wlan0 txpower 5
> 	wpa_supplicant ...
> }
> 
> this seems to work until i suspend the notebook. After resume i  have 2
> interfaces up again...

That works fine as well :)
Basically whichever of the two methods you prefer. I favour the dhcpcd hook 
route purely because ifplugd isn't needed.

Thanks

Roy

References:
openrc-0.5 new networkAlon Bar-Lev
Re: openrc-0.5 new networkRoy Marples
Re: openrc-0.5 new networkRoman
Archive administrator: postmaster@marples.name