In a previous article, I had written about how to configure a static IP but I had not mentioned how to setup the Wi-Fi adapter to select a hotspot automatically and apply the IP address.
We need to edit the /etc/network/interfaces file. Mine looks like this:
[code]
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.102
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
[/code]
Here I setup both the adapters with static IP address but I add the wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf for the wpa configuration that we speak of.
My file looks like
[code]
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="TP-LINK"
psk="PASSWORD"
# Protocol type can be: RSN (for WP2) and WPA (for WPA1)
proto=WPA
# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK
# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
pairwise=TKIP
#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
auth_alg=OPEN
}
[/code]
You can replace the ssid with your router name and the password for your access point.
Reboot and you should be done! I am not sure how what it will do without the specified access point but it works for me so...
Cheers
Friday, December 27, 2013
wifi
Home
auto connect
Raspberry Pi
static Ip
Tutorials amp; Guides
wi-fi
wifi
RPi Wi-FI Auto Connect and static IP
No comments:
Post a Comment