How to create a Wi-Fi hotspot and use Wi-Fi at the same time on Ubuntu(using my Linux laptop as a WiFi repeater)

Hack Nov 14, 2018

Some time ago, I was pair programming with a friend. The location sadly provided internet access only through network cables. My friend had an Ethernet port, but I didn't (One of the few times I regretted having a newer laptop. At least I still have a headphone jack).

He promptly set up a hotspot for me; Voila, problem solved. "I can simultaneously use WiFi and set up a hotspot on Windows, but it never worked on Linux. I always have to plug in the cable first.", he wondered out loud. Prior to this, I didn't know that was possible at all (Still noobish in networking).

I believed that a hack must exist; So I did what one must always do: ask good ol' Google. A couple searches later, I managed to find this godsend- create_ap.

What should I do?

  1. Install the dependencies. Other than hostapd, you should have most of it installed already:
sudo apt update &&
sudo apt install hostapd

2. Install create_ap:

git clone https://github.com/oblique/create_ap &&
cd create_ap &&
sudo make install

3. Find your Wi-Fi interface's name using the ifconfig command. For me, it's wlp2s0, for older versions it's wlan0.

4. Create the Wi-Fi hotspot! I assume you'll be creating a password-protected Hotspot:

sudo create_ap wlp2s0 wlp2s0 MyHotSpotName MyPassword

That's it! The possible use cases for this are numerous: Maybe you're pretty far away from the router, and your laptop can pick up the signal stably but your phone struggles, or maybe you forgot the network's password but one of your devices is connected to it, etcetera. You can find more ways to use create_ap here.

Tags

Kifah Meeran (MaskyS)

Hi, I'm Kifah, a creator from Mauritius. I read code, books, and people. I'm also passionate about cogsci, design, programming, and life in general. More about me on https://maskys.com

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.