Static IP with Raspbian Jessie – A lot have changed!


Hi Everyone!

It has been a long time since i posted something here. Many people have posted about raspberry pi problems and features so I didn’t need to do the same. A lot have changed with r-pi with model 2 and now model 3. I hope the model 3 will put to end a lot of WiFi issues. The reason i am posting now is some of my old code stopped working with new Jessie release. Actually it didn’t stopped working. It just started working weirdly. One of the thing was with static IP.

Earlier static IP was provided in /etc/network/interfaces file. But Jessie comes with dhcpcd so interfaces file is only partially used now. Instead you have to provide static IP in /etc/dhcpcd.conf file from now on.

Let’s say we need to provide wlan0 with an static IP address. /etc/network/interfaces file will be like this –

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual

pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

Your /etc/wpa_supplicant/wpa_supplicant.conf  file will be like this –

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

network={
        ssid="WifiSSID"
        psk="password"
        key_mgmt=WPA-PSK
	id_str="home"
}

A your /etc/dhcpcd.conf file will be like this –

interface wlan0 
static ip_address=192.168.1.2/24 
static routers=192.168.1.1 
static domain_name_servers=8.8.8.8 8.8.4.4

Leave a Comment