Skip to content

Instantly share code, notes, and snippets.

@sadra-barikbin
Last active January 16, 2022 18:10
Show Gist options
  • Save sadra-barikbin/423922a21fd007d388e40709a7ebf16b to your computer and use it in GitHub Desktop.
Save sadra-barikbin/423922a21fd007d388e40709a7ebf16b to your computer and use it in GitHub Desktop.
How to make a WiFi dongle as hotspot/access point in Linux Ubuntu
#Put this script into the /etc/init.d directory
#This action needs sudo privilege.
#Don't forget to do `sudo chmod +x **this-script.sh**` beforehand.
nmcli dev wifi hotspot ifname **interface-name** ssid **hotspot-name** password **pwd**
#Append lines below to the file /etc/network/interfaces
allow-hotplug **interface-name**
iface **interface-name** inet manual
up /etc/init.d/make-wifi-dongle-as-hotspot.sh
@sadra-barikbin
Copy link
Author

By doing so, whenever you plug your WiFi dongle in, it automatically turns into a hotspot/access point and other devices can connect to it.
Furthermore if you have been connected to a VPN connection beforehand, The traffic of connected devices will be routed through the VPN.

This Gist is tested on Ubuntu18.04 and Ubuntu20.04 by a TP-Link dongle and also with a OpenVpn VPN connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment