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

Re: Configuration automatique interface ethernet et/ou wifi [Résolu]



Le 09/02 de l'annee 2008, vers 11 heures et 49 minutes, François TOURDE écrivait:
> Mais je ne doute pas que tu vas mettre en ligne un de ces 4 le détail
> de ta config ainsi que la façon dont tu y es arrivé, hein?

Voici ma configuration comme promis, pour le moment, je l'ai testée sur 5/6 points d'accès différents dont les 3 principaux types sont les suivants:
 - un accès wifi en dhcp
 - un accès ethernet en dhcp
 - un accès ethernet avec ip fixe.

Mon linux: Debian Lenny, uname -r=2.6.22-3-686, 

#aptitude install ifplugd whereami wireless-tools fping resolvconf
Version whereami: 0.3.34

Donc ma configuration est la suivante (les remarques sont les bienvenues):

1- /etc/network/interfaces contient juste ces deux lignes:
# The loopback network interface
auto lo
iface lo inet loopback


2- J'ai rajouté une ligne à /usr/share/whereami/testmii:
 après la ligne qui contient "ifconfig $1 up" au début du script (9ème ligne chez moi):
je rajoute "sleep 3" pour que le testmii prenne bien en charge le ifconfig eth0 up


3- Voici mes fichiers /etc/whereami/detect.conf 

# It is a good idea to default to somewhere... (Pas encore personnalisé)
default undocked

# Test for the presence of an ethernet connection plugged into eth0
testmii eth0 lan

# 'down' might be a location that is forced from the command line
# like "whereami down"
if down
  always at undocked
  always notat eth0,eth1
elif stop
  # Or maybe we can't remember the exact command, so we do it twice!
  # like "whereami stop" this time
  always at undocked
  always notat eth0,eth1
elif lan
  # If the testmii at the top was successful
  set INTERFACE eth0
  testping    147.210.*.*,147.210.*.*    ipfixe #note: toutes les adresses ip sont cachées.
  testdhcp    '192.168.*.*'    dhcphome
  testdhcp    '*.*.*.*'    dhcp
else
  # If the testmii at the top failed
  always modprobe ipw3945 w_eth1
fi

if w_eth1
  # Some wireless drivers use one interface name
  set INTERFACE eth1
  testap scan wlan
fi

# If we have found at least some WLAN APs in the vicinity, find out
# if we can do anything with any of them
if wlan
  testap	wifihome                          wifihome,wdhcp
  testap	hotel                          hotel,wdhcp
#  testap      .+                  wdhcp
  # # And if there isn't, we will indicate that.
  notat  wlan,wdhcp
fi


####################################################################### /etc/whereami/whereami.conf

# # By default send all mail via our main mailserver, since we do TLS+SASL there
=any MAIL_RELAY="smtp.free.fr"
# By default we assume that the detection configured routing
=any GATEWAY=""
# By default we assume we have an unfiltered internet connection
=any PROXY="none"
=any NTPDAEMON=/etc/init.d/ntp-server
=any NTPSERVER=ntp


## You will need to install the "resolvconf" package for these to
## work, and edit the following couple of stanzas to the right
## interface names.

## This only happens if we are not at a WLAN
!wlan ifconfig eth1 down
!wlan resolvconf -d eth1

## This only happens if we are not at a LAN
!lan ifconfig eth0 down
!lan resolvconf -d eth0

## Setup wlan connections
!wlan if /bin/false; then
=any iwconfig eth1 mode managed
=any ifconfig eth1 up

# Wifi Appart / Lyon
=wifihome iwconfig eth1 essid "wifihome"
=wifihome iwconfig eth1 channel "3"
=wifihome iwconfig eth1 key "motdepasse"
=wifihome setmailrelay "smtp.free.fr"
-wifihome iwconfig eth1 key off

# Hotel hotel
=hotel iwconfig eth1 essid "hotel"
=hotel iwconfig eth1 channel "6"
=hotel setmailrelay ""

### Get IP from dhcp
=any dhclient eth1 
!wlan fi


# ipfixe
=ipfixe ifconfig eth0 netmask "255.255.255.0"
=ipfixe ifconfig eth0 broadcast "147.210.*.*"
=ipfixe ifconfig eth0 "147.210.*.*"
=ipfixe route add default gw "147.210.*.*"
=ipfixe setresolver search blabbla.fr nameserver 193.*.*.* 147.210.*.*
=ipfixe setmailrelay "smtp.blabbla.fr"


# DHCP Home
=dhcphome setmailrelay "smtp.free.fr"


####################FIN################################################
-- 
AD

---()()()----()()()----()()()--)()()(----)()()(----)()()(---
-()----()--()-()-----()----()--)(----)(-----)(-)(--)(----)(-
()----()----()()()----()()()----)()()(----)()()(----)(----)(


Reply to: