Raspberry 命令行配置 Wifi

在没有外接显示器的情况下,通过 LAN 连接 Raspberry,然后配置 Wifi。

扫描 Wifi:

$ iwlist wlan0 scan

编辑 wpa_supplicant.conf:

$ sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN

# WPA-PSK
network={
  ssid="WPA_PSK_EXAMPLE"
  psk="password"
  key_mgmt=WPA-PSK
}

# WPA-EAP(WPA2 Enterprise, PEAP)
network={
  ssid="WPA2_PEAP_EXAMPLE"
  key_mgmt=WPA-EAP
  eap=PEAP
  identity="username"
  password="password"
  phase1="peaplabel=auto pepver=auto"
  phase2="MSCHAPV2"
}

以上列举了常用的 WPA-PSK 和 WPA-EAP 配置。

载入配置:

$ sudo wpa_cli reconfigure

查看连接情况:

$ iwconfig wlan0

参考:

  1. https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
  2. http://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf
  3. https://raspberrypi.stackexchange.com/questions/43359/connecting-to-universities-wpa2-enterprise-wifi-network

作者: YanWen

Web 开发者

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s