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
iface eth0 inet static
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.
[errno 113] no route to host
[Errno 111] Connection refused
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