Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Let's say I have a problem with my wireless connection. What commands should I run to share their output with a tech-savvy friend or an online support community?

For example:

  • How can I tell if my wireless card is recognised?
  • How can I get information on which wireless networks are within range?
  • How can I tell if I am connected to a wireless, but not the Internet?

I'm asking this question because I'm seeing many questions about problems with wireless connections, without many details, like this one. It would be useful if I could point to this question so that the asker can improve their question with more information. I'm hoping for a comprehensive answer with all the details, or with links to other generic questions for brevity.

share|improve this question
2  
Great question! We are seeing a lot of "my wifi does not work" type questions. Consolidating the fundamentals in one question will be great. Thanks. –  user68186 Jan 4 '13 at 14:54
2  
I think I have done some work on this in My WiFi adapter is not working at all. Where to start troubleshooting? very recently. It only covers your first and imo most important example sub-question. See the Identifying the exact hardware part in particular. See also chat discussion starting here. –  gertvdijk Jan 4 '13 at 17:11
add comment

2 Answers

To check if the card is recognized, run:

sudo lshw -C network

or

lspci -nnk | grep -iA2 net

The second command is useful, as it shows the vendor and product IDs [8086:4222]:

~$ lspci -nnk | grep -iA2 net
06:00.0 Network controller [0280]: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection [8086:4222] (rev 02)
    Subsystem: Hewlett-Packard Company PRO/Wireless 3945ABG [Golan] Network Connection [103c:135c]
    Kernel driver in use: iwl3945
    Kernel modules: iwl3945

Example - card recognized, brand and model are correctly identified, correct driver is in use (driver=iwl3945), and wireless connection is established (ip=192.168.2.81):

sudo lshw -C network
[sudo] password for hp: 
  *-network               
       description: Wireless interface
       product: PRO/Wireless 3945ABG [Golan] Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:06:00.0
       logical name: wlan0
       version: 02
       serial: 00:13:02:c8:d2:75
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwl3945 driverversion=3.2.0-35-generic firmware=15.32.2.9 ip=192.168.2.81 latency=0 link=yes multicast=yes wireless=IEEE 802.11abg
       resources: irq:45 memory:80000000-80000fff

To see the networks within range, just click the network icon in the panel. If you prefer a command, run nm-tool.

To make sure you are connected to a wireless, but not an ethernet network, first identify the wireless interface (usually wlan0, eth1 or eth2) by looking at the output of sudo lshw -C network. Then, look for an IP address to tell which interface is connected.

share|improve this answer
add comment

Two diagnostic tools I find invaluable to pinpoint the root cause in cases where the WiFi works, but is unreliable, e.g. intermittently losing the connection, sessions hanging, web-pages freezing are iwlist and mtr. Here's how to use them most effectively:

1) Is the low-level wireless reception/transmission healthy:

watch sudo iwlist wlan0 scan

This gives a treasure trove of information about the strongest wireless signals detected by your card. I find the Channel, Frequency, ESSID, Quality, and Signal level, the most useful.

Assuming the ESSID is known and the quality is good (say about 30%-100% of the maximum) you may move to the second stage:

2) Once a WiFi connection is established, is the connection stable?

Since TCP/IP supports error-detection, with retransmits and congestion control, WiFi disconnects/reconnects are usually a result of a large number of errors to the point where TCP gives-up. Rather than waiting for a full disconnect, which may happen only once in several minutes, I run mtr in a separate window and continuously watch the Loss% (packet percent loss) and Avg (average round-trip time in miliseconds) columns:

mtr <hostname>

While looking at this screen, I can immediately see not just whether there's some ongoing transmission/reception problem, but also which link along the way is the most problematic/slow one, in case there's more than one hop between me and the target <hostname>.

If you dont have mtr installed, try: sudo apt-get install mtr.

I find these two tools particularly valuable because I can quickly change configuration, for example:

  • Edit /etc/network/interfaces and then ifdown wlan0 && ifup wlan0
  • Reload drivers: modprobe ...
  • Restart the network: service networking restart
  • Reorient the WiFi card antenna
  • Change the wireless iterface MTU: ifconfig wlan0 mtu 1472
  • Disable the card power-saving ability
  • Adjust my access point transmission power, preferred channel number, bandwidth, ...
  • Turn my repeater off, wait, turn it on again

etc. etc. and immediately see the effect of my change in the continuously updating screens. Since there are so may knobs you can experiment with, the most critical thing is to be able to see the immediate effect of the change. If it makes no difference (most cases in my experience), just note it down, and revert to the previous value. But if you suddenly see the Loss% rates jump up, or the signal strength sharply drop, you know you've found a smoking gun.

Rapid experimentation is the key to be able to quickly diagnose issues

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.