Configure static IP on Raspberry Pi

RaspberryPi

RaspberryPi

Some access points does not deliver DHCP to the raspberrypi. You could assign the IP statically as follows:

Edit the /etc/network/interfaces file

Comment out the following lines.

> #allow-hotplug wlan0
> #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
> #iface eth0 inet manual

Add following configs.

auto lo 
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet static
address x.x.x.x
netmask x.x.x.x
gateway x.x.x.x
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B

Re-enable the interface.

ifdown wlan0
ifup wlan0

Configure the name server if required.

/etc/resolv.conf
nameserver x.x.x.x