Speeding up wireless internet on Crunchbang 11

On a recent new install of Crunchbang 11 I was having major problems connecting to my router with a Ralink RT3370 wireless USB dongle from my main tower. After investigating and playing around, this is my list of changes which got me sorted:

1. AES vs TKIP Encryption:
Connect to the router and change the WPA2 encryption from AES to TKIP. My first suspicon about the lack of connection was the encryption method and maybe the latest RT3370 drivers and wpasupplicant. After changing to TKIP I could connect, allbeit with a slow connection due to packet loss.

2. Move Adapter from USB2 to USB3:
Moved the Dongle from the front USB2 connector to a blue USB3 connector at the back, and I noticed a slight speed increase. After these hardware changes, it was time to go for some terminal-fu and edit a few files to get some extra internet speed.

3. Firstly I edited /etc/nsswitch.conf:
sudo vim /etc/nsswitch.conf
I commented out the original line:
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
And changed it to:
hosts: files dns

4. Next I disabled ipV6 in Iceweasel:
In the address bar I typed “about:config” and changed “network.dns.disableIPv6” to “true” with a double-click.

5. Next up was to disable ipV6 system wide:
echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

6. Adaptor Power Management:
Another thing I had heard is that sometimes powercontrol can interfere with wireless speed as well so I disabled it for the USB dongle:
sudo iwconfig wlan0 power off

7. Swap nm-applet and network-manager for a Manual Static Wireless Connection:
First I disabled nm-applet from autostarting:
sudo mv /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/BKPnm-applet
Then I stopped Network Manager:
sudo /etc/init.d/network-manager stop
And completely Disabled it:
sudo echo "manual" | sudo tee /etc/init/network-manager.override

8. Just needed to add my manual network config:
sudo vim /etc/network/interfaces
Added my wifi info:
auto wlan0
iface wlan0 inet static
address 192.168.1.136
netmask 255.255.255.0
gateway 192.168.1.1
wpa-ssid ROUTER_ESSID
wpa-psk MYPASSWORD

Then manually added the Google dns addresses:
sudo vim /etc/resolv.conf
And add these:
nameserver 8.8.8.8
nameserver 8.8.4.4

Rebooted into a system with awesome internet cow-power-fu speeds!!

Wireless-Only installs with Debian, Crunchbang and Kali Linux – Missing Non-Free Firmware

Wireless Network
I changed my entire network over to wireless and my router is now fixed to the wall, 25 meters away from my office, in my lounge. The wireless from my office reaches ok, and means we have a stronger signal from the lounge where we have our XBMC media center and everybody connects with their smart phones.

Wireless PCI/USB cards and Non-Free Drivers
Due to the fact that some manufacturers won’t release the source code for their drivers (Thank you Broadcom and Ralink!!) we still have a bit of a hard time, even though Linux geniuses have reverse engineered and hacked practically all of them for us so we can load wireless modules from the kernel.

Politics and Freedom
Some distros willingly provide non-free drivers right from the get-go, others are more conservative and stick to Stallmanesque non-free restrictions. Debian does this…. still…. in 2013.


Debian Live Builder
I’ve built my own Debian based distros, and like other distros which are built with this system, mainly Crunchbang and just recently Kali Linux (The New “Debian-Based” Backtrack).

Live Yes – Install No
I recently got a bit of a surprise with some Live installs, as I found that when running both Crunchbang and Kali live, my Ralink wireless USB firmware was loaded and allowed me to connect to the internet, but when I went for the install, at the network configuration step, I was told that the firmware was missing!!

Solution
When this stage happens:
1. Take a picture of the screen on the Debian Installer which tells you which files you need from /lib/firmware. In my case “rt2870.bin” and “rtl8168e-3.fw”.

2. Insert a blank USB Pendrive
3. Reboot the Live CD to get to the Live Session
4. Copy the two needed files from /lib/firmware on the Live CD to the Pendrive
5. Reboot and run the installer

The Debian Live installer will detect the firmware on the Pendrive, load it, and allow you to choose your wireless ESSID and WPA key, and continue the install.

There’s no time like now for the old adage “You learn something new every day”.

May all you fellow wireless-only users, now be able to install any Debian-based distro without being put off by this minor freenoyance.

Unofficial Debian Wheezy Netinstall with Non-Free Wireless Firmware

Wireless Network
As I am on a completely wireless home network, with about 25 meters separating my office computer from the router in my lounge, I went on a hunt for a Debian Netinstall iso with wireless firmware already added.

Non-Free Wireless Firmware Included
I remember a while back I came across a Squeeze version. Luckily for me, there is also a Wheezy version too!

Here:
http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/wheezy_di_rc1/amd64/iso-cd/firmware-wheezy-DI-rc1-amd64-netinst.iso

 

Broadcom BCM4311 problem on Debian, Mint, Ubuntu

The STA driver does not work properly for the BCM4311 in Mint/Ubuntu/Debian.
The Restricted Driver Manager only gives you the Broadcom STA driver as an option.

Yesterday got asked by a friend to remove Ubuntu from his 5-year-old laptop. It’s a 64bit, 1Gb Ram machine, with an Nvidia graphics card and Broadcom wireless.

I was pretty certain that the 64bit Linux Mint 12 would just work out of the box, even though i’ve had problems with the Broadcom firmware on other machines (wireless cutting out and needing to be restarted)
The install went fine, and I went straight to the “Restricted Drivers manager” for Nvidia and Broadcom. The STA driver was recommended so I installed it. Only to find it would work.

My laptop at home works ok with the older B43 module, so I went the traditional route and installed that instead.

Install:

sudo apt-get install firmware-b43-installer b43-fwcutter

Then unload both modules:

sudo modprobe -r b43 wl

Now reload the B43 module:

sudo modprobe b43

If when you reboot, the B43 module doesn’t get loaded:, just add it to “modules”:

sudo vim /etc/modules

and add b43 at the end of the list. Now it’ll load at boot.

The STA module may also load at boot, so just blacklist it by adding it to the blacklist:

sudo vim /etc/modprobe.d/blacklist.conf

and it like this:

blacklist wl

Now reboot, and you’ll have Broadcom 4311 wireless working.

Howto Quick n Easy Manual Wireless Wpa2 PSK

Manual Commandline Network setup:

So this guide is for those of you who only connect to the same router via Wpa2/Psk encrypted wireless. Although if you want to, you can scan and connect to any wireless connection manually using the wireless-tools suite of scripts.

Wireless setup via a Gui:

If you regularly roam and need to search for and connect to different wireless connections, i’d suggest you install wicd-gtk, it’s in most Linux distro repositories. There’s also network-manager-gnome which provides the nm-applet gui. I prefer the manual method as the gui apps tend to write over system config files. For example, nm-applet removes your dns configs in /etc/resolv.conf.

Wireless Firmware:

Ok, you need to have your wireless drivers installed and working. I’m using a Broadcom BCM4138, whose drivers are supplied via the “firmware-b43-installer” which fetches the firmware from openwrt.

More on B43 herehttp://linuxwireless.org/en/users/Drivers/b43#b43_and_b43legacy

Next up you need to authenticate with Wpa using PSK TKIP, this is accomplished by installing wpasupplicant:

sudo apt-get update

sudo apt-get install wpasupplicant

Now you need to edit a couple of files:

sudo vim /etc/network/interfaces

Supposing your wireless card is called wlan0, and you want a static IP address you add this:

auto wlan0
iface wlan0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid youressid
wpa-psk yourpassword

Just to make sure you can surf the net, check your dns config. I put my router IP and the Google Open DNS IP as well.

sudo vim /etc/resolv.conf

And add:

nameserver 192.168.0.1
nameserver 8.8.8.8

Now to connect, you only have to issue one command, then every time you login after that you will automatically be connected:

sudo ifup wlan0

That’s it, no need for Gui applications sucking resources and overwriting important files. Just a quick and easy auto-connected wireless every time you bootup.

Broadcom Open Sources Linux Wireless Drivers

Well, it’s been a long time coming, but kudos to Broadcom for finally open sourcing their wireless drivers!

Official Announcement:

From: Henry Ptasinski
Subject: [ANN] Full-source Broadcom wireless driver for 11n chips
Newsgroups: gmane.linux.kernel.wireless.general, gmane.linux.drivers.driver-project.devel
Date: 2010-09-09 15:10:06 GMT (5 hours and 42 minutes ago)
Broadcom would like to announce the initial release of a fully-open
Linux driver for it’s latest generation of 11n chipsets. The driver,
while still a work in progress, is released as full source and uses the
native mac80211 stack. It supports multiple current chips (BCM4313,
BCM43224, BCM43225) as well as providing a framework for supporting
additional chips in the future, including mac80211-aware embedded chips.
The README and TODO files included with the sources provide more
details about the current feature set, known issues, and plans for
improving the driver.

The driver is currently available in staging-next git tree, available at:

git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git

in the drivers/staging/brcm80211 directory.


Henry Ptasinski
henryp@…

From: http://thread.gmane.org/gmane.linux.kernel.wireless.general/55418

Wireless IEEE 802.XX Standards – What are they?

Practically everybody has at least one Wireless enabled laptop or desktop, so what do all those IEEE specifications mean?

Here is a list and explanation of the more common IEEE 802.XX Standards:

IEEE 802.XX Glossary:

802.11 – This early wireless standard provides speeds of up to 2 Mbps. Because 802.11 supports two entirely different methods of encoding – Frequency Hopping Spread Spectrum (FHSS) and Direct Sequence Spread Spectrum (DSSS) – there is often incompatibility between equipment. 802.11 has also had problems dealing with collisions and with signals reflected back from surfaces such as walls.

802.11a – This is an extension of the 802.11 standard and uses a different band than 802.11b and 802.11g – the 5.8-GHz band called Unlicensed National Information Infrastructure (U-NII) in the United States. Because the U-NII band has a higher frequency and a larger bandwidth allotment than the 2.4-GHz band, the 802.11a standard achieves speeds of up to 54 Mbps.

802.11b – This extension of the original 802.11 standard boosts wireless throughput from 2 Mbps to 11 Mbps. It can transmit up to 100 m under good conditions, although this distance may be reduced considerably by obstacles such as walls. This upgrade has dropped FHSS

in favor of the more reliable DSSS. Settling on one method of encoding eliminates the problem of having a single standard that includes two kinds of equipment that aren’t compatible with each other. 802.11b devices are compatible with older 802.11 DSSS devices but are not compatible with 802.11 FHSS devices. 802.11b is currently the most widely used wireless standard.

802.11g – 802.11g is an extension to 802.11b and operates in the same 2.4-GHz band. It brings data rates up to 54 Mbps using Orthogonal Frequency-Division Multiplexing (OFDM) technology. Because 802.11g is backward compatible with 802.11b, an 802.11b device can interface directly with an 802.11g access point. You may even be able to upgrade some newer 802.11b access points to be 802.11g compliant via relatively easy firmware upgrades

802.11i – 802.11i addresses many of the security concerns that come with a wireless network by adding Wi-Fi Protected Access (WPA) and Robust Security Network (RSN) to 802.11a and 802.11b standards. WPA uses Temporal Key Integrity Protocol (TKIP) to improve the security of keys used with WEP, changing the way keys are derived and adding a message-integrity check function to prevent packet forgeries. RSN adds a layer of dynamic negotiation of authentication and encryption algorithms between access points and mobile devices. 802.11i is backwards compatible with most 802.11a and 802.11b devices, but loses security if used with non-802.11i devices.

802.11n – The next standard in development is IEEE 802.11n. This new standard offers far higher speeds than current standards. Speed projections are at least 100 Mbps, but they could go up to 320 Mbps. The standard isn’t expected to be ratified until November 2006.

802.11X – This refers to the general 802.11 wireless standard – b, g, or i. It is not to be confused with 802.1X, a security standard.

802.15 – This specification covers how information is conveyed over short distances among a Wireless Personal Area Network (WPAN). This type of network usually consists of a small networked group with little direct connectivity to the outside world. It is compatible with Bluetooth 1.1.

802.16 – IEEE 802.16, was ratified in January 2001. It enables a single base station to support many fixed and mobile wireless users. It is also called the Metropolitan Area Network (MAN) standard. 802.16 aims to combine the long ranges of the cellular standards with the high speeds of local wireless networks. Intended as a – last-mile – solution, this standard could someday provide competition for hard-wired broadband services such as DSL and cable modem. 802.16 operates in the 10- to 66-GHz range and has many descendants.

802.16d – This recent standard – also called the IEEE 802.16-2004 standard or WiMax – can cover distances of up to 30 miles. Theoretically, a single base station can transmit hundreds of Mbps with each customer being allotted a portion of the bandwidth. 802.16d may use either the licensed 2.6- and 3.5-GHz bands or the unlicensed 2.4- and 5-GHz bands.

802.16e – This is based on the 802.16a standard and specifies mobile air interfaces for wireless broadband in the licensed bands ranging from 2 to 6 GHz.

802.20 – Specifies mobile air interfaces for wireless broadband in licensed bands below 3.5 GHz.

802.1X – 802.1X is not part of the 802.11 standard. It is a sub-standard designed to enhance the security of an 802.11 network. It provides an authentication framework that uses a challenge/response method to determine if a user is authorized.

Stunning Breakthrough in Wireless Reception Technology

Helios’ writing style makes this one of my favourite posts so far this year! Relating his friend’s “Skip “skipsjunk.net” Guenter’s” state of the art Wireless Booster. I have created many wireless “enhancers” over the years, from the wireless hackers’ favourite, the “Cantenna” to small USB dongle enhancers, but this one really is a gem.

http://linuxlock.blogspot.com/2009/11/stunning-breakthrough-in-wireless.html

Note the surgical precision by which Guenter cut and splayed the metal mesh to insert the highly developed usb wireless adaptor extension.

Yes, I know…it’s breath-taking. Drink in the precision of its placement. Understandably overwhelming, I know.

Besides the giant black zip ties don’t show up so well at night and nobody has a lens that’ll show the nail jammed between the sheet metal roof and the 2×4 beam it’s hanging from.

Well, you get the idea. A hacked together botch job described with an over-flamboyant artistic freedom which made this post hilarious to me.

Screenshot:

skips-wireless-booster


Linux Wireless Card Command Line Help

wireless

Here is a list of Cli commands which provide valuable information when trying to configure    your wireless connection

sudo iwlist scanning – shows wireless networks that are available in the area with basic encryption information

sudo lshw -C network – Shows Details of Interface card and drivers of each networking device

sudo lspci -nn – Shows PCI vendor and device codes as both numbers and names of hardware connected to the pci bus

lsusb – Shows USB connected hardware

lshw -C usb – Additional info on USB related hardware (good for USB dongles)

route -n – Lists kernel IP routing table — Good for troubleshooting problems with the gateway

sudo route add default gw 192.168.1.1 – Example of how to set the default gateway to 192.168.1.1

sudo route del default gw 192.168.1.1 – Example of how to delete the default gateway setting

sudo modprobe ***** – Loads the kernel module **** . (Example usage – sudo modprobe ndiswrapper, sudo modprobe r818x, sudo modprobe ath_pci)

sudo modprobe -r **** – Unloads the kernel module ****. (Example usage – sudo modprobe -r ath_pci)

sudo ifconfig – lists IP address

sudo ifup/ifdown – Brings up/down the interface and clears the routing table for the specified interface

sudo ifconfig wlan0 up/down – Brings up/down the interface for the specified interface

sudo dhclient – Request IP address from DNS server for specified interface

sudo dhclient -r – Release IP address associated with specified interface

sudo iptables -L – Lists firewall rules

sudo iptables -F – Flush all firewall rules

dmesg | more – Lists boot log — good for troubleshooting problems with modules/drivers not being loaded

uname -r – Displays kernel version

/etc/udev/rules.d/70-persistent-net.rules – File which assigns logical names (eth0, wlan0, etc) to MAC addresses

cat /etc/resolv.conf – Lists DNS servers associated with network connections (Network Manager)

/etc/dhcp3/dhclient.conf – File which sets or modifies dns (domain name servers) settings

How to Automatic Wireless Network Connection At Boot

This howto relies on the fact that your card is recognized and working.
[b]No network auto-connection at boot[/b]
If you configure your network and when you reboot, the operation has to be repeated, it’s because your network configuration data hasn’t been/isn’t being stored.

I have already shown how to configure a network manually via the command line, now you need to know where to store the data so that everything connects automatically at boot.

[b]Nano text editor:[/b]
*note* I use the text editor “Nano” it edits text inside the terminal with no need to open an external GUI application like Gedit, Kate or Mousepad. You can use what you prefer, but I will add the commands for Nano as well.
[b]
/etc/rc.local[/b]
The rc.local file is a script which will run at boot and issue any commands that you add. In this case, we are going to issue the network config commands and connect.
[b]
Howto:[/b]
1. Open your terminal to edit the “rc.local” file.

sudo nano /etc/rc.local

[b]It will be empty apart from a description:[/b]

#!/bin/sh -e<br />#<br /># rc.local<br />#<br /># This script is executed at the end of each multiuser runlevel.<br /># Make sure that the script will "exit 0" on success or any other<br /># value on error.<br />#<br /># In order to enable or disable this script just change the execution<br /># bits.<br />#<br /># By default this script does nothing.<br /><br />exit 0<br /><br />

You need to add your commands between the last [b]#[/b] and the [b]exit 0[/b] code:

I connect through a wireless network, with a 13 digit “ascii” wep key, I need the “s:” before my key to denote ascii. You may only need to type your key if it is a 64/128bit wep key.

[b]Mine looks like this:[/b]

#!/bin/sh -e<br />#<br /># rc.local<br />#<br /># This script is executed at the end of each multiuser runlevel.<br /># Make sure that the script will "exit 0" on success or any other<br /># value on error.<br />#<br /># In order to enable or disable this script just change the execution<br /># bits.<br />#<br /># By default this script does nothing.<br />sudo iwconfig wlan0 essid WLAN_XX<br />sudo iwconfig wlan0 mode managed<br />sudo iwconfig wlan0 key s:xxxxxxxxxxxxx<br />sudo /etc/init.d/networking start<br /><br />exit 0<br />

Now when you reboot, this script will run and connect your network card.