How to set up a wireless hotspot on Ubuntu?

Member

by lonzo , in category: Networking & Wireless , a year ago

How to set up a wireless hotspot on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by caesar_kertzmann , a year ago

@lonzo 

To set up a wireless hotspot on Ubuntu, you can follow the steps below:

  1. Check if your computer supports creating a hotspot: First, make sure your wireless card supports creating a hotspot. To do this, run the following command in the terminal:
1
sudo iw list | grep -A 8 "Supported interface modes" | grep -oP "^[	s]**[	s]*K.*$"


If you see "AP" listed among the supported interface modes, then your wireless card can create a hotspot.

  1. Install necessary packages: Install the hostapd package and the dnsmasq package. Hostapd is used to create the wireless access point, while dnsmasq is used to assign IP addresses to the devices that connect to the hotspot.
1
2
sudo apt-get update
sudo apt-get install hostapd dnsmasq


  1. Configure dnsmasq: Open the dnsmasq configuration file in the text editor of your choice:
1
sudo nano /etc/dnsmasq.conf


Add the following lines to the end of the file:

1
2
interface=wlan0
dhcp-range=10.0.0.2,10.0.0.30,255.255.255.0,12h


Save and close the file.

  1. Configure hostapd: Create a new hostapd configuration file:
1
sudo nano /etc/hostapd/hostapd.conf


Add the following lines to the file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
interface=wlan0
driver=nl80211
ssid=<your_ssid>
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=<your_password>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP


Replace <your_ssid> with the name you want to give to your hotspot, and <your_password> with the password you want to use to secure the hotspot.


Save and close the file.

  1. Start the hotspot: Start the hostapd service and the dnsmasq service:
1
2
3
4
5
6
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq


Your hotspot is now up and running. Other devices can connect to it using the SSID and password you configured in step 4.