[lug] Panera wireless using Fedora

Michael J. Hammel mjhammel at graphics-muse.org
Sun Jun 14 19:05:38 MDT 2009


I've kind of put up with this since F7 and now I'm tired of just
settling.  So I'm asking for help on how to get this working.

I have wireless working on my laptop at home under F11.  No problem.  I
have it configured using the "System->Administration->Network" UI.  I
use that to start and stop it as needed.  I do not use NetworkManager (I
disable it).  I use the "network" service instead.  I have an ipw2200
based wireless hardware (Intel Corporation PRO/Wireless 2200BG
[Calexico2]).  It is configured using WEP through a Linksys router.

But I can never get wireless working at free wifi spots, like Panera.
I've tried the UI method and I've done it by hand using iwlist scan to
get the details and iwconfig to manually configure the device.  It
almost never works.  Panera never works.  The local library works but
only randomly.  The UI pops up error messages when I try various
configurations but the pop up dialog close so fast there is no way to
read the error messages.  Based on experiments from the command line it
looks like invalid arguments to iwconfig.

What is the correct way to get a wifi hotspot working under Fedora?  Do
I need wpa_supplicant configured?  Is there a Fedora web site devoted to
this issue? When adding a new wireless device for the hotspot using the
UI, it comes out as eth0:1.  Does eth0 (the original wireless configured
for the home) have to be enabled before eth0:1 comes up?  That's the
case with wired connections (or at least used to be - haven't tried
dual-homed cards in a while).  

BTW, Panera was configured with mode = Master today.  I tried to set
that with iwconfig and got an error back that Master was an invalid
option to Set Mode.  I tried all the other options too but none of them
worked.  I though it had to be Managed (via "mode auto" in iwconfig) but
I couldn't get that to work.

FWIW, here is the shell script I use for panera.  Beneath that is a perl
script I use for generic hot spots (no whining about my lousy perl style
- that's a problem for another day).  At one point in the past these
both worked, but only briefly.  I have no idea what I'm doing wrong. Any
tips would be appreciated.


#!/bin/bash
# Bring up the Wireless at Panera Bread
#-------------------------------------------------------------------------
set -x
/sbin/ifconfig eth0 down
/sbin/ifconfig eth1 down

# For integrated wireless
dev="eth0"

if [ "$1" = "" ]
then
    # /sbin/service network stop

    # Reload the driver because sometimes it just gets confused.
    /sbin/rmmod ipw2200
    /sbin/modprobe ipw2200
    # /sbin/iwconfig eth0 essid PANERA mode auto ap any channel 3
    /sbin/iwconfig eth0 essid any mode auto ap 00:03:52:9C:98:20 channel
3
    # /sbin/service network start
    /sbin/dhclient -1 $dev
    /sbin/route add default eth0
    /sbin/route add default gw 192.168.10.1
else
    # Bring the port down
    killall dhclient
    /sbin/ifconfig eth0 down
    cp /etc/resolv.conf.home /etc/resolv.conf

    # Reload the driver because sometimes it just gets confused.
    /sbin/rmmod ipw2200
    /sbin/modprobe ipw2200
fi



!/usr/bin/perl
# Bring up the Builtin Wireless card.
#-------------------------------------------------------------------------
use Getopt::Long;

# Shutdown the hardware wire connection - we wouldn't be using it if
we're
# trying to connect via wireless.
# By default the builtin card uses eth1
my $dev = "eth0";

# system("ifconfig eth0 down");
system("ifconfig $dev down > /dev/null 2>&1");
system("killall dhclient > /dev/null 2>&1");

# Use this to load the driver for the Belkin card - see src/ipw2200
# If it doesn't load - no biggie.  We only need it as a backup if the
# builtin card doesn't work.
# system("modprobe ndiswrapper");
    
my $open = 0;
my $essid = "";
my $channel = "";
my $signal = "";
my $findAll = 0;
my $started = 0;
    
my $verbose = 0;
$okay = GetOptions ( "findAll"      => \$findAll,
                     "h|?"          => \$dousage,
                     "v|verbose"      => \$verbose);
if ( !$okay )    { usage(); }
if ( $dousage )  { usage(); }

if ($findAll)
{
    print ("###  Finding all public cells.\n");
}

# open(PD, "iwlist $dev scan| grep -i \"essid:\"|");
open(PD, "iwlist $dev scan|");
while (<PD>)
{
    chomp();
    $field = $_;

    # Are we starting a new entry?
    if ( $field =~ /Address/ ) {
        if ( $verbose ) { print ("=== Starting new Cell.\n"); }
        $started = 1;
        $essid = "";
        $open = 0;
        $channel = "";
        $signal = "";
        next;
    }
    # Have we started a new entry?
    if ( !$started ) { next; }

    # We're in an entry - check for the ESSID
    if ( $field =~ /ESSID/ )
    {
        if ($verbose) { print ("Examining cell: $field\n"); }
        # next unless ( $field =~ /Unwired/ );
        $essid = $field;
        if ($verbose) { chomp($essid); }
        $essid =~ s/^.*://;
        $essid =~ s/\"//g;
        if ($verbose) { print ("Found cell: $essid\n"); }
    }
    if ( ($verbose) && ($essid ne "") ) {
        print ("Field: $field\n");
    }

    # We're in an entry and have an ESSID - check if the cell is open
access.
    if ( ($started) && ( $field =~ /off/ ) )
    {
        if ( $verbose ) { print ("=== Cell is open access.\n"); }
        $open = 1;
    }

    # We're in an entry and have an ESSID - grab the cell channel
    if ( ($started) && ($field =~ /Channel/) )
    {
        $channel = $field;
        $channel =~ s/^.*Channel //;
        $channel =~ s/\)//;
        if ( $verbose ) { print ("=== Cell channel: $channel\n"); }
    }

    # We're in an entry and have an ESSID - grab the signal level
    if ( ($started) && ($field =~ /Signal level/) )
    {
        $signal = $field;
        $signal =~ s/^.*level=//;
        if ( $verbose ) { print ("=== Signal Level: $signal\n"); }
    }
    if ( ($started) && ($open) && ($channel ne "") && ($signal ne "") )
    {
        if ( !$findAll) { last; }
        else            { print "Public cell: $essid, channel=$channel,
signal level= $signal\n"};
        if ( $verbose ) { print ("=== Ending Cell.\n"); }
        $started = 0;
    }
}
if ($findAll) { exit(0); }
close(PD);
if ( $open == 0 ) { print "Couldn't find public cell!\n"; exit(1); }
else              { print "Public cell: $essid, channel=$channel, signal
level= $signal\n"};

# We know what the local network ESSID is, so configure for it.
print("iwconfig $dev essid \"$essid\" channel $channel mode auto \n");
system("iwconfig $dev essid \"$essid\" channel $channel mode auto ");

# Request an IP address.
print("Configuring DHCP on $dev...");
if ($verbose) { system("dhclient -1 $dev"); }
else          { system("dhclient -1 -q $dev"); }
if ( ($? == -1) || ($? & 127) ) {
    print "Failed.\n";
    exit(1);
}
else {
    $rc = $? >> 8;
    if ( $rc != 0 ) { print "Failed.\n"; exit(1); }
    else            { print "Okay.\n"; }
}

# Echo back our configuration.
system("ifconfig $dev");

exit(0);


-- 
Michael J. Hammel                               
mjhammel at graphics-muse.org / http://www.graphics-muse.org
------------------------------------------------------------------------------
The most powerful force in the universe is gossip. -- Unknown.




More information about the LUG mailing list