Raspberry Pi Raspberry Pi wireless NIC configuration [multiple method alternatives]
To make the Raspberry Pi convenient operation, it is necessary to configure the wireless network card, which can greatly enhance the mobile and convenience of Raspberry Pi, in fact, the configuration of wireless network card is basically the same as the normal Linux platform configuration wireless network card, several methods are similar, the following:
One, the first method: through the configuration of the/etc/network/interfaces file implementation
sudo nano/etc/network/interfaces
The contents of the modified file are as follows:
Auto Lo
Iface Lo inet Loopback
Iface eth0 inet DHCP
Auto Wlan0
Allow-hotplug Wlan0
Iface Wlan0 inet DHCP
Wpa-ssid "Your WiFi name"
WPA-PSK "Your WiFi password"
The specific line configuration means the following:
Auto Lo//indicates use of localhost
Iface eth0 inet DHCP//Indicates if there is a network card ech0, then use DHCP to obtain an IP address (this network card is the local network card, not the WiFi network card)
Auto Wlan0//indicates that if there is a WLAN device, use the WLAN0 device name
Allow-hotplug Wlan0//indicates that the WLAN device can be hot-swappable
Iface wlan0 inet DHCP//indicates that if a WLAN card is wlan0 (that is, the WiFi network card), the IP address is obtained with DHCP
Wpa-ssid "Your WiFi name"//indicates the connection SSID name
WPA-PSK "Your WiFi password"//means to use WPA-PSK authentication method when connecting WiFi network, authentication password
After the above definition, if there is a network cable connection, then take the DHCP automatic connection to obtain the address, using the command
sudo/etc/init.d/networking restart
After success, you can see the wlan0 device with the Ifconfig command, and have the IP address (connected)
Two, the second method: modify sudo nano/etc/wpa_supplicant/wpa_supplicant.conf implementation
Ctrl_interface=/var/run/wpa_supplicant
Ctrl_interface_group=0
ap_scan=2
network={
ssid= "WiFi name"
Proto=wpa2
Key_mgmt=wpa-psk
Pairwise=tkip
Group=tkip
psk= "WiFi Password"
}
Then modify the file sudo nano/etc/network/interfaces, and modify the contents of the file as follows:
Auto Lo
Iface Lo inet Loopback
Iface eth0 inet DHCP.
Auto Wlan0
Iface Wlan0 inet DHCP
Pre-up Wpa_supplicant-b-dwext-iwlan0-c/etc/wpa_supplicant/wpa_supplicant.conf
Post-down Killall-q Wpa_supplicant
After the modification is complete, restart the network using the following command
sudo/etc/init.d/networking restart
After success, you can see the wlan0 device with the Ifconfig command, and have the IP address (connected)
Note: Both of these methods we are using DHCP dynamic IP, if you want to set the static IP method and the method to connect the hidden SSID AP:
(1) Set the static IP:
Modify Files sudo nano/etc/network/interfaces
Auto Lo
Iface Lo inet Loopback
Iface eth0 inet DHCP
Allow-hotplug Wlan0
Iface Wlan0 inet Manual
Wpa-roam/etc/wpa_supplicant/wpa_supplicant.conf
Iface default inet static
Address 192.168.1.2
Netmask 255.255.255.0
Gateway 192.168.1.1
Dns-nameservers x.x.x.x #你的本地dns地址
(2) Connecting WiFi does not broadcast hidden SSID:
After Ssid= "XXXX" Add a line scan_ssid=1 after restart, as follows:
sudo nano/etc/wpa_supplicant/wpa_supplicant.conf
Ctrl_interface=/var/run/wpa_supplicant
Ctrl_interface_group=0
ap_scan=2
network={
ssid= "Network ID"
Scan_ssid=1
Proto=wpa2
Key_mgmt=wpa-psk
Pairwise=tkip
Group=tkip
psk= "Password"
}
After rebooting, you can connect to a wireless network that does not broadcast the SSID.
Raspberry Pi Route (012)-About Raspberry Pi Raspberry Pi Wireless card configuration