LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Disabling/enabling the wireless card (https://www.linuxquestions.org/questions/linux-hardware-18/disabling-enabling-the-wireless-card-445846/)

evilmonkey 05-17-2006 05:50 PM

Disabling/enabling the wireless card
 
Hello,

I have an installation of Kubuntu running on a laptop, and I'm also part of a wireless network that has WEP security. Kubuntu is completely unable to deal with WEP and wireless, I have no idea why. Nevertheless, I went to the console, and wrote the following script:

Code:

#!/bin/sh
iwconfig eth1 essid mynetwork
iwconfig eth1 key s:myencryptionkey
dhclient
echo 1 > /proc/acpi/asus/wled #to turn on the LED on the laptop

However, this code doesn't run too well until I restart the network card (again, I have no idea why...i think it loads some stupid settings at startup). Currently, the onlt way for me to do it is to go to the KDE control centre -> network, make a change, press apply (this causes the card to reset), undo it, hit apply again. Only then does my script work. Is there a line I can put above my script to do this automatically?

Thanks!

jschiwal 05-17-2006 06:48 PM

Look for a Kubuntu network interface configuration. I think that you are using only the KDE's kcontrol, and not the systems configuration. You can probably configure the wireless device there, including the wireless authentication settings. I just use the wireless interface on my laptop at home, so I set the wireless interface to start on boot, and the NIC interface to start on connection ( this changes the hotplug configuration ). On my system, the wireless interface configuration is contained in the file /etc/sysconfig/network/ifcfg-wlan0. Several distro's use the same location for this file.

Look in your Kubuntu documentation, for information on "interface configuration".

evilmonkey 05-17-2006 07:57 PM

Naw, that file deosn't exist and I've given up trying to do this through GUI. Can you please give me the shell code to enable and disable the interface? It's called eth1 on my comp. Thanks. :)

johnson_steve 05-17-2006 08:02 PM

I'm also useing a script for my wifi I'll post the whole script if you'd like (it's an asus wl-167g)
but maybe try adding:

ifconfig eth1 down
ifconfig eth1 up

to your script this should reset the card from your script.

jschiwal 05-17-2006 08:38 PM

You may need to read through the boot up scripts. They may have names suggesting what they do, and probably source a configuration file. If you can locate the configuration file for the interface itself, then editing that file should work, however, there may be other files involved. For example, a GUI configuration for the interface would have an option on when you want the device configured. The dialog will mainly edit the interface configuration, but also make appropriate changes to others such as /etc/ifplugd/ifplugd.action and /etc/ifplugd/ifplugd.conf.

If your system has a file similar to my ifcfg-wlan0 configuration, you could grep for likely strings containing the same information.
sudo egrep -iR 'WIRELESS_KEY_[0-3]=' /etc/*
sudo egrep -iR '(WIRELESS_MODE|AUTH_MODE|BOOTPROTO=)' /etc/*

The resulting file found could be either a configuration file, or a script that sources it. For example, on my system, a script contains these lines:
Code:

######################################################################
# check presence of global configuration file and source it
#
test -f ./wireless && . ./wireless
# ifcfg-* is more important and fragile then wireless
if [ -f ./ifcfg-$CONFIG ] ; then
  . ./ifcfg-$CONFIG
elif [ "$ACTION" != down ] ; then
  err_mesg "could not find configuration file ifcfg-$CONFIG"
fi

This is from a file found in the second egrep command I gave. It tests for the existance of a configuration file before sourcing it. This is a pretty standard way of doing things. You may also notice many of your configuration files contain lines that follow a NAME=value format. These files are sourced, i.e. run in the same shell, by other scripts needing them. You don't need to change the scripts (and probably shouldn't) but just change the values in the config file.

Also, if you find a configuration file, they often have their own man page. Such as ifplugd.conf
Your system may have an "ifup" script. Try "locate ifup". Read through the script; it probably sources the config files that you need to use. These config files may even have their own manpages as well.

evilmonkey 05-17-2006 09:26 PM

Okay, thanks...I'm a bit disappointed with the fact that Ubuntu/Kubuntu cannot handle secured connections through their GUI, and that I need to run a script to do it (on the upside, it's only three lines). Thanks for the suggestions, I'll see what I can dig up.


All times are GMT -5. The time now is 07:11 AM.