PGTS G. Patterson.   T/A PGTS ABN: 99885392845

point Site Navigation

point Other Blog Threads



  Valid HTML 4.01 Transitional

   Stop Spam! Stop Viruses!
   Secure And Reliable Ubuntu Desktop!

   Ubuntu

   If you own a netbook/laptop~
   Download Ubuntu Netbook!






PGTS Humble Blog

Thread: Tips/Tricks For Programming etc

Author Image Gerry Patterson. The world's most humble blogger
Mission Accomplished -- George Bush, 2003.

Some Handy Commands For Setting Up Wi-Fi


Chronogical Blog Entries:



Date: Wed, 5 Feb 2025 08:10:22 +1100

Setting up wi-fi with the command line.

As I re-vamp and re-cycle hardware [made redundant by the Windows 10 EOL SNAFU], I am relying more on wi-fi networks to enable connection with numerous screens that have chromecast compatible software.

We use a Metgear router that publishes 3 SSIDs in the same subnet. One of them a 2.4 GHz network for older style devices and two 5 GHz networks for more modern style devices. In this case the units being added are all Linux computers, either mini computers or laptops, running some variant of Ubuntu. These are included in the wi-fi eco system by switching the router into "Accept all new devices" and then configuring the computer to connect to the 2.5 GHz network and adding the primary 5GHz network as an optional extra. And then, when the connection is tested and confirmed, switching the router back to "Block all new connections".

This could be done manually via the GUI. However for modern systems, running a variant of Ubuntu greater than 22.04, it is easier to copy the details from /etc/netplan from an existing system that is setup correctly and then running "netplan apply" on the target system.

For example, the source system might have files like the following in /etc/netplan

  -rw-------   1 root root   179 Dec 15 10:09 50-cloud-init.yaml
  -rw-------   1 root root   716 Jan 25 23:28 90-NM-1a243fb0-1121-4e3c-8858-2355650435fb.yaml
  -rw-------   1 root root   716 Jan 25 23:46 90-NM-6c2fac59-9e67-4b53-9191-2b5e25308e40.yaml

Depending on the age of the system and how it has been configured, there may be more entries. The file 50-cloud-init.yaml may be present. Or it may not. You might see a file called 01-network-manager-all.yaml instead. The name of the file does not really matter. The important part of the name is the first two characters. This determines the order in which the netplan config files are applied. The files that begin with '90-' would have been created with the GUI selection: Settings->Wi-Fi and contain details of how to connect to the 2.4 GHz and 5 GHz SSIDs

You can check the config files by examining the contents with 'vi' or 'cat' [as 'root']. If the two files begining with "90-" appear to be the files that you require, you can copy them to the target system and then after checking for possible conflicts in the existing files, run "netplan apply" on the target system. There are numerous man page entries for netplan, that can assist with customisation of the config files.

Below are some convenient commands that can be used to assist with this process:

   # List Hardware
     lshw -C network.

   # Show wireless extensions, including the ESSID (network name),
   # frequency, and Access Point MAC address.
     iwconfig

   # A concise command to specifically list the active SSID.
     nmcli -t -f active,ssid dev wifi

   # Display active connection name (SSID), UUID, type, and device.
     nmcli connection show --active

   # List available Wi-Fi networks [current marked with (*)]
     nmcli dev wifi

   # Check Interface Status
   # This replaces ifconfig. [now deprecated]
     ip addr show 

   # Check Signal Quality of a specific interface.
     iwconfig <interface>

   # For example, if you determined, with some of the above commands,
   # that the name of interface is wlp3s0, use the following:
     iwconfig wlp3s0 | grep -i signal.

   # Show wifi password --- Also create a QR code that can be scanned by
   # an Android phone
     nmcli device wifi show-password

   # Bring wireless up or down
     ip link set dev wlp3s0 down
     ip link set dev wlp3s0 up

  # If you install "nmap", you can probe wireless subnets.
  # For example, if your wireless router has been setup as a gateway on
  # 10.0.0.1, you can probe this subnet. Note: You may need to connect
  # nmap to network-control before doing this.
    nmap -sn 10.0.0.1/24



Other Blog Posts In This Thread:

Copyright     2025, Gerry Patterson. All Rights Reserved.