Ubuntu Server 22.04 Wifi Setup CLI: Difference between revisions

From CompleteNoobs
Jump to navigation Jump to search
Created page with " ==Find wifi card name== First, make sure that your Ubuntu server has a wifi adapter installed. This is usually a small device that plugs into a USB port or is built into the computer. If you're not sure if your server has a wifi adapter, you can check the documentation or ask someone who knows more about computers. <br> <code>sudo lshw -C network</code><br> <div class="toccolours mw-collapsible mw-collapsed"> Other methods to find wifi card: <div class="mw-collapsible-..."
 
(No difference)

Latest revision as of 21:45, 29 March 2023


Find wifi card name

First, make sure that your Ubuntu server has a wifi adapter installed. This is usually a small device that plugs into a USB port or is built into the computer. If you're not sure if your server has a wifi adapter, you can check the documentation or ask someone who knows more about computers.
sudo lshw -C network

Other methods to find wifi card:

ls /sys/class/net

iwconfig requires installing wireless-tools
sudo apt install wireless-tools

OutPut from sudo lshw -C network:

  *-network DISABLED        
       description: Wireless interface
       product: RTL8723BE PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlp2s0
       version: 00
       serial: 40:e2:30:0e:8e:07
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtl8723be driverversion=5.15.0-69-generic firmware=N/A latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:17 ioport:e000(size=256) memory:d0700000-d0703fff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: enp3s0
       version: 0c
       serial: fc:aa:14:6c:a9:33
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.15.0-69-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.0.167 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:18 ioport:d000(size=256) memory:d0604000-d0604fff memory:d0600000-d0603fff

Turn on wifi adapter

My adapter was called wlp2s0
sudo ip link set wlp2s0

Connect to wifi using network-manager nmcli

Requires network-manager package.
sudo apt install network-manager

Now that your wifi adapter is turned on and working, you can use the "nmcli" command to connect to a wifi network. To see a list of available networks, run the following command:
nmcli device wifi list

Connect to wifi

Once you've found the network you want to connect to, you can use the following command to connect:
sudo nmcli device wifi connect SSID password PASSWORD

Note: Replace "SSID" with the name of the network you want to connect to, and "PASSWORD" with the password for that network.

For example, if you wanted to connect to a network called "MyWifi" with a password of "1234", you would run the following command:
sudo nmcli device wifi connect MyWifi password 1234

If the connection was successful, you should see a message saying that you are now connected to the wifi network. You can confirm that you are connected by running the following command:
nmcli device status
This will show you information about your network connections, including whether you are connected to wifi.
And that's it! Those are the steps to connect an Ubuntu 22.04 server to wifi. If you have any questions or run into any problems, feel free to ask someone who knows more about computers for help.

Disconnect from wifi

Syntax:nmcli device disconnect WIFI

sudo nmcli device disconnect wlp2s0

Turn off wifi card

sudo ip link set wlp2s0 down