Making Wireless Work from the Command Line

There’s an amazingly horrible piece of software that manages network connections on KDE: knetworkmanager. And with my recent upgrade to Kubuntu Gutsy from Feisty, it has been behaving as wildly as only a chimp could.

So I decided to simply not use it. There are a few workarounds, like deleting all entries from /etc/network/interfaces (on any Debian-based system), except the one for the localhost and then restarting knetworkmanager. It worked for me till I suspended and resumed.

So what I do instead is this (make sure you have entries in /etc/network/interfaces for eth0, eth1, etc. from the backup file in case you tried the workaround).

[If eth1 is your wireless interface]

$ sudo iwlist eth1 scan
< shows a listing of all available wireless networks found >

$ sudo iwconfig eth1 essid “name”

[where name is the name of the wireless network you want to connect to]

Another step to get a DHCP IP assigned might be needed.

$ /etc/init.d/networking restart

This should be possible even with restarting the dhcp, but I’m not sure which one yet.



4 Replies to “Making Wireless Work from the Command Line”

  1. >… and there’s always windoze style [b]shut-noshut[/b] sequence, just in case your wifi refuses to co-operate:

    # To stop wifi
    $ echo 1 > /sys/bus/pci/drivers/ipw2200/*/rf_kill

    # To start wifi
    $ echo 0 > /sys/bus/pci/drivers/ipw2200/*/rf_kill

    As to getting IP, I find this much slick:
    $ dhclient eth1

    BTW, when my signal strength goes down, my n/w switches to my neighbor’s AP. Only way to get it point back to mine is do ‘iwconfig…’ You why it jumps like that?

  2. >Cool! Thanks for these :-)

    As for iwconfig jumping, no idea as of now; there should be some profile setting for setting the affinity of the AP.

    In my opinion, the jumping would be carried out by the wifi manager scripts (like knetworkmanager), so disabling that (which is a good thing anyway) may stop this problem.

Leave a Reply

Your email address will not be published. Required fields are marked *