User Tools

Site Tools


setuplan

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
setuplan [29.03.2016 14:47]
andreas [Raspian Jessie]
setuplan [29.03.2016 14:48] (current)
andreas [Using /etc/network/interfaces]
Line 1: Line 1:
 +====== How-to setup LAN ======
 +
 +To setup LAN on the RaspberryPi it's quite easy, when just having plugged in the cable and using DHCP; there is usually no additional setup to. With ''​ifconfig''​ you are able to see your current IP.
 +
 +===== Older Raspian =====
 +
 +But if you want to setup a static IP, modify the "/​etc/​network/​interfaces":​
 +
 +<file bash /​etc/​network/​interfaces>​
 +
 +auto lo
 +iface lo inet loopback
 +
 +auto eth0
 +allow-hotplug eth0
 +#iface eth0 inet manual
 +#iface eth0 inet dhcp
 +
 +iface eth0 inet static ​
 +  address 192.168.0.219
 +  netmask 255.255.255.0
 +  network 192.168.0.0
 +  broadcast 192.168.0.255
 +  gateway 192.168.0.254
 +  dns-nameservers 192.168.0.254 8.8.8.8
 +
 +auto wlan0
 +allow-hotplug wlan0
 +iface wlan0 inet manual
 +  wpa-conf /​etc/​wpa_supplicant/​wpa_supplicant.conf
 +
 +auto wlan1
 +allow-hotplug wlan1
 +iface wlan1 inet manual
 +  wpa-conf /​etc/​wpa_supplicant/​wpa_supplicant.conf
 +
 +iface default inet dhcp
 +
 +</​file>  ​
 +
 +Here we have an easy working setup in a class C network setup for eth0.
 +
 +===== Raspian Jessie =====
 +
 +==== Using /​etc/​network/​interfaces ====
 +
 +Within Debian aka Raspian "​Jessie"​ some things changed slightly. A static address cannnot that easy be setup with the procedure above, which is also mentioned at top in ''/​etc/​network/​interfaces''​. There it's now written:
 +
 +<​code>​
 +# 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
 +[...]
 +</​code>​
 +
 +So you have to be aware to make additonal changes in ''/​etc/​dhcpcd.conf'',​ when trying to setup a static IP for ''​eth0''​. When staying with ''​interfaces'',​ adding eth0 to the auto line should be the preferred way, as this might ensure, the IP setup is coming from interfaces. ​
 +For using this, find this row:
 +
 +<​code>​
 +auto lo
 +</​code>​
 +
 +...and replace it with...
 +
 +<​code>​
 +auto lo eth0
 +</​code>​
 +
 +...or simply add a new row as in the former example setup above:
 +
 +<​code>​
 +auto eth0
 +</​code>​
 +
 +Network should work as setup before.
 +
 +For using WiFi aka wlan0, just create an auto-entry or add ''​wlan0''​ in addition:
 +
 +<​code>​
 +auto lo eth0 wlan0
 +</​code>​
 +\\
 +
 +==== Using /​etc/​dhcpcd.conf ====
 +
 +When decided to use ''/​etc/​dhcpcd.conf'',​ at the end of the file the following rows need to be added to add an equal entry as the one from the setup at the top:
 +
 +<​code>​
 +interface eth0
 +static ip_address=192.168.0.219/​24
 +static routers=192.168.0.254
 +static domain_name_servers=192.168.0.254 8.8.8.8
 +</​code>​
  
setuplan.txt ยท Last modified: 29.03.2016 14:48 by andreas