0

I'm trying to connect three raspberry pi 3 B+ together via ethernet. All three are connected via wlan0 to my wifi network for internet. All are connected via ethernet cables to the same desktop switch, and the physical connections all work (blinking green lights for all)

I have given each a unique static eth0 ip address by editing etc/dhcpcd.conf

when i enter 'ping [static_eth0_address]' in terminal nothing is received... when i enter ifconfig i see that eth0: has no inet address... (however wlan0 DOES, and when i ping a pi's wlan0 address it receives a response)

I can use rdesktop to remotely access other pi's...but that is wlan0 related

My intention: I am trying to set up ONE pi as a mysql server, will run database, and other pi's are clients, and will access database via ethernet. I need each pi to keep its internet connection (via wlan0), but ALSO be reachable via eth0 for mysql purposes.

All pi's have freshly installed latest downloaded raspbian full OS. Only changes I have made so far are to dhcpcd file.

tl:dr How can I get eth0 ip addresses working so that the pi's can communicate over ethernet to each other while preserving each pi's wlan0 connection to my wifi for internet access?

Many thanks for all help! :)

Qntn Yvrny
  • 51
  • 1
  • 1
  • 4
  • 1
    What you are trying is not possible this way. Why to use wired and wireless parallel? Is there a difference between them? Can you get to the internet with a wired connection? – Ingo Jul 19 '19 at 15:10

2 Answers2

0

As I have a comparable set-up, I can assure you that it is possible.

In /etc/dhcpcd.conf, I have:

interface eth0
static ip_address=192.168.178.53/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.6
interface wlan0
static ip_address=192.168.178.3/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.6

For some dark and unknown reason, you still need to edit /etc/network/interfaces to add

allow-hotplug eth0

See https://ljm.home.xs4all.nl/raspberry/1_headless_setup.html#a1.3. (shameless plug for my own website...).

You can give the wired subnet a different IP range than the WiFi and not define a static router on the wired part. Network people will surely protest, an suggest that it is better not to use the same switch as your WiFi for that network (and yes, that is better).

Ljm Dullaart
  • 2,301
  • 7
  • 13
0

Thanks for your reassurance Ljm! I kept chopping at it and got it to work after a few hours. Here's what turned out to be the thing that made it work:

in etc/dhcpcd.conf, you must add a "metric" line right underneath interface like so:

interface wlan0 
metric 100

interface eth0 
metric 300

the wlan0 metric must be less than eth0 metric. soon as i added the metrics in, then ifconfig started showing the inet address of eth0...then i couldn't connect to the internet tho so, because my eth0 is using a static ip_address for mysql server reasons, I had to change the following underneath interface eth0 as well so it knew where to look:

...
static routers=[wlan.IP.address.of.my.wifi.router] 
static domain_name_servers=[wlan.IP.address.of.my.wifi.router]
...

then of course changing etc/mysql/mariadb.conf.d/50-server.cnf to include

bind-address=[my.eth0.static.IP.address]

then everything worked!

.

Qntn Yvrny
  • 51
  • 1
  • 1
  • 4
  • Actually this is the **Brute Force** solution; it may work, but the correct solution is to use `nogateway` on the interface you don't want to use. See [How to set up networking/WiFi](https://raspberrypi.stackexchange.com/a/37921/8697) – Milliways Jul 19 '19 at 23:54
  • the three pi's are all plugged into a dedicated desktop switch (ethernet). this switch isn't plugged into my wifi-router. it's strictly to allow the pi's to communicate with only each other, which is also why static ip addreses are needed. my wifi router is in the other room, so they need wlan0 to be able to get internet access. at least this way, i can perform analysis on stuff in my database by using the three pi's even if i don't have internet, and can set up in a hotel with a wifi and they can each fend for themselves using wlan0... – Qntn Yvrny Jul 20 '19 at 00:32
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Dec 18 '19 at 10:36