[Kubuntu]: Connect To Wireless Through Command Line

KDE 4.3 once again gave me a hard time. KNetworkManager crashed every time I tried to run it. It has something to do with segmentation fault.

Frustrated, I decided to find a way to connect to wireless using command line. After long hours of Googling, I found the solution.

First, you need to list available interfaces:

[email protected]:~$ sudo iwlist scanning

and this will show something similar to the following:

lo        Interface doesn’t support scanning.

eth0      Interface doesn’t support scanning.

eth1      Scan completed :
Cell 01 – Address: 00:97:3G:G1:17:D4
Protocol:IEEE 802.11bg
Frequency:2.412 GHz (Channel 1)
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Quality=77/100  Signal level=-49 dBm
Extra: Last beacon: 364ms ago

pan0      Interface doesn’t support scanning.

As you can see, the interface available for me is eth1. So, in order to connect to my selected wireless network I will run the following command:

[email protected]:~$ sudo iwconfig eth1 mode managed essid MYNETWORK channel 1

If your network have requires WEP key, you will need to add “key” into your command, such as follows:

[email protected]:~$ sudo iwconfig eth1 mode managed essid MYNETWORK key 1234567890abcdef channel 1

Finally to get connected we will use dhclient:

[email protected]:~$ sudo dhclient eth1

This will return something similar to the following:

Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth1/00:15:00:01:77:19
Sending on   LPF/eth1/00:15:00:01:77:19
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to port 67 interval 6
DHCPREQUEST of on eth1 to port 67
DHCPACK of from
bound to — renewal in 897791164 seconds.

To make sure that we are connected to the internet, do a quick ping:

[email protected]:~$ ping google.com

and it will return:

PING google.com ( 56(84) bytes of data.

You are good to go.

Happy geeking 😎

Author: Rashidi Zin

I write code and run on the road.

5 thoughts on “[Kubuntu]: Connect To Wireless Through Command Line”

  1. weird, haven’t been having these problems. knetworkmanager works even with my 3G modem, which has historically always given problems.

Comments are closed.