19.03.2024, 03:34 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]

Make Wlan configuration persistent


The solution can be achieved with a change in the file /etc/network/interfaces.

Mostly this file contains someting as the following:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

## The loopback interface
##automatically added when upgrading
auto lo wlan0 eth0
iface lo inet loopback

iface wlan0 inet dhcp

iface eth0 inet static
        address 192.168.0.3
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255

were eth0 a normal network card, that was configured with a static IP.
The WLAN card is here wlan0 but can also be as "eth so it would be in our example eth1. You can find how your card is identified examining the output of the program wlancardconfig.

If you want the WLAN card configured on boot the file /etc/network/interfaces must be enhanced with the following:

iface wlan0 inet dhcp
wireless_key YOUR_WEP_KEY
wireless_essid YOUR_WLAN_ID
wireless_mode MODE
wireless_channel CHANNEL

The uppercase WORDS must be substituted with the right values for you WLAN.

If you dont need a value, or you have not entered in wlancardconfig can be skipped or deleted. MODE can be Managed, Adhoc" or something like that, the right values can be found in the configuration window from wlancardconfig. As start point is enough to set ESSID (ie the name of the Wlan), the rest ist not needed. The WEP-Key is needed if the WLAN is encoded (If the lan is encoded with WPA take a look [[WlanWpa hier]]. If you have static ip adresses on your WLAN use the eth0 part as example. Some Notes: ====ESSID==== The **Essid** must be in UPPERCASE. This should be the case even if you have entered lowercas in the router. ====Manual restart of the WLAN connection==== If after starting the WLAN, you have start the network card configuration tool "netcardconfig" then the file "/etc/network/interfaces" will be overwritten with the standard values. If you want to restat the newtork then is better to use: %%/etc/init.d/networking restart%% --- If you really need to call it then save the WLAN configuration part an append it after reconfiguring the nic. With the following script you make before shutdown a copy of a running interfaces"" file

Create (copy_interfaces) in /usr/local/bin
change mode
chmod u+x /usr/local/bin/copy_interfaces

put the following in the file:
#!/bin/bash 
# /etc/init.d/copy_interfaces 
# 
IF_FILE=/etc/network/interfaces 
IF_BACKUPFILE=/etc/network/interfaces.backup 
IF_OWNFILE=/etc/network/interfaces.my 

case "$1" in 
   start) 
   echo "Make a copy from the active file $IF_FILE...." 
   cp -p $IF_FILE $IF_BACKUPFILE 
   if [ $? -ne 0 ]; then 
      echo "Copy write error (1)" 
      exit 1 
   fi 
   echo "Replace the active File $IF_FILE by my own file $IF_OWNFILE...." 
   cp -p $IF_OWNFILE $IF_FILE 
   if [ $? -ne 0 ]; then 
      echo "Copy write error (2)" 
      exit 2 
   fi 
  ;; 
   stop) 
   echo "Nothing to do in that case" 
   ;; 
   *) 
   echo "Usage: $0 {start|stop}" 
   exit 3 
   ;; 
esac 
exit 0



To bind the script im init process runlevels 0 und 6 (shutdown and restart).
ln -s /usr/local/bin/copy_interfaces /etc/rc0.d/S05copy_interfaces 
ln -s /usr/local/bin/copy_interfaces /etc/rc6.d/S05copy_interfaces




Create a correct version of the filee /etc/network/interfaces as /etc/network/interfaces.my.

On each boot/shutdown a backup ot the actual 'interfaces' file will be made 'interfaces.my'.

Thanks an BlueLupo for the script


up
XML Revisions of $tag
Seiten-History :: Letzter Editor : bluewater :: Eigentümer : CokeintheBottle ::
Powered by pnWikka 1.0
 
 
Deutsch | English
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you. Our web server is running on Kanotix64-2006.