PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > Network management, both ethernet and wireless
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

Network management, both ethernet and wireless

Réponse
 
LinkBack Outils de la discussion
Vieux 13/11/2007, 11h30   #1
ispmarin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Network management, both ethernet and wireless

Hello all.

I´ve just installed debian lenny (amd64) on my macbook, and since this
is my first time as a notebook user, I would like to hear your ways to
control connectivity. I have two different ethernet connections, home
and work, each with different IPs. I also have a wireless connection
at work, and would like also to connect to different wireless
connections (airports, etc). At work, if the ethernet connection is
plugged, wireless should be disabled; if it´s not, wireless should be
used. At home, the same. If ethernet is not connected, and I am not at
home or work, I should be able to search for other (encrypted or not)
wireless connections.

Kwifimanager, network manager didn´t work, and I was not able to put
this flexibility on whereami.

Thank you!

Ivan
  Réponse avec citation
Vieux 13/11/2007, 17h50   #2
Andrew Sackville-West
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Network management, both ethernet and wireless

On Tue, Nov 13, 2007 at 03:08:01AM -0800, ispmarin wrote:
> Hello all.
>
> I´ve just installed debian lenny (amd64) on my macbook, and since this
> is my first time as a notebook user, I would like to hear your ways to
> control connectivity. I have two different ethernet connections, home
> and work, each with different IPs. I also have a wireless connection
> at work, and would like also to connect to different wireless
> connections (airports, etc). At work, if the ethernet connection is
> plugged, wireless should be disabled; if it´s not, wireless should be
> used. At home, the same. If ethernet is not connected, and I am not at
> home or work, I should be able to search for other (encrypted or not)
> wireless connections.


the wireless part is (remarkably) fairly easy to work out. I use a
'mapping' interface stanza in my /etc/network/interfaces that hooks to
a simple script. This script greps through an 'iwlist <interface>
scan' call looking for particular strings. the script then sets the
iwconfig parameters based on those results, changes some symlinks for
/etc/hosts and /etc/apt/sources.list and then echoes out an
appropriate string to return to the 'mapping' so that the right
address gets assigned.

If you want to disable wireless on wired connection, I'm not
sure. Look at ifplugd perhaps and find a way to determine what its
doing with the wired interface and then up or down the wireless
appropriately. And for good battery life, kill the wireless altogther
when you're not using it.

A

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHOeLNaIeIEqwil4YRAsB4AJ9bjcrRBwMvBVwkLSnhPw HGGx1fJACghGv9
U4Jzb1iO7klGPsMe8WjhbIw=
=g6cW
-----END PGP SIGNATURE-----

  Réponse avec citation
Vieux 13/11/2007, 18h50   #3
ispmarin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Network management, both ethernet and wireless

On Nov 13, 3:50 pm, Andrew Sackville-West
<and...@farwestbilliards.com> wrote:
> On Tue, Nov 13, 2007 at 03:08:01AM -0800, ispmarin wrote:
> > Hello all.

>
> > I´ve just installed debian lenny (amd64) on my macbook, and since this
> > is my first time as a notebook user, I would like to hear your ways to
> > control connectivity. I have two different ethernet connections, home
> > and work, each with different IPs. I also have a wireless connection
> > at work, and would like also to connect to different wireless
> > connections (airports, etc). At work, if the ethernet connection is
> > plugged, wireless should be disabled; if it´s not, wireless should be
> > used. At home, the same. If ethernet is not connected, and I am not at
> > home or work, I should be able to search for other (encrypted or not)
> > wireless connections.

>
> the wireless part is (remarkably) fairly easy to work out. I use a
> 'mapping' interface stanza in my /etc/network/interfaces that hooks to
> a simple script. This script greps through an 'iwlist <interface>
> scan' call looking for particular strings. the script then sets the
> iwconfig parameters based on those results, changes some symlinks for
> /etc/hosts and /etc/apt/sources.list and then echoes out an
> appropriate string to return to the 'mapping' so that the right
> address gets assigned.
>
> If you want to disable wireless on wired connection, I'm not
> sure. Look at ifplugd perhaps and find a way to determine what its
> doing with the wired interface and then up or down the wireless
> appropriately. And for good battery life, kill the wireless altogther
> when you're not using it.
>
> A
>
> signature.asc
> 1KDownload


Can you post the script that script?

Thanks
  Réponse avec citation
Vieux 13/11/2007, 19h40   #4
Andrew Sackville-West
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Network management, both ethernet and wireless

On Tue, Nov 13, 2007 at 10:22:58AM -0800, ispmarin wrote:
> On Nov 13, 3:50 pm, Andrew Sackville-West
> <and...@farwestbilliards.com> wrote:
> > On Tue, Nov 13, 2007 at 03:08:01AM -0800, ispmarin wrote:
> > > Hello all.

> >
> > > I´ve just installed debian lenny (amd64) on my macbook, and since this
> > > is my first time as a notebook user, I would like to hear your ways to
> > > control connectivity.


...

> > the wireless part is (remarkably) fairly easy to work out. I use a
> > 'mapping' interface stanza in my /etc/network/interfaces that hooks to
> > a simple script. This script greps through an 'iwlist <interface>
> > scan' call looking for particular strings. the script then sets the
> > iwconfig parameters based on those results, changes some symlinks for
> > /etc/hosts and /etc/apt/sources.list and then echoes out an
> > appropriate string to return to the 'mapping' so that the right
> > address gets assigned.


...

>
> Can you post the script that script?
>


andrew@delappy:~$ sudo cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
...
auto eth2
mapping eth2
script /usr/local/sbin/wireless-detection.sh
map HOME eth2home
map AWAY eth2away

iface eth2home inet static
address 192.168.5.2
netmask 255.255.255.0
gateway 192.168.5.1
up /usr/local/sbin/home-hosts.sh

iface eth2away inet dhcp
up /usr/local/sbin/away-hosts.sh

It took me a while to figure that out, but apparently the HOME and
AWAY are just comments or identifiers and don't actually do
anything. What's pertinent is that the eth2home, eth2away stuff
matchup with the output of the script below.

andrew@delappy:~$ cat /usr/local/sbin/wireless-detection.sh
#!/bin/bash
#
# attempt to determine where we are and setup up wireless
appropriately

HOME_ID=2702s

if [ `iwlist eth2 scan | grep $HOME_ID` ]; then
iwconfig eth2 essid $HOME_ID
iwconfig eth2 key restricted s:xxxxxxxxx
iwconfig eth2 mode ad-hoc
LOCATION="eth2home"
else
iwconfig eth2 essid off
iwconfig eth2 ap any
iwconfig eth2 key off
iwconfig eth2 mode auto
LOCATION="eth2away"
fi

if [ "$LOCATION" ]; then
echo $LOCATION
exit 0
fi
exit 1

The above is using wep not wpa, due to restictions in the firmware for
my cheap old card. You should be able to work out something similar
for wpa.

Simple enough. The 'up' scripts /usr/local/sbin/{home,away}-hosts.sh
just rm /etc/hosts and then ln -s /etc/{home,away}-hosts /etc/hosts
so that I get different hosts fiels depending on whether I'm inside or
outside my LAN.

hth

A

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHOf0BaIeIEqwil4YRAoReAJ9a5ltmNbgwoWbX3uFSJ+ kbtOVCdACbBhPE
FZiThfOMAtk2nCR/eOIwmvY=
=nlJ7
-----END PGP SIGNATURE-----

  Réponse avec citation
Vieux 14/11/2007, 16h50   #5
Brad Sawatzky
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Network management, both ethernet and wireless

> On Tue, Nov 13, 2007 at 03:08:01AM -0800, ispmarin wrote:

> > I´ve just installed debian lenny (amd64) on my macbook, and since this
> > is my first time as a notebook user, I would like to hear your ways to
> > control connectivity. I have two different ethernet connections, home
> > and work, each with different IPs. I also have a wireless connection
> > at work, and would like also to connect to different wireless
> > connections (airports, etc). At work, if the ethernet connection is
> > plugged, wireless should be disabled; if it´s not, wireless should be
> > used. At home, the same. If ethernet is not connected, and I am not at
> > home or work, I should be able to search for other (encrypted or not)
> > wireless connections.


Try installing Network Manager (apt-get install network-manager). It will
do everything you ask right out of the box.

It will probably fire up automatically if you're running a gnome desktop.
Otherwise you can manually run 'nm-applet' when you login. You should see
a new icon in your window manager's system tray. Hopefully you only need
to do that the first time, then your session manager will restart it on
subsequent logins.

Network Manager is a little too 'black-magic' for my taste, but it actually
works really well.

On my etch system I also had to do the following (YMMV):
- comment out all interfaces in /etc/networks/interfaces except for 'lo'
- add relevant users to the 'netdev' group

As an aside, anyone know how to disable the Windows'ish balloon pop-up when
you connect/disconnect from a network? I hate that thing.

-- Brad

--
Brad Sawatzky, PhD <brads@jlab.org> -<>- Jefferson Lab / Temple Univ.
Ph: 757-269-5947 -<>- Pager: 757-584-5947 -<>- Fax: 757-269-7363
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" but "That's funny..." -- Isaac Asimov


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h11.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14102 seconds with 13 queries