Can't get my Raspberry Pi to keep a static IP

Posted by JonnyIrving on Super User See other posts from Super User or by JonnyIrving
Published on 2012-12-08T22:10:57Z Indexed on 2012/12/08 23:10 UTC
Read the original article Hit count: 259

Filed under:
|
|
|
|

I recently got given a Raspberry Pi and I would like to be able to remote into it using puTTy from my laptop so I don't have to sit next to my tv with a keyboard and mouse to use it. I am able to get a puTTy session going when I know the IP address that my router has given the Pi on each session but it keeps changing on each reboot as I would expect.

So I followed a number if instruction to go about configuring the RPi to keep a static IP address. This involved changing the file at '/etc/netwrok/interfaces' which now contains (password removed):

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.1.82
netmask 255.255.255.0
gateway 192.168.1.254

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "BeBoxD304BF"
        wpa-psk "**********"

Despite this however, each time I reboot my RPi it gives me a new dynamic IP address still. I also noticed that in the 'ifconfig' output below that the details of the eth0 doesn't contain IP details for inet addr, Bcast or Mask which have been present in all other examples I have seen online.

eth0      Link encap:Ethernet  HWaddr b8:27:eb:b5:95:da
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:87:c6:00:33:77
          inet addr:192.168.1.83  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:918 errors:0 dropped:0 overruns:0 frame:0
          TX packets:277 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000

Also I'm not sure if this is relevant but it can't hurt! The file at '/etc/resolv.conf' contains:

domain config
search config
nameserver 192.168.1.254

..I heard it might mean something on one of the pages I was looking at. I would be very grateful for any help with this. I have tried everything I can think of and would really like to get this working this weekend so I can use it from work.

© Super User or respective owner

Related posts about linux

Related posts about networking