0

I have a RaspberryPi set-up through wifi to work as a samba server (external harddrive). It works great and all my devices can connect to it. I also have an old laptop I'm setting up as an Ubuntu Kodi media client that is currently accessing the files through samba via wifi too.

So 2 devices, both on wifi, and one accessing the files from the other through samba and it works fine. But the 2 devices are literally next to each other, and I'm wondering if it's possible to connect them with an ethernet cable and instead of file sharing via wifi and samba, if I can do the filesharing via the cable. The tricky part is to still have both devices get the internet through wifi individually.

I added the following to /etc/dhcpcd.conf but once I connect the ethernet, I still lose connection and can't even ping the static ip address.

interface eth0
static ip_address=192.168.1.24/24
static routers=192.168.1.1
static domain_name_servers=127.0.0.1
nogateway

interface wlan0
static ip_address=192.168.1.15/24
static routers=192.168.1.1
static domain_name_servers=127.0.0.1

Pi-4 Without the cable plugged in:

default via 192.168.1.1 dev wlan0 proto dhcp src 192.168.1.15 metric 303 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.1.0/24 dev wlan0 proto dhcp scope link src 192.168.1.15 metric 303

Pi-4 With the cable plugged in:

default via 192.168.1.1 dev wlan0 proto dhcp src 192.168.1.15 metric 303 
169.254.0.0/16 dev eth0 scope link src 169.254.89.13 metric 202
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.168.1.0/24 dev wlan0 proto dhcp scope link src 192.168.1.15 metric 303

The other Ubuntu laptop with the cable plugged in:

default via 192.168.1.1 dev wlp2s0 proto dhcp metric 600 
169.254.0.0/16 dev wlp2s0 scope link metric 1000 
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.16 metric 600
  • What Pi? Yes it would be possible but what do you expect to achieve? – Milliways May 14 at 22:58
  • Pi-4. The goal is to continue to have the Pi be a samba server for all devices through wifi as it is now. In addition, I'd like to have it also share the same files via ethernet to the Ubuntu laptop to help with speed and performance since they're right next to each other. The very first issue I came across is that once I plug them together via the ethernet, the Pi attempts to connect to the internet through eth0 instead of the wifi. – rafny2 May 14 at 23:21
0

You can setup the Pi network normally.

Then assign a static IP address to eth0 and specify nogateway. This will make the Pi accessible via Ethernet without interfering with internet.

See How to set up networking/WiFi Prevent dhcpcd from configuring a gateway on an interface

If using nogateway there is no point in specifying static routers=192.168.1.1 static domain_name_servers=127.0.0.1

Specifying static domain_name_servers=127.0.0.1 makes no sense, unless you have a DNS configured on your Pi (which is extremely unlikely)

If you really MUST assign a static IP (and I don't know why so many Pi users do this) you must do it correctly. See How to set up Static IP Address

Fix the above errors, then update your Question if you still have problems. You appear to be using Docker (which you had omitted from your Question).

You should be able to access the Pi on 192.168.1.24, although using the same subnet as the default will likely cause routing problems. Pick a different subnet for the Ethernet link.

Configuring your Ubuntu computer is not a Pi problem, but you may need to assign a static IP.

| improve this answer | |

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.