Skip to content

[Linux] Use Wired Network to Establish WIFI Hotspot to Share with Other Devices

For a long time, because the place where I live is a bit close to the mountain, the signal of the mobile phone is often unstable. This is undoubted a maddening thing when I desperately want to check information.

Just yesterday, when I was about to fall asleep peacefully and play the tablet for 20 to 30 minutes, my phone completely lost the signal, causing my tablet to fail to connect to the wifi shared by the phone.

This is not the first time, but the damn hundredth time.

Ever since, I finally made up my mind to use my laptop as a WIFI base station sharing hotspot. After all, my rental office still has a physical network route.

I searched the Internet and found a very good package: create_ap, here is a handy record of the simple use process.


Use create_ap tool to build a WIFI share hotspot

First we need to git clone from GitHub and make.

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


Install all the package we need.

sudo apt-get install hostapd iptables dnsmasq


Since we need to name of our wired network card to activate the hotspot, we need to use the following command to confirm the card name:

ifconfig

Output:


Take me as an example, lo is the name of my wireless network card, and wlp7s0 is the name of my wired network card. Then, I can use the following command to startup the hotspot of create_ap:

sudo create_ap wlp7s0 lo Clay 77777777

Output:

Config dir: /tmp/create_ap.wlp7s0.conf.wroEZAe9
PID: 19600
Network Manager found, set ap0 as unmanaged device… DONE
Creating a virtual WiFi interface… ap0 created.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp7s0.conf.wroEZAe9/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp7s0.conf.wroEZAe9/hostapd.conf
Using interface ap0 with hwaddr 18:1d:ea:61:7a:30 and ssid "Clay"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED

If you see a message like this being printed, congratulations! Our wireless wifi has been successfully established.


Successfully opened, but cannot be opened again

If this happens, it is recommended to use the htop command to check whether there is a temporary configuration file in the memory of create_ap. If it exists, then kill it. Maybe this file is interfering.


References

Tags:

Leave a Reply