Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

How to do wifi conveniently from CLI?

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
Punchcutter
Guru
Guru
User avatar
Posts: 370
Joined: Sun Feb 11, 2007 11:29 pm

How to do wifi conveniently from CLI?

  • Quote

Post by Punchcutter » Wed Feb 03, 2010 12:40 am

Hi.... I've lately had very bad luck trying to find a convenient GUI tool to manage wifi connections (long story... closely related to KDE and its dumping of 3.5.x, but let's not go there....) I need to take a business trip very soon, and use wifi on the road. I'm quite sufficiently techie, however, and not afraid to use the command line to manage my wifi connections (using /etc/init.d/net.wlan0, ifconfig, wpa_supplicant command, etc). There are just a few things I don't know:

In a case where there may be multiple networks present, how can I ensure that the ESSID I want to use is the one chosen to attach to?

How can I easily check which ESSID I am connected to at any given time?

The tools I know about don't seem to offer this capability. Is there another tool that deals at the ESSID level? If not, this seems like an odd gap in functional coverage...

Thanks very much in advance for any help. Any and all tips on best practices for managing wifi from CLI are most appreciated!

EDIT:
Of course it's only as soon as you've posted something like this that you think to google and then find some useful info. Googling reminded me of "iwconfig", which I had long forgotten about. I see that you can "set" the essid with this. But if I can get /etc/init.d/net.wlan0 to handle underlying details for me, including interfacing with wpa_supplicant, how would iwconfig fit into this scheme? Or would I need to specify ESSIDs in /etc/conf.d/net? (don't know the syntax for that - if there's a man page for this file, I can't find it).

Too many questions.... and much info on the web is specific to non-Gentoo distros, so I suppose asking here will have been worthwhile in the long run.... thanks again.
Top
mikegpitt
Advocate
Advocate
User avatar
Posts: 3224
Joined: Sat May 22, 2004 6:49 pm

  • Quote

Post by mikegpitt » Wed Feb 03, 2010 1:07 am

A well set up /etc/wpa_supplicant/wpa_supplicant.conf should handle most things for your automatically. Others may recommend using wicd, but I don't have any experience with wicd. I find the easiest way to configure wpa_supplicant is to use the wpa_gui tool.

As for controlling things through the command line, you can use iwconfig as you noted above. You can also use wpa_cli. The wpa_cli documentation is severely lacking, but I've been able to figure out the following:

Code: Select all

# perform a scan and list the results
wpa_cli SCAN
wpa_cli SCAN_RESULTS

# disconnect from an ap
wpa_cli DISCONNECT

# connect to a new ap
wpa_cli SELECT_NETWORK myessid
wpa_cli REASSOCIATE

# get the status of your connection
wpa_cli STATUS
[/code]
Top
DONAHUE
Watchman
Watchman
User avatar
Posts: 7651
Joined: Sat Dec 09, 2006 4:27 pm
Location: Goose Creek SC

  • Quote

Post by DONAHUE » Wed Feb 03, 2010 1:20 am

How can I easily check which ESSID I am connected to at any given time? -- iwconfig
what's available -- iwlist scan
In a case where there may be multiple networks present, how can I ensure that the ESSID I want to use is the one chosen to attach to? set ssid= in wpa-supplicant.conf
you don't have a wpa supplicant administration gui as a result of emerge wpa-supplicant?
Top
poly_poly-man
Advocate
Advocate
User avatar
Posts: 2477
Joined: Wed Dec 06, 2006 9:59 pm
Location: RIT, NY, US
Contact:
Contact poly_poly-man
Website

  • Quote

Post by poly_poly-man » Wed Feb 03, 2010 3:36 am

if you want a gui back (or not - it's still, in the opinions of many networkmanager converts, a useful tool), use wicd.
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see [topic]838248[/topic]. Potentially still a WiP.
Top
Punchcutter
Guru
Guru
User avatar
Posts: 370
Joined: Sun Feb 11, 2007 11:29 pm

  • Quote

Post by Punchcutter » Wed Feb 03, 2010 8:21 am

Thanks for all the great suggestions. I had no idea that wpa_gui existed. However I'm having some trouble. The gui will show the successful connection if one was made elsewhere, but I can't get it to show anything on a scan, or to make a connection itself. This is even when iwlist wlan0 scan will give scan output. I tried the wpa_cli commands above as well, but not with much success. It often just comes back and tells me it can't connect to the supplicant (sorry don't have exact messages now! :oops: )

One thing I've noticed is that the interface seems to go up and down by itself. I had terrible trouble in the past when using my wired ethernet with wlan0 coming up and trying to make connections, stealing my DNS configuration, etc. I thought it was networkmanager causing the trouble, so I unmerged it, but it didn't stop. wlan0 was like some kind of demonic toy in a slasher movie... I had to keep crushing it down until it would finally leave me alone and let me use the wired port. That was a while ago, but recently.

Now, as I say, I've got this weirdness where I can bring it up with ifconfig wlan0 up (or iwconfig wlan0 up?), and then try to scan and connect, but it just drops out from under me. I have no reason to think there's anything wrong with my kernel/drivers. I have one network fully listed in wpa_supplicant.conf (at my workplace), and this one will connect up and stay up with no problem.

I realize this is all kinda fragmented and hard to make sense of. For me too. I'm hoping it'll ring bells for someone. If not, I'll just have to keep trying over and over every trick in my book until I manage to make connections. Leaving on my trip tomorrow....

(p.s. I have tried wicd, as a matter of fact, and it just didn't work for me. Very unstable and more trouble than it was worth. I'll keep it in mind to try again in the future).
Top
depontius
Advocate
Advocate
Posts: 3533
Joined: Wed May 05, 2004 4:06 pm

  • Quote

Post by depontius » Wed Feb 03, 2010 1:48 pm

The button on the right on wpa_gui is "scan". Press that and it'll pop up a new panel that shows you the networks it can find. You can then pick one of those, click the "add" button and that network will get added to the main wpa_gui network pulldown. (At this point you can close the scan panel, if you want.) Meanwhile the main wpa_gui is cycling through its possible connections, and will eventually get to the one you added. My wireless isn't active now, so I can't give you the whole works exactly, but from somewhere in these panels you can also configure the newly added network, in case you have a key or some such.

I normally keep networks set up in wpa_supplicant.conf for home, work, and Hilton hotels. (My wife is quite fond of Hampton Inns, when we travel.) Anything else, like an airport or other open wifi, I add ad-hoc through the gui.
.sigs waste space and bandwidth
Top
mikegpitt
Advocate
Advocate
User avatar
Posts: 3224
Joined: Sat May 22, 2004 6:49 pm

  • Quote

Post by mikegpitt » Wed Feb 03, 2010 2:18 pm

Punchcutter wrote:It often just comes back and tells me it can't connect to the supplicant (sorry don't have exact messages now! :oops: )
Is wpa_supplicant started? You will need the following in your /etc/conf.d/net:

Code: Select all

modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"
...and then run the follow to start wpa_supplicant:

Code: Select all

/etc/init.d/net.wlan0 restart
Top
doctork
Guru
Guru
Posts: 370
Joined: Sun Apr 25, 2004 12:02 am
Location: Cleveland, OH

  • Quote

Post by doctork » Wed Feb 03, 2010 5:37 pm

Punchcutter wrote:Thanks for all the great suggestions. I had no idea that wpa_gui existed. However I'm having some trouble. The gui will show the successful connection if one was made elsewhere, but I can't get it to show anything on a scan, or to make a connection itself. This is even when iwlist wlan0 scan will give scan output. I tried the wpa_cli commands above as well, but not with much success. It often just comes back and tells me it can't connect
o the supplicant (sorry don't have exact messages now! :oops: )
.
wpa_cli and wpa_gui need to run as root or by a user in a group specified in wpa_supplicant.conf by a statement like:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
As far as wireless stealing your wired connections, you can prevent that with a statement like this in /etc/conf.d/net:

Code: Select all

dhcp_wlan0="nodns nontp nogateway nodomain"
--
doc
Top
Post Reply

8 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic