0

I have installed Raspbian using Noobs.

I need to set a static ip address.

The config files on my Pi bears not relation the articles I can find on the internet.

Can anyone point me to a good article or advise me of the settings.

# 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

Thanks for reading.

Mesogi
  • 101
  • 1
  • 1

2 Answers2

1

It might be easier to get the mac address of the device (eg. 1), then assign one using your router (2). This avoids having to dig through config files as long as you have router admin access!

  • +1 I've never really understood the appeal of setting all that using the OS itself... Granted, the router thing isn't always possible, but it is certainly simpler for the majority of people. – Jacobm001 Mar 11 '16 at 00:11
0

This article seems to be pretty detailed and shows exactly what you need to do:

In summary, do:

sudo nano /etc/network/interfaces

Change:

iface eth0 inet dhcp 

TO

iface eth0 inet static

Add:

address <desired_ip>
netmask <run ifconfig -> Mask field>
network <run netstat -> Destination>
broadcast <run ifconfig -> Bcast field>
gateway <run netstat -nr - look for gateway>

then

sudo rm /var/lib/dhcp/*
sudo reboot

To check: ifconfig and make sure you get that ip.

  • Sorry it doesnt. Running the command sudo nano /etc/network/interfaces The output bears no resemblance to the output shown in the webpage –  Dec 29 '15 at 16:46
  • What does your output look like? –  Dec 29 '15 at 16:50
  • Try this: http://sizious.com/2015/08/28/setting-a-static-ip-on-raspberry-pi-on-raspbian-20150505/ – tasasaki Dec 30 '15 at 04:11
  • Thanks very much tasasaki. Good link and good to see its not only me having problems. Network scanning still show 2 addresses, 192.168.10.1 and the one I have allocated. SSH can only connect on the address I assigned. Thanks again. –  Dec 30 '15 at 06:46