6 C
Texas

How To Create Wi-Fi Hotspot on Ubuntu / Debian / Fedora / CentOS / Arch

Today we are going to learn that how we can create a Wi-Fi Hotspot on our Linux systems including the major versions as Ubuntu, Debian , Fedora , CentOS and Arch. For these purposes we will use the nmcli command line network management tool(recommended). Also there are many Desktop environments are also available but we will prefer the CLI method as it is generic and will work on any Decent Linux Operating System.

The nmcli (Network Manager Command Line Interface) is used to control the network Manager & for the purpose of reporting status of network. We can use nmcli to activate, deactivate, display, edit or create a network connection and to control & display network status. Follow the below steps to learn how we can perform this.

Create Wi-Fi HotSpot on Ubuntu / Debian / Fedora / CentOS / Arch
Let’s proceed further to get started

Step 1 : Identifying Network Device

Run the below command to get the name of Network interface.

- Advertisement -
[sabi@localhost root]$ ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:d4:17:18 brd ff:ff:ff:ff:ff:ff
3: virbr0: mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:44:7f:7e brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:44:7f:7e brd ff:ff:ff:ff:ff:ff
[sabi@localhost root]$

My network interface name is ens33 , and it will vary from machine to machine. If it is working, the following command should give you output

$ iw list

Step 2: Creating a new Hotspot

First of all create a network profile for your hotspot

$ IFNAME="ens33"
$ CON_NAME="sabihotspot"
$ nmcli con add type wifi ifname $IFNAME con-name $CON_NAME autoconnect yes ssid $CON_NAME

Step 3: Set Connection Method

Now, set the connection method as shared below.

nmcli con modify $CON_NAME 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared

Step 4: Set HotSpot Password

Definitely you’ll be sharing your hotspot to your knowing one so you need it to be secure to avoid public to use your hotspot. So let’s encrypt it with a strong password.

mcli con modify $CON_NAME wifi-sec.key-mgmt wpa-psk
nmcli con modify $CON_NAME wifi-sec.psk "W1r#4y^oo&sabi(Replace with your pass)"

Now it’s time to start up your connection by running the below command

$ nmcli con up $CON_NAME
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

You can check the connection information by typing the following command

$ nmcli connection show $CON_NAME

Last Step: Confirm IP Information

You can check interface & IP information by running the below command:

nmcli connection show
nmcli connection show
NAME UUID TYPE DEVICE
Hostspot ad31dc08-9175-4fe2-85e3-9f33324e1447 wifi ens33
ip ad show ens33
3: wlp6s0: mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 20:79:18:5e:4b:60 brd ff:ff:ff:ff:ff:ff
inet 10.42.0.1/24 brd 10.42.0.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::a119:b393:761c:d740/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Congratulations! You’ve successfully created hotspot.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

  1. Hi, at con up i got
    Error: Connection activation failed: No suitable device found for this connection (device eth0 not available because profile is not compatible with device (mismatching interface name)).

    I followed to that point. Any ideas ?

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article