id: 12624    nodeId: 12624    type: General    point: 148.0    linkPoint: .0    maker: cella    permission: linkable    made at: 2019.11.01 04:21    edited at: 2023.08.17 08:56
WiFi USB adaptor on Ubuntu Server
https://linoxide.com/linux-how-to/connect-wifi-terminal-ubuntu-16-04/
https://linsoo.co.kr/archives/15553
https://askubuntu.com/questions/294257/connect-to-wifi-network-through-ubuntu-terminal
https://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line
https://stackoverflow.com/questions/35476428/how-to-connect-to-hidden-wifi-network-using-nmcli
https://askubuntu.com/questions/1242256/how-to-configure-wpa-supplicant-in-ubuntu-server-20-04
$ sudo apt update
$ sudo apt install wireless-tools wpasupplicant
$ sudo lshw -C Network
...
*-network:1 DISABLED
description: Wireless interface
...
logical name: wlXXX
...
$ sudo ip a
3: wlXXX: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff

$ sudo ifconfig wlXXX up
OR
$ sudo ip link set wlXXX up

$ sudo lshw -C Network
// now DISABLED disappeared
...
*-network:1
...

$ ls -l /etc/netplan
total 16
drwxr-xr-x 2 root root 4096 Aug 17 03:14 ./
drwxr-xr-x 98 root root 4096 Aug 17 07:40 ../
-rw------- 1 root root 86 Aug 17 03:14 00-installer-config-wifi.yaml
-rw-r--r-- 1 root root 117 Aug 17 03:14 00-installer-config.yaml

$ sudo vi /etc/netplan/00-installer-config-wifi.yaml
# This is the network config written by 'subiquity'
network:
version: 2
wifis:
wlx64e599f45976:
dhcp4: yes
dhcp6: yes
access-points:
"SSID name":
password: "password"

$ sudo netplan generate
$ sudo netplan apply

$ sudo ip a
...
3: wlXXX: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether ... brd ff:ff:ff:ff:ff:ff
inet local_IP ...
....

$ sudo reboot now

After reboot, it takes time (possibly more than minutes) to be able to connect to the wireless connection.

(Mac) $ ssh local_IP

If the new dynamic IP is the same with the that of the old installation, the connection can be failed with a waring message.
Then delete the corresponding row in the file:
$ vi ~/.ssh/known_hosts

And ssh again.




-------- the following is old method --------


$ sudo iwlist wlXXX scan |grep SSID
// but my network is hidden and hence does not appear

$ sudo wpa_passphrase ownet2 <passphrase> > /etc/wpa_supplicant.conf
$ sudo wpa_supplicant -B -iwlXXX -c/etc/wpa_supplicant.conf
// B is fo background running
// but it's not working

// Try with network-manager
$ sudo apt install network-manager
$ sudo systemctl start network-manager
$ nmcli d
DEVICE TYPE STATE CONNECTION
wlXXX wifi disconnected --
...
$ nmcli dev wifi
IN-USE SSID MODE CHAN RATE SIGNAL BARS SECURITY
...

// while doing various thing, the device became unavailable. Maybe this causes problems.
$ sudo nmcli d
DEVICE TYPE STATE CONNECTION
wlXXX wifi unavailable --

// rebooting solves the problem


// from the "man nmcli" see "device" argument section

$ sudo nmcli device wifi connect "<network name>" password <password> ifname wlXXX hidden yes
// NOTE: network name should be in "", password can be passphrase (not hexadecimal)

$ sudo nmcli device
DEVICE TYPE STATE CONNECTION
wlXXX wifi connected ownet2
$ sudo nmcli connection show
NAME UUID TYPE DEVICE
ownet2 ... wifi wlXXX

$ sudo ifconfig
wlXXX: flags=...
inet ...

// inet (local IP address) appears now

// After rebooting, it is still working. No need to prepare some start-up process. Maybe network-manager daemon is working.

Return to WiFi USB adaptor on Ubuntu Server