Use the Wi Fi management tool in the upper right corner of the menu bar to connect to Wi Fi, as shown in the figure below.
Click on the Wi Fi name you want to connect to, and then enter the Wi Fi password in the pop-up dialog box.
For users using the Ubuntu Server version system, wireless network configuration can be completed through the command line, as follows.
x
sudo nmcli device wifi rescan # Scan WiFi network
sudo nmcli device wifi list # List the WiFi networks found
Enter the following command to connect to the specified WiFi network.
xxxxxxxxxx
sudo wifi_connect "SSID" "PASSWD"
When the terminal returns the message 'successfully activated', it indicates that the WIFI connection is successful.
If the following message is returned after connecting to the hotspot, it means that the hotspot was not found. You can execute the sudo nmcli device wifi rescan command to rescan and connect again.
xxxxxxxxxx
root@ubuntu:~# sudo wifi_connect "WiFi-Test" "12345678"
Error: No network with SSID 'WiFi-Test' found.
The wired network of the development board defaults to a static IP configuration, with an initial IP address of "192.168.1.10".
The static network configuration of the development board is saved in the file '/etc/network/interfaces'.
By modifying fields such as' address',' netmask ',' gateway ', etc., the static IP configuration can be modified.' metric 'is the network priority configuration, set to' 700 'to lower the priority of wired networks.
When both wired and wireless networks are enabled, wireless networks will be prioritized. For example:
xxxxxxxxxx
sudo vim /etc/network/interfaces
xxxxxxxxxx
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
metric 700
After the modification is completed, enter the sudo restart_network
command on the command line to make the configuration take effect.
The wireless network of the development board runs in Station mode by default.
If you need to use Soft AP mode, please follow the steps below to configure it.
hostapd
和 isc-dhcp-server
xxxxxxxxxx
sudo apt update
sudo apt install hostapd
sudo apt install isc-dhcp-server
Run the command 'sudo vim/etc/hostapd.conf' to configure 'hostapd.conf'`
xxxxxxxxxx
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=sunrise
channel=6
ieee80211n=1
hw_mode=g
ignore_broadcast_ssid=0
The default way to open the hostapd.conf file is as shown in the picture: (Configure a password free hotspot, which can be left unchanged).
xxxxxxxxxx
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=Sunrise
channel=6
ieee80211n=1
hw_mode=g
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=12345678
Press i to enter editing mode, press Esc to exit editing mode after editing, press wq to write and close.
Configure the 'isc-dhcp server' file, as follows.
xxxxxxxxxx
INTERFACESv4="wlan0"
Press i to enter the edit mode. After editing, press Esc to exit the edit mode. Press :wq to write and close.
sudo vim /etc/dhcp/dhcpd.conf
modify dhcpd.conf
file, cancel the following comment.xxxxxxxxxx
authoritative;
Press i to enter the edit mode. After editing, press Esc to exit the edit mode. Press :wq to write and close.
/etc/dhcp/dhcpd.conf
file.xxxxxxxxxx
subnet 10.5.5.0 netmask 255.255.255.0 { *#Network segment and subnet mask*
range 10.5.5.100 10.5.5.254;*#Available IP range*
option subnet-mask 255.255.255.0; *#Subnet mask*
option routers 10.5.5.1;*#Default gateway*
option broadcast-address 10.5.5.31;*#Broadcast address*
default-lease-time 600;*#Default lease duration, unit:s*
max-lease-time 7200;*#Maximum lease term,unit:s*
}
Press i to enter the edit mode. After editing, press Esc to exit the edit mode. Press :wq to write and close.
Stop wpa_supplicant
service,re-start wlan0
xxxxxxxxxx
sudo systemctl stop wpa_supplicant
sudo ip addr flush dev wlan0
sleep 0.5
sudo ifconfig wlan0 down
sleep 1
sudo ifconfig wlan0 up
Follow the steps below to start the hostapd
service.
Run sudo hostapd -B /etc/hostapd.conf
command.
xxxxxxxxxx
root@ubuntu:~# sudo hostapd -B /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
Using interface wlan0 with hwaddr 08:e9:f6:af:18:26 and ssid "sunrise"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
Use the ifconfig command to configure the IP and network segment of the wireless interface wlan0.
Note: Keep it consistent with the configuration in step 3.
xxxxxxxxxx
sudo ifconfig wlan0 10.5.5.1 netmask 255.255.255.0
```
Finally, turn on the DHCP server and connect to the hotspot, which will assign an IP address between 10.5.5.100 and 10.5.5.255 to the client.
xxxxxxxxxx
sudo systemctl start isc-dhcp-server
sudo systemctl enable isc-dhcp-server
Connect to the development board hotspot sunrise
If you need to switch back to Station
mode, you can do as follows.
xxxxxxxxxx
# Stop hostapd
sudo killall -9 hostapd
# Clear the address of wlan0
sudo ip addr flush dev wlan0
sleep 0.5
sudo ifconfig wlan0 down
sleep 1
sudo ifconfig wlan0 up
# Restart wpa_supplicant
sudo systemctl restart wpa_supplicant
# Connect to WiFi. For details, please refer to “1. Connect to WiFi”