5

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

 2 years ago
source link: https://computingforgeeks.com/create-wi-fi-hotspot-on-ubuntu-debian-fedora-centos-arch/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Create Wi-Fi Hotspot on Ubuntu

In this guide I’ll walk you through simple steps to create a Wi-Fi Hotspot on Ubuntu / Debian / Fedora / CentOS / Arch Linux machine using nmcli command line network management tool. I prefer this method as there are many Desktop environments as are many Linux distributions. The CLI method is generic and will work on any decent Linux OS.

Other guides we have on nmcli include:

How To use nmcli to connect to OpenVPN Server on Linux

How to Create a Linux Network Bridge on RHEL / CentOS 8

The nmcli (NetworkManager Command Line Interface) command-line utility is used for controlling NetworkManager and reporting network status. You can use nmcli to create, display, edit, delete, activate, and deactivate network connections, and to control and display network device status.

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

Let’s now look at how to create a Wi-Fi hotspot on a Linux machine in 1 minute.

Step 1: Identify WiFi network device

Get a name of the Wi-Fi network interface.

$ ip link show 
1: lo: <LOOPBACK,UP,LOWER_UP> 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: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether e8:6a:64:86:44:cc brd ff:ff:ff:ff:ff:ff
3: wlp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether 20:79:18:5e:4b:60 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:8e:f6:e5 brd ff:ff:ff:ff:ff:ff
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:8e:f6:e5 brd ff:ff:ff:ff:ff:ff
6: br1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:bd:90:53 brd ff:ff:ff:ff:ff:ff
7: br1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master br1 state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:bd:90:53 brd ff:ff:ff:ff:ff:ff

Mine is named wlp6s0, this will surely vary from machine to machine. If it is working, the following command should give you output.

$ iw list

Step 2: Create a new hotspot

Create a network profile for your Hotspot.

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

Step 3: Set connection Method

Set the connection method as shared.

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

Step 4: Set Hotspot password

We don’t want our hotspot open to the public, so let’s set a passphrase for it.

nmcli con modify $CON_NAME wifi-sec.key-mgmt wpa-psk
nmcli con modify $CON_NAME wifi-sec.psk "MyStrongHotspotPass"

Bring up the connection when done.

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

Check a detailed connection information.

$ nmcli connection show $CON_NAME

Step 5: Confirm IP information.

Check interface and ip information.

$ nmcli connection show 
NAME                     UUID                                  TYPE      DEVICE    
Hostspot                 ad31dc08-9175-4fe2-85e3-9f33324e1447  wifi      wlp6s0    

$ ip ad show wlp6s0
3: wlp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 wlp6s0
       valid_lft forever preferred_lft forever
    inet6 fe80::a119:b393:761c:d740/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

You can now scan Wireless connection from your end devices and connect to it.

More guides:

Configure KVM Networking With virsh, nmcli and brctl in Linux

How To Configure 802.1q VLAN Tagging on RHEL / CentOS 7/8 & Fedora Interface

Install Cisco AnyConnect on Ubuntu / Debian / Fedora

How to Configure Network Teaming on CentOS / RHEL 8/7


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK