0

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 192.168.0.29
PING 192.168.0.29 (192.168.0.29) 56(84) bytes of data.
From 192.168.0.35 icmp_seq=1 Destination Host Unreachable
From 192.168.0.35 icmp_seq=2 Destination Host Unreachable
From 192.168.0.35 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.0.29 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
1

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
0

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 | |
0

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

or

#Static IP Block interface eth0 static ip_address=192.168.0.200/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1

http://sizious.com/2015/08/28/setting-a-static-ip-on-raspberry-pi-on-raspbian-20150505/

| improve this answer | |
0

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
address 192.168.0.29
gateway 192.168.0.254
netmask 255.255.255.0

EDITED TO ADD

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.