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

Re: RESOLVED: Learning ifpludg in CLI, WAS Re: laptop wireless setup, wpa_supplicant.conf, etc



On Tue 01 Nov 2011 at 09:05:36 -0700, keitho@strucktower.com wrote:

Below are some references. This post is a continuation of the postings
there.

http://lists.debian.org/debian-user/2011/10/msg02257.html
http://lists.debian.org/debian-user/2011/10/msg02567.html

> Here's the pertinent stanza from the /etc/network/interfaces file:
> 
> iface eth0 inet static
> wpa-debug-level 3

Did you really intend to put the second line here?

> post-up /sbin/ifdown eth1

I have reservations about this. Because eth1 is taken down wpa_cli is
unable to connect when the cable is unplugged. Which is why the
post-down line is needed. Also, it gets run in normal operation after
booting - which is unnecessary. But it should work.

Here is an alternative approach. This script is put in /usr/local/bin
and has permissions 744. It doesn't touch eth1 except during booting. Be
warned - I write terrible scripts!

   #!/bin/bash
   X=$(ps ax | grep exim | grep -v grep) # Machine booted? Why exim?!!
   L=$(ifplugstatus | grep eth1 | cut -d: -f2) # eth1 connected?
   if [ -z "$X" ] ; then
      until [ "$L" = " link beat detected" ] # Note the space after "
      do
          L=$(ifplugstatus | grep eth1 | cut -d: -f2)
      done
      wpa_cli -i eth1 disconnect
   else
      exit
   fi

The script is called by

   pre-up /usr/local/bin/script

> post-up /sbin/iwconfig eth1 txpower off

Have you a convincing reason for having this?

> post-down /sbin/iwconfig eth1 txpower on
> post-down /sbin/ifup eth1
> address 192.168.1.69
> netmask 255.255.255.0
> network 192.168.1.0
> broadcast 192.168.1.255
> gateway 192.168.1.1

A minor point: network and broadcast are not needed. ifupdown can work
out what they are from the other information.


Reply to: