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

Some time ago, I was pair programming with a friend. Sadly, the location provided internet access only through network cables. My friend had an Ethernet port, but my newer laptop didn’t :(

He promptly set up a hotspot for me, solving the issue and leaving me bedazzled.

“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 complained.

I believed that a hack must exist; So I asked good ol’ Google. A couple searches later, I managed to find this godsend — create_ap.

Steps

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! Why would you want to do this? 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.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store