Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
automatische Netzwerkerkennung LAN/WLAN
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
linpacman
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2004
Posts: 124

PostPosted: Thu Jul 14, 2005 4:39 pm    Post subject: automatische Netzwerkerkennung LAN/WLAN Reply with quote

mod-edit: Aufgrund des Zusammenführens mehrerer Threads Titel allgemeiner formuliert,
war: "Wie mit dem Notebook das Heimnetz identifizieren?" --slick


Hallo

Ich habe mein Notebook bisher so konfiguriert, daß es beim Start überprüft, ob ein Netzwerkkabel angeschlossen ist und falls nicht, das WLan Interface einschaltet und nach meinem Access Point sucht. Das funktioniert insoweit einwandfrei (bis auf ein Bandbreitenproblem mit dem madwifi-Treiber https://forums.gentoo.org/viewtopic-t-352364.html ).

Wie lässt es sich nun am schlauesten einrichten, daß das Notebook nach Feststellung einer Netzwerkverbindung (Lan oder WLan) prüft, ob es mit meinem Heimnetz verbunden ist und wenn dies zutrifft, bestimmte Aktivitäten ausführt, wie beispielsweise das mounten diverser nfs Shares oder die Zeitsynchronisierung per ntp?

Eine Möglichkeit wäre die Abfrage einer html Seite von einem im lokalen Netz laufenden Webserver. Wenn die Abfrage gelingt, könnten die Shares gemountet werden und bei nichtgelingen eben nicht :D

Was gibt es noch für Möglichkeiten bzw. gibt es schon etwas dafür vorgesehenes in der Richtung?
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Thu Jul 14, 2005 6:25 pm    Post subject: Reply with quote

wie wäre es denn mit überprüfen der MAC-Adresse des DHCP-Servers, Defaultgateways, Accesspoints etc.?
(Für den Fall das du auch in anderen Netzen zu Besuch bist die den gleichen IP-Range benutzen)
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
Freiburg
Guru
Guru


Joined: 19 Jun 2004
Posts: 504
Location: Freiburg

PostPosted: Thu Jul 14, 2005 10:19 pm    Post subject: Reply with quote

Ich würde die SSID nehmen...
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Fri Jul 15, 2005 6:33 am    Post subject: Reply with quote

siehe https://forums.gentoo.org/viewtopic-t-247454.html oder https://forums.gentoo.org/viewtopic-t-348646.html , da geht es um ähnliche Problemstellung
Back to top
View user's profile Send private message
MEimke
n00b
n00b


Joined: 23 Mar 2003
Posts: 9

PostPosted: Fri Jul 15, 2005 6:33 am    Post subject: Reply with quote

hprofile (http://hprofile.sourceforge.net) ist ziemlich genau das was Du suchst. Ist seit einiger Zeit auch im Portage, allerdings immer noch maskiert. Die Konfiguration ist zwar etwas frickelig und um das volle Leistungspotential auszuschöpfen musst Du einige Skripte noch selber schreiben bzw. anpassen, wenn es läuft ist es aber sehr mächtig.

Gruss,
Michael
Back to top
View user's profile Send private message
elektro
n00b
n00b


Joined: 13 Jul 2005
Posts: 10

PostPosted: Fri Jul 15, 2005 8:18 am    Post subject: Re: Wie mit dem Notebook das Heimnetz identifizieren? Reply with quote

linpacman wrote:
Ich habe mein Notebook bisher so konfiguriert, daß es beim Start überprüft, ob ein Netzwerkkabel angeschlossen ist und falls nicht, das WLan Interface einschaltet und nach meinem Access Point sucht.

Hmm, sowas such ich schon lange. Könntest Du eventuell beschreiben, wie Du das gemacht hast :?:
Ich hab bei mir bisher die Standardkonfiguration mit net.eth0 (lan, link auf net.lo) und net.eth1 (wlan; link auf net.eth0). Beide werden beim Booten als rc gestartet und brechen dann ab, wenn sie keine IP bekommen; jenachdem ob lan oder wlan verfügbar ist.
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Fri Jul 15, 2005 8:39 am    Post subject: Re: Wie mit dem Notebook das Heimnetz identifizieren? Reply with quote

elektro wrote:
linpacman wrote:
Ich habe mein Notebook bisher so konfiguriert, daß es beim Start überprüft, ob ein Netzwerkkabel angeschlossen ist und falls nicht, das WLan Interface einschaltet und nach meinem Access Point sucht.

Hmm, sowas such ich schon lange. Könntest Du eventuell beschreiben, wie Du das gemacht hast :?:
Ich hab bei mir bisher die Standardkonfiguration mit net.eth0 (lan, link auf net.lo) und net.eth1 (wlan; link auf net.eth0). Beide werden beim Booten als rc gestartet und brechen dann ab, wenn sie keine IP bekommen; jenachdem ob lan oder wlan verfügbar ist.


Wie wäre es damit:

Code:
*  sys-apps/ifplugd
      Latest version available: 0.28
      Latest version installed: [ Not Installed ]
      Size of downloaded files: 139 kB
      Homepage:    http://0pointer.de/lennart/projects/ifplugd/
      Description: Brings up/down ethernet ports automatically with cable detection
      License:     GPL-2

_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
elektro
n00b
n00b


Joined: 13 Jul 2005
Posts: 10

PostPosted: Fri Jul 15, 2005 8:48 am    Post subject: Reply with quote

jau,
ich lese gerade auf der website dazu.
hieße das bei der anwendung von ifplugd müßte ich die rc für net.eth0 & net.eth1 erstmal händisch löschen und dann komplett ifplugd überlassen?
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Fri Jul 15, 2005 8:50 am    Post subject: Reply with quote

elektro wrote:
jau,
ich lese gerade auf der website dazu.
hieße das bei der anwendung von ifplugd müßte ich die rc für net.eth0 & net.eth1 erstmal händisch löschen und dann komplett ifplugd überlassen?


Genau!
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
elektro
n00b
n00b


Joined: 13 Jul 2005
Posts: 10

PostPosted: Fri Jul 15, 2005 10:10 am    Post subject: Reply with quote

schönes ding mit ifplugd, aber ein problem bleibt leider noch:
eth0=lan klappt astrein (anstecken/abziehen kabel wird erkannt, aber eth1=wlan wird von ifplugd nicht richtig behandelt. (siehe auch /var/log/messages unmittelbar nach dem booten und vgl. eth0 und eth1)
EDIT:
workaround für
Quote:
Ich habe mein Notebook bisher so konfiguriert, daß es beim Start überprüft, ob ein Netzwerkkabel angeschlossen ist und falls nicht, das WLan Interface einschaltet
Quote:
Hmm, sowas such ich schon lange

/usr/sbin/ifplugd.action:
Code:
case "$2" in
       up)
               state=start
               /etc/init.d/net.eth1 stop
               ;;
       down)
               state=stop
               /etc/init.d/net.eth1 start
               ;;
       *)

/etc/conf.d/ifplugd:
Code:

INTERFACES ="eth0" #ohne eth1!
AUTO="yes"
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Tue Feb 21, 2006 8:10 pm    Post subject: laptop - wenn kein netzwerk.kabel, dann wlan Reply with quote

mod-edit: folgenden Thread (10 Posts) hier angehangen --slick

Hallo,

ich suche einen weg der beim starten meines laptop überprüft ob es via Netzwerk kabel (eth0) ins netz kommt, und wenn dies nicht erfolgreich ist dann eth1 startet und sich über wlan ein wählt.

Grüße Kai

PS : Läßt sich was mit quickswitch anfangen ?
Back to top
View user's profile Send private message
mathes.s
Apprentice
Apprentice


Joined: 18 Apr 2003
Posts: 279
Location: Brunswick, Germany

PostPosted: Tue Feb 21, 2006 8:15 pm    Post subject: Reply with quote

Hi,
das mit Kabel überprüfen habe ich auch gerade gehabt. Bei dem rest musst du mal die net.example unter /etc/conf.d lesen. Aber für ersteres geht so was
Code:
preup() {
       # Test for link on the interface prior to bringing it up.  This
       # only works on some network adapters and requires the ethtool
       # package to be installed.
       if ethtool ${IFACE} | grep -q 'Link detected: no'; then
               ewarn "No link on ${IFACE}, aborting configuration"
               return 1
       fi

       # Remember to return 0 on success
       return 0
}

dazu muss natürlich ethtool installiert sein. Diesen Code schnipsel musst du in die /etc/conf.d/net eintragen.

mfg Mathes
_________________
Erst wenn der letzte Programmierer eingesperrt, das letzte Programm verwirklicht und die letzte Idee patentiert ist, werdet Ihr merken, dass Anwälte nicht programmieren können.
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Tue Feb 21, 2006 8:22 pm    Post subject: Reply with quote

danke dir,
ich glaube ich kann erahnen auf was du hinaus willst,
leider bin ich recht neu in der ganzen linux materie und suche nach einer vollständigeren Anleitung, um das Problem zu lösen.
k.

PS : wann wird denn die preup() methode aufgerufen ?
Back to top
View user's profile Send private message
mathes.s
Apprentice
Apprentice


Joined: 18 Apr 2003
Posts: 279
Location: Brunswick, Germany

PostPosted: Tue Feb 21, 2006 8:29 pm    Post subject: Reply with quote

Hi,
lies dazu am besten /etc/conf.d/net.example und /etc/conf.d/wireless.example. Da steht einiges drin.

mfg Mathes
_________________
Erst wenn der letzte Programmierer eingesperrt, das letzte Programm verwirklicht und die letzte Idee patentiert ist, werdet Ihr merken, dass Anwälte nicht programmieren können.
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Tue Feb 21, 2006 8:44 pm    Post subject: Reply with quote

Ich bin da ein wenig verwirrt ,

ich habe eth1 via wpa_supplicant configuriert. ist die /etc/conf.d/wireless nicht Wireless Tools spezifisch ?

k
Back to top
View user's profile Send private message
mathes.s
Apprentice
Apprentice


Joined: 18 Apr 2003
Posts: 279
Location: Brunswick, Germany

PostPosted: Tue Feb 21, 2006 8:59 pm    Post subject: Reply with quote

Joah da hast du recht steht, aber auch in der net.example,
Quote:
wpa_supplicant
# emerge net-wireless/wpa-supplicant
# Wireless options are held in /etc/wpa_supplicant.conf
# Consult the sample file /etc/wpa_supplicant.conf.example for instructions


also musst du nicht in wireless.example gucken sondern in wpa_supplicant.conf.example. Es stehen auch noch mehr Infos in net.example die sich auch auf wpa_supplicant beziehen.


mfg Mathes
_________________
Erst wenn der letzte Programmierer eingesperrt, das letzte Programm verwirklicht und die letzte Idee patentiert ist, werdet Ihr merken, dass Anwälte nicht programmieren können.
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Tue Feb 21, 2006 9:16 pm    Post subject: Reply with quote

ok,
vieleicht könte folgenes gehen.
Bei mir startet eth0 zuerst, das heißt wenn eth0 nicht da ist (siehe preup() ) dann starte eth1. wenn eth0 da ist starte nicht eth1soweit so gut.
Hast du erfahrung ob eine solche configuration mit quickswitch ins gehedder kommt ?
Back to top
View user's profile Send private message
Finswimmer
Bodhisattva
Bodhisattva


Joined: 02 Sep 2004
Posts: 5467
Location: Langen (Hessen), Germany

PostPosted: Tue Feb 21, 2006 9:37 pm    Post subject: Reply with quote

Hey,

such mal nen bisschen, da gibt es auch was Fertiges.
Man muss nen neueres Baselayout haben und ein Paket emergen.

Dann sucht er sich bei dem Start von einem Netzwerk Script automatisch das beste Device.

Ich suche morgen nochmal nach dem Thread/Howto.

Tobi
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Tue Feb 21, 2006 9:49 pm    Post subject: Reply with quote

das währe prima - danke dir
würde mich interessieren was das ist
kai
Back to top
View user's profile Send private message
samsonus
Apprentice
Apprentice


Joined: 18 Jan 2005
Posts: 225
Location: Siegen

PostPosted: Wed Feb 22, 2006 6:24 am    Post subject: Reply with quote

hmm, wie wäre es mit ifplugd ?

Code:
emerge ifplugd


gruss alex
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Wed Feb 22, 2006 7:07 am    Post subject: Reply with quote

Threads zusammengeführt
Back to top
View user's profile Send private message
chilla
Apprentice
Apprentice


Joined: 12 Dec 2004
Posts: 203
Location: Heidelberg, Germy

PostPosted: Wed Feb 22, 2006 9:46 am    Post subject: Reply with quote

grundsätzlich macht das wpa_supplicant schon mal sehr gut!

Man trägt verschiedene Netze mit ihren eigenschaften ein, und vergibt ihnen prioritäten. Wenn man wpa_supp dann startet, kümmert es sich automatisch um die erreichbaren netze und verbindet sich mit dem höchst priorisierten.

Problem an der Sache ist: wpa_supp kann nur wlan :( Man müsste diese funktionalität auch auf eth ausweiten...
_________________
"Democracy is two wolves and a sheep voting on what to have for dinner. Liberty is two wolves attempting to have a sheep for dinner and finding a well-informed, well-armed sheep."

TU-BS Wiki
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Wed Feb 22, 2006 10:33 am    Post subject: Reply with quote

Hallo prima das ihr den Thread zusammengelegt habt :

ich habe jetzt ifplugd ge-emerged und das von Anarcho beschriebene workaround eingebaut und rc für net.eth0 & net.eth1 gelöscht:
Sieht jetzt so bei mir aus :

/etc/config.d/ifpluged

Code:
INTERFACES="eth0"

# If INTERFACES is not set above, then when WIRELESS_INTERFACES="no" then
# all interfaces found in /proc/net/wireless are excluded from ifplugd
WIRELESS_INTERFACES="no"

# Additional parameters for ifplugd.
# See manual page ifplugd.8 for details.
# I recommend a delay of 0, both ways, since then, you can swap ethernet
# cables on different networks and get a new ip address.
# None of the programs I tested had a problem with the interface being
# gone in the mean time.
AUTO="yes"
BEEP="yes"
IGNORE_FAIL="yes"
IGNORE_FAIL_POSITIVE="no"
IGNORE_RETVAL="yes"
POLL_TIME="1"
DELAY_UP="0"
DELAY_DOWN="0"
API_MODE="auto"
SHUTDOWN="no"
WAIT_ON_FORK="no"
MONITOR="no"
ARGS=""


/etc/ifplugd/ifplugd.action
Code:
if grep -q initng /proc/1/cmdline
then
    EXEC="/sbin/ngc"
    INITNG="yes"
else
    EXEC="/etc/init.d/net.$1"
    INITNG="no"
fi

case "$2" in
    up)
   if [ "${INITNG}" = "yes" ]
   then
       ARGS="-u net/$1"
   else
       ARGS="--quiet start"
   fi
   /etc/init.d/net.eth1 stop
   ;;
    down)
   if [ "${INITNG}" = "yes" ]
   then
       ARGS="-d net/$1"
   else
       ARGS="--quiet stop"
   fi
    /etc/init.d/net.eth1 start
   ;;
    *)
   echo "$0: wrong arguments" >&2
   echo "Call with <interface> <up|down>" >&2
   exit 1
   ;;
esac

export IN_BACKGROUND=true

if [ -x "${EXEC}" ]
then
    ${EXEC} ${ARGS}
    exit 0
else
    logger -t ifplugd.action "Error: Couldn't configure $1, no ${EXEC} !"
    exit 1
fi

functioniert tadel los.
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Wed Feb 22, 2006 12:12 pm    Post subject: Reply with quote

so jetzt noch

Code:
rc-update add ifplugd default


das Ergebnis :
Ist das Kabel eingesteckt, wird eth0 (LAN) beim beim booten gestartet. Wird das Kabel gezogen wird eth0 gestopt und eth1 (WLAN) gestartet

so weit so gut.

Ist das netzwerkkabel beim booten nicht eingesteckt, kann ifplugd eth0 natürlich nicht starten.

Jemand eine idee wie ich in diesem Fall eth1 starten kann ?
Back to top
View user's profile Send private message
kaiulrich
n00b
n00b


Joined: 10 Sep 2005
Posts: 59

PostPosted: Wed Feb 22, 2006 5:40 pm    Post subject: Reply with quote

ich habe nun versucht in der ifplugd.action diesen fall abzufangen (wenn eth0 nicht linked -> dann starte eth1),
es scheint jedoch so, als würde die ifplugd.action erst nach dem start des device eth0 ausgeführt.
ifplugd führt die ifplugd.action bei fehlerhaften start also nicht mehr aus.
So klapt es nicht.

Hat jemand eine Idee ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum