Small series of articles on the implementation of WiFi access points under Linux. We will start with the generalities, mainly the choice, critical, of the adapter. We will then see the bridged and routed networks, and declensions. I will use a Raspberry Pi 2 as a base, it lends itself very well to this kind of manipulation.
Choosing the adapter
The choice of the WiFi adapter is crucial, it will do a lot of work, and will most likely be permanently powered.
The substance is the chip of the adapter that will handle the WiFi. The first essential feature is the AP (Access Point) mode. The chip must handle it, you can imagine, it’s eliminatory. We will see a little later in the article how to make sure that it does.
At Ralink they name their chips in RT5370 or RT5572 format. At Realtek it gives something like RTL8188CUS. The name of the chip allows to compare their characteristics on the web.
MIMO (Multi In, Multi Out) is the ability that the adapter has, or has not, to use multiple WiFi channels in parallel, and therefore to multiply the bandwidth by the number of simultaneous channels that it can use. Often, the manufacturer gives an indication of the type 2T2R, which means 2 channels in transmission, 2 channels in reception. Keep in mind, however, that only two MIMO devices will be able to get these speeds together. A MIMO device and a conventional device will have to go down to speeds that can be used by the classic device.
The MIMO standard stipulates that the device must know how to return to conventional mode if the bandwidth is congested. If you live in a dense area, whose WiFi spectrum is completely occupied by your neighbors, you can forget the MIMO.
Finally, the adapter I chosed manages WiFi at both 2.4 GHz and 5 GHz. This is probably what allows it to work in 2T2R and reach 300 Mbps. That said, driven by a Raspberry Pi 2, I do not expect to speeding. I would still do some benchmarks, for the sake of curiosity.
The shape is the format of the adapter. We are not going to talk here about aesthetics or color, but about the functional side.
Avoid mini-adapters at all costs, they are not suitable for use as access point. Even if some can do it, they will heat up and get to safe mode. Not to mention their range, which will be much lower than that of an adapter with real antennas.
02/03/2016: I add another category of tests on WiFi USB adapters following a fun problem encountered right now at the office. A network adapter generates Soft IRQs when it collects packets in the lower layers of the OSI model. When configuring htop to display detailed CPU times (F2 > Display options > check Detailed CPU time), Soft IRQs appear in purple. With a black 300 mbps Odroid adapter identified
148f:5572 based on the Ralink RT5572; the Soft IRQ load raised abruptly, bursting the ceiling, and not seeming to come down again. To the point of leading to Kernel Panic. By changing the adapter (I had a Wi-Pi on hand), Soft IRQ still existed, certainly, but at a negligible level, which I suppose quite normal (of the order of one percent).
My choice fell on this model, whose picture appears at the beginning of the article, and I’m not disappointed! It works directly on Raspberry Pi, without installation. I chose a MIMO, multi-frequency model because I have ideas in mind for future articles.
We start by looking if the adapter is seen on the USB bus by the system:
Bus xxx Device yyy: ID 148f:5572 Ralink Technology, Corp. RT5572 Wireless Adapter
We proceed by elimination to find the right device. We keep only those we do not already know. WiFi chips are often branded Ralink or Realtek (among others). These devices usually have in their description the words “Wireless” or “802.11” followed by a letter (this is the standard they follow).
Then, to know if it handles the AP (Access Point) mode, we will need the
$ sudo apt-get install iw
That is used like this :
$ iw list | grep AP$
See also the man page iw (8).
If you only have one WiFi adapter plugged in, and you get a line that says “
* AP“, your adapter is compatible. Otherwise, you can dig the result of the command
iw list. It is a bit long, but very informative.
If your shell replies that it does not find
iw when you installed it, you will probably have to specify the full path, usually
/sbin/iw. You can find it using the command
WiFi access points
We will see in dedicated articles the following types of WiFi access points:
The bridged WiFi access point (or Dumb AP), which allows you to add WiFi connectivity to an existing network, with no other new services than negotiation and authentication. It uses existing infrastructure services.
The routed WiFi access point, which extends an existing network with a new subnet dedicated to WiFi. It implements, if necessary, its own infrastructure services (gateway, DHCP server, DNS server, etc.).
Starting from the routed WiFi access point, we can create a development WiFi proxy, to inspect the HTTP network traffic of our mobile devices, whether visible or in the background.
Still starting from the routed WiFi access point, we can also create a multiple WiFi access point. It will allow us to advertise several subnets dedicated to WiFi, which we can then route differently to create a guest network in business, a filtered network for children at home, or any other combination imaginable.