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:
- Log out of GNOME back to the greeter screen (which is GDM in my case).
- Open up a console window with CTRL-ALT-F1.
- Login as your normal user (not root).
- Run a suitably edited copy of the above script under "sudo".
- 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