TL;DR: Wireless connectivity on Linux is still prone to issues, no matter what the documentation might claim. This post talks about using your working wireless connection to (ultimately) fix your not working wireless connection on a different machine.
Yesterday, I ended up in a situation where I had to install Debian on a client that wasn’t connected to a wired network. Because it was a small desktop computer, it also didn’t have any wireless capabilities built into it, so I did a little research and ordered a small USB-based Wireless-dongle off the Internet. I specifically made sure that the chipset, a Realtek one, was listed as compatible with Linux.
It’s 2024, the year of the Linux desktop (as per usual) which means that all the claims about Linux compatibility were obviously figments of imagination, and the Debian-installer wasn’t able to detect the adapter. Because of course.
Looking at the output of
dmesg told me that the installer did recognize the
adapter, and even tried to load the appropriate driver, but failed without
giving any non-generic information about why it was failing. Further debugging
didn’t get me any closer to the root cause, and manually trying to load the
kernel module didn’t work out either.
This left me with two options. I could either borrow a very long Ethernet cable from work, and run it straight through the middle of two rooms (which, given that my living arrangements involve two cats and a human partner would be challenging, to put it mildly), or come up with a more creative solution.
Given that I’m a dopamine-deprived and -addicted Millenial, who wants to get this task done with now, and keeping in mind that I’m annoyed, if not outright pissed, I opted for the latter choice.
I first tried tethering via USB-connection to the hotspot of my iPhone, which didn’t work at first try, so I gave up because I really wasn’t in the mood for a further round of debugging things without useful error messages.
So I said “fuck it”, and grabbed my work laptop - which was successfully
connected to my wireless network. Which means I could share this connectivity
by connecting the laptop and the to-be-installed device with a cable directly.
In theory, GNOME (or more specifically,
network-manager) are capable of
sharing connections by checking a simple configuration box in the settings, but
I have been burned by this before, so I went ahead and did the boring thing, by
iptables into submission.
I managed to achieve that in three simple steps:
- Step I: Enable forwarding of network traffic through
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.conf.all.forwarding=1
- Step II: Configure
iptablesto do some NAT-shenanigans:
iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE
- Step III: Configure static IP-addresses for both the wired interface of the laptop and of the benefactor of the shared connection.
Congratulations, you have now successfully shared your network connection with another device. Is this pretty? Almost certainly not. If you’re having a regular contract with an ISP, this most likely means that you are now doing three levels of NAT (Client - Sharing-Laptop -> ISP-box -> CGNAT), which will make every network engineer cry.
But for simply installing Debian and the firmware for the wireless dongle
(which was, by the way, the same
firmware-realtek that the installer tried to
load, only in working condition this time), it works perfectly fine. This
entire process was so simple, easy and flawless that I can wholeheartedly say
that indeed, 2024 is the year of the Linux desktop (still having issues, a lot