I want to set up the networks on my raspberry, I tried to do it the static way:

I opened a terminal on the pi, wrote:

what I did

That is to say, I wrote static instead of what was written before (which was not dhcp if remember). And wrote down address, gateway and netmask only changing the two last digits of the adress from the one I had written on my computer.

Yet, when I try to ping the given adress I receive no response...

:~$ ping
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable
--- ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3016ms
pipe 3
  • You have set the wired eth0 connection to be static. Is that what you intended? Or are you trying to set a static wlan0 (wireless) address? – joan May 17 '16 at 15:40
  • @joan no, I'm looking for a wired connection therefore a wired address I assume. – Revolucion for Monica May 17 '16 at 15:43

The answer was found at pihw.wordpress.com, all I had to do was

sudo ifconfig eth0 the.add.ress.togive

If you have better answer I would accept then, else I would answer my own question

| improve this answer | |
  • Also, e.g., ip addr add x.x.x.x/24 dev eth0, since as per the man page ifconfig should be considered "obsolete" on linux. However, I am sure it will continue to be viable into perpetuity anyway. Beware to use a CIDR suffix (/24 or /16) with ip addr or it defaults to /32, which is probably not useful in most circumstances. – goldilocks May 17 '16 at 17:58
  • There is no need to be coy about your IP address. The addresses are private and not routable outside your network. – Milliways May 17 '16 at 23:23

There are many ways of allocating static IP addresses. You don't mention which OS you are using.

See How do I set up networking/WiFi/Static IP for a tutorial for latest Raspbian.

| improve this answer | |

you can either add denyinterfaces eth0 to /etc/dhcpcd.conf and configure it with /etc/network/interfaces


#Static IP Block interface eth0 static ip_address= static routers= static domain_name_servers=


| improve this answer | |

If you want to do this in /etc/network/interfaces you need to add the information immediately after the eth0 declaration, e.g.

iface eth0 inet static


As pointed out by @milliways this answer is wrong if dhcpd is enabled (the default for jessie).

| improve this answer | |
  • This does not work in Jessie, unless you disable dhcpcd. (actually it does allocate an address, but so does dhcpcd leaving an indeterminate state). – Milliways May 17 '16 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.