20.05.2024, 08:50 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]

Make Wlan configuration persistent


It happens sometimes with wireless cards that Kanotix forget on each boot the configuration and this must be redone everytime. The solution can be achieved with a change in the file /etc/network/interfaces.

Mostly this file contains someting as the following:

:code: # /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
        1. 192.168.0.3
        2. 255.255.255.0
        3. 192.168.0.0
          1. 192.168.0.255 :code:

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: :code: ... iface wlan0 inet dhcp wireless_key YOUR_WEP_KEY wireless_essid YOUR_WLAN_ID wireless_mode MODE wireless_channel CHANNEL ... :code: 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 hier.

If you have static ip adresses on you 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/netwwork/interfcaes" will be overwritten with the standard values. If you want to restat the newtork then is better
to use :code:/etc/init.d/networking restart:code: .
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

>1)Create (copy_interfaces) in /usr/local/bin
>1) change mode :code:chmod u+x /usr/local/bin/copy_interfaces:code:
>1) put the following in the file::code: #!/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
  1. "Make a copy from the active file $IF_FILE...."
  • -p $IF_FILE $IF_BACKUPFILE
  • [ $? -ne 0 ]; then
    1. "Copy write error (1)"
    2. 1
    1. "Replace the active File $IF_FILE by my own file $IF_OWNFILE...."
  • -p $IF_OWNFILE $IF_FILE
  • [ $? -ne 0 ]; then
    1. "Copy write error (2)"
    2. 2
  • ;;
    1. "Nothing to do in that case" ;;
  • )
    1. "Usage: $0 {start|stop}"
    2. 3 ;;
    esac
    exit 0:code:
    >1) with :code:ln -s /usr/local/bin/copy_interfaces /etc/rc0?.d/S05copy_interfaces
    ln -s /usr/local/bin/copy_interfaces /etc/rc6?.d/S05copy_interfaces:code:bind the script im init process runlevels 0 und 6 (shutdown and restart).
    >1) 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
  • XML Revisions of $tag
    Seiten-History :: Letzter Editor : CokeintheBottle :: 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.