Linux configurations related to wifi hosting

Yuta Fujii
5 min readFeb 12, 2022

This is a series of posts of building wifi access point on Kali Linux, with Raspberry Pi.

For hosting procedure, please read the previous article.

Now, I would like to explain some basic background knowledge related to WiFi hosting regarding Linux wise. Here are the topics I’ll cover:

What is Kali Linux?
Linux directory structure
Drivers
Troubleshooting

What is Kali Linux?

Kali Linux is a Debian-based Linux distribution geared towards various cyber security tasks, such as penetration testing.

Kali Linux is an open-source, Debian-based Linux distribution geared towards various information security tasks, such as Penetration Testing, Kali Linux is an open-source, Debian-based Linux distribution geared towards various information security tasks, such as Penetration Testing, Security Research, Computer Forensics and Reverse Engineering.

Official Site

It comes with a number of useful tools for finding network-related vulnerabilities, such as Wireshark, which is installed right from the start. Very useful for studying networking and security. There is similar os named Parrot OS (I’ve only used it in a VM, but the background image is beautiful.).

Of course, you don’t have to necessarily use Kali Linux for WiFi access point hosting, especially for commercial or practical use (since Kali is not light weight). But whatever distro you choose, the procedure is basically the same.

Linux Directory Structure

As the saying goes, “Everything in Linux is a file.” In Linux, everything is treated as a file. Physical devices are virtualized as files in /dev, and processes and system resources are virtualized as files in /proc.

Basic Directory Structure

You may want to know the following directories:

/etc Manages various configuration files such as DNS, Hostapd, etc.
/lib/modules/ to store and load drivers
/proc/sys/net Changing the IP layer behavior

By the way, the Linux man command is highly recommended to understand the directory structure.

Driver

The driver is the software that runs the hardware.

This time, I used a TP-Link network adapter, and aircrack-ng’s 8188eus driver to host WiFi.

Compared with Windows, in Linux it’s rare you need to install drivers. This is because Linux is developed as OSS, and major peripheral manufacturers develop drivers for Linux and add them as libraries.

Then, why we needed to install driver manually this time?

Truth be told, technically you can host WiFi with incorporated wireless network adapter of Raspberry Pi (then pass traffic to wired LAN and take them to the Internet).

But Pi-Incorporated adapter cannot run as Monitor mode. What is that?

To begin with, network adapters have multiple boot modes. You can check the details in man iwconfig. You can also see which mode all Wireless NICs (Network Interface Cards) are running in with iwconfig.

As I was building WiFi access point as study, I also want to demonstrate some pentesting tools which need Monitor mode running adapter.

Since Pi-Incorporated adapter cannot run as monitor mode, I bought a network adapter called TP-Link which enables me that.

The trouble was that Kali Linux has a driver installed from the beginning to run network adapters for TP-Link. However, that driver was only available in Managed/Master mode. Therefore I reinstalled it.

Troubleshooting…When the driver does not work properly

If the TP-Link driver does not work properly, please check the following points in order.

  1. Is the Raspberry Pi correctly recognizing the TP-Link device: lsusb
$ lsusb

Bus 001 Device 003: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS].

If TP-Link does not appear, the kernel does not recognize the device in the first place, so please check if the USB connection or extension cable is compatible with the port (USB 3.0, etc.) you are using.

2. Check if the driver is correct: airmon-ng

$ airmon-ng
PHY Interface Driver Chipset
phy0 wlan0 8188eu TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS].
phy1 wlan1 brcmfmac Broadcom 43430

This command is from a library used for network vulnerability testing. You may need to install this command if you are not using Kali Linux.

The output shows the driver for each WiFi chip, the one I bought from TP-Link is 8188eu, but if you see a different driver, please follow installing a driver chapter of previous post.

3. Check that the kernel recognizes the driver: lsmod, modprobe

$ lsmod

binfmt_misc 24576 1
brcmfmac 339968 0
8188eu 1355776 0
brcmutil 24576 1 brcmfmac
cfg80211 798720 2 8188eu,brcmfmac

The output lists kernel modules. If “8188eu” is not seen, the kernel does not recognize the driver. Please try adding the driver to the kernel modules with the following command.

$ modprobe 8188eu

On the other hand, if “8188eu” is displayed in lsmod, but the subsequent hosting does not work, please check if the built-in installed driver with the same name “8188eu” is still there, and remove it if it is. Also, run rmmod 8188eu once to remove it from the kernel modules just in case (don’t worry, this command will not remove the driver itself).

That’s it!

Happy WiFi hosting! 🚀

--

--

Yuta Fujii

Web developer, Data analyst, Product Manager. Ex investment banker( structured finance ). Learn or Die.