先查询当前网卡名称:ifconfig

enp0s25   Link encap:Ethernet  HWaddr f4:4d:30:65:7e:e0(本地有线连接)
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:2623 errors:0 dropped:1980 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:187104 (187.1 KB)  TX bytes:6346 (6.3 KB)
          Interrupt:20 Memory:aa100000-aa120000

lo        Link encap:Local Loopback(本地回环)
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:236 errors:0 dropped:0 overruns:0 frame:0
          TX packets:236 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:17158 (17.1 KB)  TX bytes:17158 (17.1 KB)

wlp2s0    Link encap:Ethernet  HWaddr 00:16:eb:38:88:3a(本地无线连接)
          inet addr:192.168.1.12  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:ebff:fe38:883a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:277 errors:0 dropped:0 overruns:0 frame:0
          TX packets:232 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32805 (32.8 KB)  TX bytes:44062 (44.0 KB)

生成WiFi密钥的psk

使用命令wpa_passphrase
root@OrangePi_kali:~# wpa_passphrase ChinaNet-protime Dai13995535567
network={
	ssid="ChinaNet-protime"
	#psk="mengdodo.com"
	psk=11c53fe61e03398cc272abdee2e3e252637db7aab6a764cdd633922fbadbb71a
}

复制好上面psk的值,配置 /etc/network/interfaces

sudo vim /etc/network/interfaces

具体内容

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "ChinaNet-protime"
wpa-psk 11c53fe61e03398cc272abdee2e3e252637db7aab6a764cdd633922fbadbb71a
具体各行配置的意思如下:
auto lo //表示使用localhost
iface eth0 inet dhcp //表示如果有网卡eth0, 则用dhcp获得IP地址 (这个网卡是本机的网卡,而不是WIFI网卡)
auto wlan0 //表示如果有wlan设备,使用wlan0设备名
allow-hotplug wlan0 //表示wlan设备可以热插拨
iface wlan0 inet dhcp //表示如果有WLAN网卡wlan0 (就是WIFI网卡), 则用dhcp获得IP地址
wpa-ssid “你的wifi名称”//表示连接SSID名
wpa-psk “你的wifi密码”//表示连接WIFI网络时,使用wpa-psk认证方式,认证密码

reboot