Sharing your WiFi connection with others (AP enabled wireless cards)

Table of Contents

What?

Say you have two systems: system A has some WiFi connection, and the other (system B) is not connected to the internet. How can we share the connection of A to B?

I assume A is using some Linux installation (preferably Arch but that doesn’t really matter at all); so is B. Furthermore, I assume that A has an AP enabled wireless card (i.e. it can act as an access point)

How?

  1. Check that A has AP capabilities. To do so, install iw and run iw list. Under “Supported interfaces” should be AP. If not, sorry.
  2. Create a separate, managed wireless interface based on your card:
    • Find the name of your card in relation to iw by running iw dev and looking at the first line of output (should be phy0 or something like that). Call it NAME
    • Then run iw $(NAME) interface add $(NAME)_ap type managed
  3. Create an access point using that interface:
    • Install linux-wifi-hotspot (AUR link), which gives you the create_ap script
    • Let $SSID and $PASSWORD be what they obviously mean
    • Run create_ap $(NAME)_ap $(NAME) $(SSID) $(PASSWORD)

Why?

Having recently setup my desktop in my room, I quickly realised the internet connection was abysmal. While near the router I measured a download rate around 1/10th a gigabit per second, in my room it dropped to 0.8 megabits! Even funnier, my laptop was getting an average download rate of 80 MiB per second in the same area! So obviously there was a lot of interference between my desktop and the router.

Now I could setup the desktop closer to the router (i.e. outside my room) or run a 100m Ethernet cable from the router to my room but both those options were not desirable. Instead, why not piggyback on the pretty good connection of my laptop?

With this solution I get a 10MiB connection, which isn’t great, but it’s much better than before.