Ever wondered how to set up a static IP on your Raspberry Pi connected via Wireless LAN?
1. Check your current IP and check the current Wifi setup. By default IP is given by DHCP server in your router.
sudo ifconfig
2. Edit your network interfaces file
sudo nano /etc/network/interfaces
3. Add a script segment to setup static wlan
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.88
subnet 255.255.255.0
network 192.168.1.254
broadcast 192.168.255
gateway 192.168.1.254
4. Edit your wpa configuration file
sudo nano /etc/wpa_supplicant.conf
Create this file looking like the following.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=”30Elmtree” #enter your wifi router id
psk=”0433191185″ #enter your password
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
}
5. Exit and save the file: Ctrl + X
6. Restart your Raspberry PI
sudo reboot
7. Test ping from another PC:
ping 192.168.1.88
[post_view]