[maemo-users] Connect to WLAN from command line

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

 



On 12/28/06, inigo at imedina.info <inigo at imedina.info> wrote:
>
> Wlan is up in the boot through the service wlancond (at /init.d)
> associated to runlevel 3. The graphical user interaction doesn't allow to
> set up but configure the values of wlan. So you have to define these in
> order to wlan starts at runlevel 3 with that configuration.
>
> To do that you have to edit file /etc/network/interfaces with the values
> of the wlan (iface, name, address, essid, etc.). Look at here:
> http://www.debian.org/doc/manuals/reference/ch-gateway.en.html
>
> A bit more complicate situation is if wlan is not always the same. In such
> a situation you must write a script that allows to distinguish between the
> different wlans (for instance, via comparison of known mac address and
> sniffed mac addres).
>

Yes, you're right. Here is an example of this script which I found recently
at http://planet.igalia.com:

The /etc/network/interfaces could be like this one (being HomeNET and
WorkNET two existing ESSID network identifiers):

auto eth1
mapping eth1
script /root/WIFI/wldetect.sh
map HomeNET HomeNET
map WorkNET WorkNET

iface HomeNET inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
wireless-essid HomeNET
wireless-key s:mysecretpass1 open
dns-nameservers 127.0.0.1 192.168.1.1

iface WorkNET inet dhcp
wireless-essid WorkNET
wireless-key s:mysecretpass2 open
dns-nameservers 127.0.0.1 192.168.100.1

The script /root/WIFI/wldetect.sh lists the available networks and chooses
one of them being in a whitelist (HomeNET|WorkNET):

#!/bin/sh

# Config
WL_IFACE=`iwconfig 2>/dev/null | { read A _; echo $A; };`

# Reset the interface
ifconfig $WL_IFACE down
ifconfig $WL_IFACE 0.0.0.0
ifconfig $WL_IFACE up

# Search networks
NETWORKS=`iwlist $WL_IFACE scanning | grep ESSID | sed -e
's/.*"\(.*\)"/\1/'`

# Bring down the interface
ifconfig $WL_IFACE down

# Select preferred networks
for NET in $NETWORKS
do
case $NET in
HomeNEt|WorkNET)
echo $NET;
exit 0;
;;
esac
done
exit 1;



i?
>
>
> *On Jue Dic 28 8:20 , 'Michael Stepanov' sent:
>
> *
>
>
>
> On 12/28/06, Gary <gary at eyetraxx.net> wrote:
>
> Michael Stepanov wrote:
>
> *>* Maybe somebody knows how to connect to wlan from background or command
> *>* line? I'd like to avoid user interaction to up wlan. I use OS 2005.
>
>
> Why not set it to auto connect if you don't want user input...?
>
>
> I need to connect to WLAN right after boot of Nokia. But there is no
> possibility to configure it. User has to press connect icon to bring up
> network.
>
> -Gary
> _______________________________________________
> maemo-users mailing list
> maemo-users at maemo.org
> https://maemo.org/mailman/listinfo/maemo-users
>
>
>
>
> --
> Cheers,
> Michael
>
>
>
> _______________________________________________
> maemo-users mailing list
> maemo-users at maemo.org
> https://maemo.org/mailman/listinfo/maemo-users
>
>
>


-- 
Cheers,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-users/attachments/20070109/7e5a27d1/attachment.htm 


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Big List of Linux Books]    

  Powered by Linux