0

The Setup:

A raspberry pi 3b running raspbian is connected over two ethernet ports (eth0 native, eth1 over USB) to an ip cam at eth0 and to the local network and the internet over eth1 like scatched in the picture.

The connection to the local network is over dhcp.

The connection to the ip cam is with static ip's.

The network is configured via the /etc/network/interfaces file as follows

#..
source-directory /etc/network/interfaces.d

auto eth0
auto eth1

iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0

iface eth1 inet dhcp

With a python script we record an image per hour from the ip cam. We address the cam directly via its static ip so no dns server is involved. The python script is executed via cron.

Most of the times it works.

The problem:

Sometimes a

[errno 113] no route to host

or

[Errno 111] Connection refused

occures.

This happens somehow arround 30% - 40% of the cases.

It does not happen if a picture is taken every minute and it does not happen when the camera is in the local network. I don't know at what critical time the error pops up. Just checked it hourly and minutely.

Right now I'm testing if it happens if eth1 (the local network) is deactivated.

I have the suspicion that the r. pi searches for the cam in the wrong network, sometimes.

The cam is not in the local network, that it can not be accessed from the network and the internet directly for privacy reasons. The network connection on the other hand is necessary to access the r. pi via ssh to store the taken pictures, maintenance and feedback.

I'm pretty new on all that stuff and would appreciate any help. Does anybody know why this errors occurs and how to get rid of it?

Big thanks in advance

enter image description here

0

You are making life difficult for yourself with old Debian networking.

I recommend you use the normal dhcpcd networking; see How to set up networking/WiFi

Regardless of how networking is configured, your problem is most likely that
BOTH ethernet ports are connected via the USB hub, so there is no (simple) way of ensuring which is assigned to eth0.

Most modern distributions use Predictable Network Interface Names, unfortunately disabled by default in latest Raspbian. This is described in the link above. It can be enabled by raspi-config

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.