LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 09-04-2010, 12:29 AM   #1
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[567] x86_64, Ubuntu 17.10 x86_64
Posts: 221

Rep: Reputation: 36
How do I enable wireless connection outside of GNOME Desktop?


How do I enable wireless connection outside of GNOME Desktop? I am able to log in to GNOME desktop, and from there it automatically connects to my wireless access point, and I can ping sites on the internet just fine. If I log out, and log in using the failsafe login, the wireless network is not enabled.

I believe the NetworkManager applet (provided by the network-manager-gnome package) that runs under the GNOME desktop is setting things up behind the scenes. I want to be able to do that from a script exactly in the way GNOME does it, without embedding or hardcoding WEP keys anywhere and just reuse the GNOME desktop configuration.

Is there a way to do this?

Thanks,
Brent

Last edited by bgoodr; 09-04-2010 at 12:30 AM. Reason: Fat fingered the keyboard and posted before completing!
 
Old 09-05-2010, 12:35 AM   #2
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[567] x86_64, Ubuntu 17.10 x86_64
Posts: 221

Original Poster
Rep: Reputation: 36
Solution with explanation

Answering my own question with a script shown below. What I found was this: GNOME manages network connections via nm-applet. nm-applet is the client side of NetworkManager. I could not figure out how to get NetworkManager to manage the wireless network without having nm-applet running (maybe there is a way, I just don't know what it is; does anyone?). NetworkManager isn't GNOME-specific per se, but because it requires some desktop client (such as nm-applet), it is dependent upon a desktop. I looked quite a bit and could not find any non-GUI equivalent to nm-applet that would provide similar things.

I need a non-GUI approach because I need wireless connectivity outside of any desktop (i.e., one case would be network connectivity from the failsafe login prompt, or from a console).

What I ended up doing is just bypassing NetworkManager altogether and having my own private script to run under "sudo" or under root. The script is:
Code:
#!/bin/sh

set -x

# You must change the following variables to be what ifconfig and
# iwconfig report while running under GNOME desktop with the
# NetworkManager daemon running, and after connecting to the
# wireless connection (but you must log out of GNOME completely
# before running this script):

interface=eth1
key=censored
essid=my_sid

# You MUST stop NetworkManager from interfering as we take networks down and back up again manually below!!!!!
service network-manager stop
ifconfig $interface down
dhclient -r $interface
ifconfig $interface up
iwconfig $interface essid "$essid" key "$key" mode Managed
iwconfig
dhclient $interface

# You should see a DHCPOFFER output from the above dhclient output. If
# you do not, make sure the above commands all executed properly with
# no errors.
I found out how to construct the above script from several web pages, but the most important one was at http://ubuntuforums.org/showthread.php?t=571188 and also the key sentence there which was:
Quote:
Spaceboy909 has also reported that when using this technique with static IP addresses, network manager has to be uninstalled because it keeps trying to reset the connection.
I doubt this is specific to static IP setups, as it happens to this DHCP scenario. If NetworkManager is running, the call to dhclient will never respond with a DHCPOFFER since NetworkManager is somehow taking over the connection.

For my purposes, I expect to be able to go in and out of the GNOME desktop session, so I do not want to remove the network-manager Debian package at all. I just want to stop the NetworkManager daemon as is done above with the call to "service network-manager stop". I will have to arrange to start that daemon again when I log back into the GNOME desktop.

There is one failure mode I have yet to figure out:

  1. Log out of GNOME back to the greeter screen (which is GDM in my case).
  2. Open up a console window with CTRL-ALT-F1.
  3. Login as your normal user (not root).
  4. Run a suitably edited copy of the above script under "sudo".
  5. Go back to the GDM prompt with CTRL-ATL-F7. Here you will just see a blank screen instead of the greater. I conclude that the blank screen means that the stopping of NetworkManager caused GDM to terminate. I have to study up on things a bit more to see how I can restart GDM without rebooting the machine.
bg
 
Old 01-01-2011, 11:05 PM   #3
bgoodr
Member
 
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[567] x86_64, Ubuntu 17.10 x86_64
Posts: 221

Original Poster
Rep: Reputation: 36
This is now reverted back to unsolved because the script stopped working after a full system reinstallation. Something has changed in how the wireless commands work, or my script I had concocted was just barely working before and was too fragile. I'm giving in and just running nm-applet to service requests coming from the NetworkManager for now until someone else can take up the baton of implementing the console-equivalent of nm-applet that is window-manager-agnostic.

bg
 
  


Reply



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
I cannot enable my wireless connection. I am running on Opensuse 11.2. Opportunity Linux - Newbie 3 02-08-2010 01:27 PM
Can not switch on/enable wireless connection/using Ubuntu 9.10 pgonzamailcn Linux - Wireless Networking 21 12-25-2009 02:14 AM
Debian - Gnome: Wireless connection list missing my connection bio2009 Linux - Newbie 5 12-17-2009 11:07 PM
Enable Remote Desktop Connection in Squid anu_here Linux - Networking 1 03-24-2009 07:34 AM
I can't enable Wireless connection in my Acer Ferrari 4000 isra_mv Linux - Wireless Networking 20 05-06-2007 05:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

All times are GMT -5. The time now is 07:36 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