Skip to content

Instantly share code, notes, and snippets.

@SkaTeMasTer
Last active February 13, 2017 08:04
Show Gist options
  • Save SkaTeMasTer/e5750d10c52be4e94dcd1eb0ed4a660a to your computer and use it in GitHub Desktop.
Save SkaTeMasTer/e5750d10c52be4e94dcd1eb0ed4a660a to your computer and use it in GitHub Desktop.
RASPBERRY PI -- NEW METHOD of Setting up a static IP in latest Raspbian. he Raspbian released in May 2015 changed the way networking (and particularly WiFi) works. This applies to the current Foundation releases of Raspbian Jessie and the last Raspbian Wheezy 2015-05-05 (no longer available). This makes all the existing tutorials obsolete.
As of say mid 2015, the introduction of "Wheezy", changed the WiFi settings and obsolessioned all the "HOW TO STATIC IP" articles.
This is how to get a static IP on your RPI.
*** Note: dhcpcd (DHCP client daemon) is not the same as dhcpd (DHCP (server) daemon). ***
https://wiki.archlinux.org/index.php/dhcpcd
Considerations:
+ RPiv3's built-in WiFi does not support 5GHz networks (cannot connect to channels# 12 and 13 on 2.4GHz).
+ Raspbian has the SSH server disabled by default. You will have to enable it manually (as of the November 2016)!
====================
METHOD #1 (new way)
=====================
(STEP #1):
If you are running a recent Raspbian /etc/network/interfaces should be as below. If you have changed it PUT IT BACK.
-----[ /etc/network/interfaces (original) ]------------------------------------------
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
------------------------------------------------------------------------------------------
(STEP #2):
Setup WiFi with the file /etc/wpa_supplicant/wpa_supplicant.conf.
It should contain something like the following:
-----[ /etc/wpa_supplicant/wpa_supplicant.conf ]------------------------------------
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
# home network
network={
ssid="ESSID"
psk="Your_wifi_password"
}
# office network
network={
ssid="OFICEESSID"
psk="Your_wifi_password"
}
------------------------------------------------------------------------------------
====================
METHOD #2 . (Network Interfaces method)
=====================
(STEP #1):
Configure a static network adddress on your Pi in /etc/network/interfaces
-------------------------------------------------------------------
auto eth0
iface eth0 inet static
address 192.168.1.69
netmask 255.255.255.0
gateway 192.168.1.1
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.70
netmask 255.255.255.0
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
-------------------------------------------------------------------
(STEP #2):
# disable the DHCP client daemon and switch to standard Debian networking
sudo systemctl disable dhcpcd
sudo systemctl enable networking
# Reboot for the changes to take effect:
sudo reboot
(STEP #1):
# restart network (without reboot)
sudo service networking restart
# STOP DHCPCD daemon
sudo systemctl stop dhcpcd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment