Editing Network Adaptor Settings

Restarting After Changes

After changes to the network interface configuration, you have to restart the network interface using this (assuming the interface is called “eth0”).

sudo ip link set eth0 down && sudo ip link set eth0 up

Assigning A Manual IP Address

For recent versions of Raspbian /etc/network/interfaces should no longer be edited – it must be left as default (all adaptors set to ‘manual’).  Network interface addresses are now being controlled by the DHCP client dhcpcd5 instead of using the interfaces file


sudo nano /etc/dhcpcd.conf

Add this for eth0 or wlan0 with your own settings as required


#ASSIGN A MANUAL IP ADDRESS INSTEAD OF USING DHCP
interface eth0
   static ip_address=192.168.1.20/24
   static routers=192.168.1.1
   static domain_name_servers=192.168.1.1

(The /24 indicates the first 24 bits are also the subnet mask).

By setting ip_address, dhcpcd will then not attempt to obtain a lease and just use the value for the address with an infinite lease time.

Press CTRL+X to save and exit.

You can find more info on the configuration possibilities here.

Manually Configuring WiFi

See here.

DHCP vs Manual IP Settings – Pre Raspbian Jessie (old versions)


iface eth0 inet dhcp

or


iface eth0 inet static
     address ###.###.###.###
     netmask ###.###.###.###
     gateway ###.###.###.###

WiFi Adaptor Setup – Pre Raspbian Jessie (old versions)

First make sure the system is up to date:


sudo apt-get update

Open the interfaces file


sudo nano /etc/network/interfaces

Setup as follows:


auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
     wpa-ssid "YOUR_SSID"
     wpa-psk "YOUR_KEY"

iface default inet dhcp
Alternative Setup – Using A Fixed IP


auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet static
     address 172.27.20.11
     netmask 255.255.0.0
     gateway 172.27.20.1
     wpa-ssid "YOUR_SSID"
     wpa-psk "YOUR_KEY"

iface default inet dhcp
Alternative Setup – Using a hidden SSID and need to specify all of the WiFi settings

auto lo
 
iface lo inet loopback
iface eth0 inet dhcp
 
auto wlan0
allow-hotplug wlan0

iface wlan0 inet dhcp
   wpa-scan-ssid 1
   wpa-ap-scan 1
   wpa-key-mgmt WPA-PSK
   wpa-proto RSN WPA
   wpa-pairwise CCMP TKIP
   wpa-group CCMP TKIP
   wpa-ssid "YOUR_SSID"
   wpa-psk "YOUR_KEY"

iface default inet dhcp
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *