1

There are a lot of these posts around here but none of them actually solved my problem.

I tried to set up my Pi B to use a static IP in my home network. Here are the things I did so far:

Changed /src/network/interfaces to:

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet static
adress 192.168.1.171
netmask 25.255.255.0
network 192.168.1.0
broadcast 192.1668.1.255
gateway 192.168.1.1

However, regardless how many times I rebooted, ifconfig eth0 gives me the following

Link encap:Ethernet  HWaddr b8:27:eb:74:ab:fa
inet addr:192.168.1.213  Bcast:192.168.1.255  Mask:255.255.255.0
inet6 addr: fe80::d0c7:ac6d:5234:991e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:2074 errors:0 dropped:0 overruns:0 frame:0
TX packets:518 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:122376 (119.5 KiB)  TX bytes:66904 (65.3 KiB)

also, route -ne gives me:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

I can only access the PI through 192.168.1.213.

Any suggestions how I can properly set up the static IP?

Thank you alot

Jqss
  • 13
  • 1
  • 1
  • 4

3 Answers3

3

Do NOT edit /etc/network/interfaces as it have nothing to do with static IP in current version of Raspbian.

Undo every changes you have made.

Put static IP info into /etc/dhcpcd.conf because here is where it belong now :)

interface eth0
static ip_address=192.168.1.171/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

btw, I'm using 171 too, my lucky number, lol

Huy.PhamNhu
  • 418
  • 2
  • 12
  • 1
    I really don't understand why your post has attracted such negative comments. It is fundamentally correct, although it would have been better if you added more explanation and could have been expressed better. – Milliways May 16 '16 at 11:04
3

There are may ways of allocating static IP addresses (although I think there are better ways of managing addresses).

The recommended method for current Raspbian is described in How do I set up networking/WiFi/Static IP

You can use the older tutorials by editing /etc/network/interfaces if you disable dchcpcd. systemctl stop dhcpcd.service

There are a few other methods of managing networks as well.

Milliways
  • 54,718
  • 26
  • 92
  • 182
0

Write address with two d and reboot. Then your pi will be accessable through your static and dhcp address. Disabling the dhcp client will fix this.

How I give the pi a static ip: click in the webinterface of my router on "give this device a static ip"

Motte001
  • 135
  • 1
  • 8