LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-17-2006, 06:50 PM   #1
evilmonkey
Member
 
Registered: Jun 2003
Location: Toronto, Canada
Distribution: Ubuntu 10.04 LTS; CentOS 5.5
Posts: 199

Rep: Reputation: 30
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!
 
Old 05-17-2006, 07:48 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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".
 
Old 05-17-2006, 08:57 PM   #3
evilmonkey
Member
 
Registered: Jun 2003
Location: Toronto, Canada
Distribution: Ubuntu 10.04 LTS; CentOS 5.5
Posts: 199

Original Poster
Rep: Reputation: 30
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.
 
Old 05-17-2006, 09:02 PM   #4
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
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.
 
Old 05-17-2006, 09:38 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 05-17-2006 at 10:58 PM.
 
Old 05-17-2006, 10:26 PM   #6
evilmonkey
Member
 
Registered: Jun 2003
Location: Toronto, Canada
Distribution: Ubuntu 10.04 LTS; CentOS 5.5
Posts: 199

Original Poster
Rep: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Read-only file system after enabling/disabling root benn333 Ubuntu 2 02-25-2007 01:42 PM
LXer: Enabling and disabling services during start up in GNU/Linux LXer Syndicated Linux News 0 04-02-2006 06:33 AM
linux hangs when enabling wireless card knight-rider Linux - Wireless Networking 1 01-16-2005 12:06 PM
Disabling Synaptics Touchpad, Enabling PS/2 Mouse alex_denner Linux - Laptop and Netbook 2 11-28-2004 05:37 PM
enabling "easybuttons" and integrated wireless card Pathian Linux - Hardware 0 10-20-2003 03:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration