1

I'm having issues with using a static IP for a Raspberry Pi 3.

What I'm trying to do is connect 4 Raspberry Pis as nodes/slaves to a single Pi which will act as the server/master. I'm using OSC protocol for communication between them which needs each to have a static IP address. I can setup a static IP for each of the Pi's ethernet ports, connect them all via a desktop switch and have them all talk to each other without issues.

The problem comes when I need to troubleshoot or adjust the code running on each of the Pi's. I can get each Pi to connect to a wifi network but I cannot load any pages or download any updates via the apt-get update commands in terminal. I would like to be able to access each Pi over wifi via VNC but seem to be unable to get the wifi to work on the Pi when an ethernet cable in connected to the port.

I've tried to follow the example set here: http://www.knight-of-pi.org/setup-simultanous-ethernet-and-wifi-access-for-the-raspberry-pi-3/

and here: https://www.modmypi.com/blog/how-to-give-your-raspberry-pi-a-static-ip-address-update

No solution found yet.

I know I could connect to each if I connect my computer to the desktop switch, then use VNC over my ethernet port. However, this doesn't solve my issue when I need to update the Pi or download a file.

I've also experienced this issue when I use a Pi to control an LED setup via the Artnet protocol. The ethernet port is connected to a DMX interface box. In this case, a static IP is not needed for the ethernet port since I am only transmitting data to the DMX interface box. However, I still cannot load webpages or run the apt-get upgrade commands. The process seems to be held up on connecting to a server. Again, the Pi is connected to a network but no data can be transmitted. In this example, when I unplug the ethernet cable, wifi works without issue.

Can anyone help explain why I'm running into this issue and what can be done to permanent resolve this?

2

I wanted to update this with what I found to work in case any lost and weary Googlers are running into this issue.

Thanks to @Ingo for the link references metrics. I had no luck in adjusting the metric values for each connection, although this is due to my limited understanding of how internet connections work under the hood. After some other searching, I found a very simple solution. I added this line to my settings for eth0 in my dhcpcd.conf file.

nogateway

Worked like a charm. Now my dhcpcd.conf file looks like:

interface eth0
nogateway
static ip_address=192.168.3.10/24
static routers=192.168.3.1
static domain_name_servers=192.168.3.1

I have my wlan0 settings auto configured and now can access webpages via wifi through a VNC connection over the Pi's ethernet port. I did notice the wlan0 IP address and eth0 IP address must be slightly different. Specifically the 2 to last number. My wlan0 is something like xxx.xxx.1.xxx and the eth0 is xxx.xxx.3.xxx. I'm unsure of exactly why but I'm guessing this puts the two connections on two separate networks. Something like intranet for the eth0 and internet for wlan0. I welcome corrections to this statement.

1

This is a description of a typical issue with routing. I don't know if it is your problem but it is very likely. I don't know what network managing environment do you use but many of them define default routes to each interface by default. The RasPi can use only one default route to the next gateway, means where to send packets with unknown destination. That are most packets to the internet. What default route to be used is defined by its metric. The connection with the lowest metric wins. Wired connections with interface eth0 are considered to be more stable than wireless connections with interface wlan0. So eth0 has mostly a lower metric than wlan0 and internet traffic will go to the subnet behind eth0 but there is no internet connection.

So check with ip route if you have two default routes. If so then delete the unneeded one. For some more information about this you can also look at this answer: How can I stay connected wirelessly online but also set the ethernet to a set ip address to connect to a piece of hardware.

  • Ah I see. For the network managing environment, I'm using a Raspbian Stretch image so I'm guessing its the default network manager for the Stretch OS. Thanks for the link. I will take a look at this tonight to see if it solves my issues. – Justin Apr 30 at 19:24
  • Thanks for the help. Found a solution and updated my post. Feel free to correct anything I stated. – Justin May 1 at 19:58
  • @Justin The answer you have found was exactly the right one by using option nogateway. It just deleted the unneeded default route as I suggested. Because my answer helped you it would be nice if you could upvote it ;-) – Ingo May 1 at 20:59
  • Ahh I see. No problem. Here's an upvote bro. – Justin May 1 at 21:47

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.