# Cannot access raspberry pi with static ip

**URL:** <https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220>\
**Category:** Hardware\
**Created:** [7 May 2020 08:59 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220 "2020-05-07T08:59:24Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 07:31 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/23 "2020-05-08T07:31:34Z")

</div>

> [@Trying\_to\_learn](#):
>
> The subnet mask and the default gateway as shown shouldn't work.  
> Because the address for the gateway is in the wrong range

When you ping a device on the same subnet it should send it directly to the addressed device. The gateway address is irrelevant. That is why we need more information showing how the pi is configured, and what request the PC is sending when it pings it. As @gerry says it is either bad hardware or misconfigured device.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [8 May 2020 07:33 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/24 "2020-05-08T07:33:17Z")

</div>

I shall relinquish to your knowledge.

But he hasn't really answered my questions with clear indications of what happens with what.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 08:44 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/25 "2020-05-08T08:44:47Z")

</div>

First of all I carry my IP set into 192.168.150 block.

Node-red is running on rpi. In Rpi I can access node-red . SSH is enabled.

> You haven't clarified what happens if you have a `switch` between the devices and what happens with the `router` .

When I use switch I cannot access RPi in any way. I can just see ip address of rpi on IP Scanner program but when I tried to ping it it doesn't respond. when I use router I can access node-red from my PC

On rpi side  
[https://ibb.co/y4J6KGX](https://ibb.co/y4J6KGX)

 ![pcip](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c0b1b06993d3dff358873004188c8a674d65b770.png) ![ping to rpi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/894f265e7ddf20bd0bc9a9ec2f38fa54dd708a74.png)

> [@Trying\_to\_learn](#):
>
> Is it a `managed` switch, or a `non-managed` switch.

I guess my switch is non-managed. It says 10/100Mbps Desktop Switch

> [@Trying\_to\_learn](#):
>
> And when using it: Is there an _uplink_ else where?

There is no uplink else where.

There is a detail that get my attention. I plug my devices into switch and I connect switch to router via ethernet cable. System worked. and then I remove router, system continued to work without problem. This problem pops up whenever system starts without router.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [8 May 2020 08:49 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/26 "2020-05-08T08:49:58Z")

</div>

> [@RednodeNewbie](#):
>
> There is no uplink else where.

That is a bit strange.

A router is used when you are using different IP ranges and need to connect them.  
There is a _local_ side and the _uplink_ which gets any IP addresses which are outside the _local_ range.

So, using a program to show the rpi's IP is _active_ doesn't really mean much - to me.

If the rpi is plugged in, you should be able to `ping` it. `Switch` or `Router`.

With the `switch` plugged into the rpi:  
open a CLI (terminal) and enter the command:  
`sudo ifconfig`

What do you see? Is `eth0` set to the correct IP address?

Can you ping the pc from the rpi?  
Just to see if it works the other way.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 09:00 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/27 "2020-05-08T09:00:23Z")

</div>

> [@Trying\_to\_learn](#):
>
> What do you see? Is `eth0` set to the correct IP address?

eth0: inet 192.168.150.10 netmask: 255.255.255.0 broadcast 192.168.150.255

When I try to ping from pc to rpi or vice versa, doesn't respond to each other

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 09:02 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/28 "2020-05-08T09:02:28Z")

</div>

> [@RednodeNewbie](#):
>
> I plug my devices into switch and I connect switch to router via ethernet cable. System worked. and then I remove router, system continued to work without problem. This problem pops up whenever system starts without router.

It seems that one of the devices does not like starting up without a router. To find which:

1. Connect up with switch and router and check everything works.
2. Remove router and check still works.
3. Reboot the PC and see what happens.

Then repeat, 1, 2 and then reboot the Pi instead.

Finally repeat 1 and 2 then power cycle the switch.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [8 May 2020 09:11 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/29 "2020-05-08T09:11:51Z")

</div>

One other thing you could try:  
(Sorry @Colin)

The `router` **must** have an IP address.

See if you can ping the router from either/both machines.

To keep things followable:  
The `switch` between the two machines does **not** work.  
The `router` between the two machines works - but I saw you were posting some conditionality about that.

Get the rpi or the pc.... connect which ever to the `router`.  
Ping the router and get it working to that point.  
Plug the other machine in.  
Ping between the two machines.

This makes sure that you have a working IP connection.

With that working, unplug **one** of the machines: (rpi or pc)  
put the `switch` between the `router` and the _just unplugged_ device.

From that device, see if you can ping the `router`.  
I am suspicious the `switch` is broken.  
If it doesn't work, you can play _swap ports_ on the `switch` and see if you can find two working ports - if you want to spend the time doing that.

But if when you put the `switch` between the `router` and a device, and the device can no longer ping the `router`, I'd say the `switch` is the problem.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 09:15 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/30 "2020-05-08T09:15:10Z")

</div>

> [@Trying\_to\_learn](#):
>
> The `switch` between the two machines does **not** work.

It does, provided the switch is also connected to the router upstream. The hardware works, and continues to work even if the router is removed. One of the devices does not like booting with no gateway connected.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 09:16 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/31 "2020-05-08T09:16:25Z")

</div>

Something else to check is to look in syslog on the pi after booting with no router and see what it says about networking.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 09:26 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/32 "2020-05-08T09:26:03Z")

</div>

> [@Colin](#):
>
> 1. Connect up with switch and router and check everything works.
> 2. Remove router and check still works.
> 3. Reboot the PC and see what happens.
> 
> Then repeat, 1, 2 and then reboot the Pi instead.

I tried what you said. First 3 step are successful. I reboot my pc there is no problem I can connect to rpi.I reboot rpi and then rpi turned out unreachable again. It seems I have a problem with rpi.

I also tried after removing router then I unplug ethernet cable of Rpi then plug it , Again I cannot access Rpi.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 10:05 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/33 "2020-05-08T10:05:58Z")

</div>

Is the router connected to the internet? If so then try the tests with it not connected to the internet.

Otherwise:

> [@RednodeNewbie](#):
>
> I also tried after removing router then I unplug ethernet cable of Rpi then plug it , Again I cannot access Rpi.

Repeat that sequence but then before pugging it back in run, in a terminal,  
`tail -f /var/log/syslog`  
and then plug it in and see what it says. That assumes you have a keyboard and display on the pi of course.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 10:35 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/34 "2020-05-08T10:35:15Z")

</div>

> [@Colin](#):
>
> Is the router connected to the internet? If so then try the tests with it not connected to the internet.

There is no internet connection in network.

Yes I have them. I wrote that piece of code, output :

**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**  
**dhcpcd [502] : eth0: received approval for 192.168.150.10**

says just ten times.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 May 2020 10:44 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/35 "2020-05-08T10:44:59Z")

</div>

looks like the router is also serving out dhcp addresses - which the switch would not do - so the device that needs a dhcp address isn't getting one from the switch only config and thus can't ping.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 10:51 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/36 "2020-05-08T10:51:10Z")

</div>

Yes just as you said. looks like something has to serve out dhcp address in the network or else devices are not be able to recognize each other

Edit: After 20 min of writing syslog code, another 2 line of info appears like :

**dhcpcd[502] : eth0 : deleting route to 192.168.150.0/24**  
**dhcpcd[502] : eth0 : deleting default route via 192.168.150.1**

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [8 May 2020 11:01 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/37 "2020-05-08T11:01:44Z")

</div>

If he can ping in one configuration then not in another that suggests his hardware is operational unless there is an intermittent failure of some sort. If indeed everything has a fixed ip the DHCP is irrelevant. As @dceejay points out something is trying to configure via DHCP so somewhere there is a misconfiguration of his fixed ip's. If he truly has a switch/hub available then for his local network there is no need for the router at all. I would take it out put it on a shelf, lock the door and leave it alone. Set the default gateway to the pi's ip address so everything on the network gets routed there first, triple check the ip settings that everything is set to fixed ip's and have another go. As a suggestion go with pi address, 192.168.1.100 subnet class C 255.255.255.0, default gateway 192.168.1.100,--- pc 192.168.1.101 subnet 255.255.255.0, default gateway 192.168.1.100, any other devices increment ip addresses up one number but point everything at the pi's address for a default gateway. No router, no internet, wireless turned off. And wear a tin foil hat just in case, kidding about the hat. But seriously make sure all wireless is off as that could grab a spurious ip address and route your packets somewhere else, no bluetooth either if so equipped. Get this down to just a basic network.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 May 2020 11:02 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/38 "2020-05-08T11:02:18Z")

</div>

well you should be able to set them all to static addresses if you like, but the procedure will vary for each different device.

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [8 May 2020 11:19 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/39 "2020-05-08T11:19:15Z")

</div>

The procedures will vary but the settings are all the same type, IP address, subnet mask and default gateway. He needs to get a handle on the settings as it sounds like a DHCP problem to me at this point, I don't see how it could be much else as the hardware seems to be working.

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 11:24 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/40 "2020-05-08T11:24:47Z")

</div>

> [@gerry](#):
>
> As a suggestion go with pi address, 192.168.1.100 subnet class C 255.255.255.0, default gateway 192.168.1.100,--- pc 192.168.1.101 subnet 255.255.255.0, default gateway 192.168.1.100, any other devices increment ip addresses up one number but point everything at the pi's address for a default gateway. No router, no internet, wireless turned off. And wear a tin foil hat just in case, kidding about the hat. But seriously make sure all wireless is off as that could grab a spurious ip address and route your packets somewhere else, no bluetooth either if so equipped. Get this down to just a basic network.

I did all of these but disappointment again. is it possible the way I set static ip is wrong ? in order to do that, I write **sudo nano /etc/dhcpcd.conf** and configure that file. That file includes :

interface eth0  
inform 192.168.1.100/24  
static routers=192.168.1.100  
noipv6

Also to set static ip, it is told to use **/etc/network/interfaces** command. I use current raspbian. How I should set static ip correctly ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 May 2020 11:24 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/41 "2020-05-08T11:24:56Z")

</div>

> [@RednodeNewbie](#):
>
> eth0: received approval for

@RednodeNewbie how did you set a fixed ip address? Did you use the GUI or edit conf files?

---

<div class="post-metadata">

**Author:** ![RednodeNewbie](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RednodeNewbie](https://discourse.nodered.org/u/RednodeNewbie)\
**Post date:** [8 May 2020 11:28 UTC](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220/42 "2020-05-08T11:28:23Z")

</div>

Both ways actually but lastly using GUI

[Previous page](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220.md?page=1)

[Next page](https://discourse.nodered.org/t/cannot-access-raspberry-pi-with-static-ip/26220.md?page=3)
