0

I have a Raspberry Pi connected to a router via eth0. It also has USB LAN adapter eth1 to which an IP Camera is attached.

I need to access the IP Camera through it's IP address, but since eth0 is my default interface, when I try to capture stream using vlc it doesn't find it. When I ping it by explicitly using eth1 it is there, so the connection to it is OK.

Is it possible to somehow tell the Linux when connecting to specific IP to use specific interface for all kind of connections or something like that?

  • Why not just use different subnets (like 192.168.1.0/24 and 192.168.2.0/24)? That would remove any ambiguity on where packets need to go. – Daniel B Jul 9 '17 at 18:00
  • @DanielB, yes, but I want to be able to plug the camera into the router if something happens with the USB adapter, so it would be ready for use with no additional configs – CuriousGuy Jul 9 '17 at 18:06
  • 1
    Sounds like a job for DHCP... But, if you set a host route to the Camera's IP via eth1 'route add -host 192.168.2.222 -interface eth1' it may do what you want. Though if something happens to the USB interface that doesn't result in it being set 'DOWN', then the Pi won't be able to reach the ip cam if you move it to the router, until you delete the host route. – Nevin Williams Jul 9 '17 at 20:52
  • Please edit question with output of ip addr and ip route. Does the camera get the IP address per DHCP, or is it a fixed address (which one)? If everything is configured correctly, you should have a link-local route to the camera, so there's probably a configuration error. – dirkt Jul 10 '17 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.