Search code examples
network-programmingraspberry-pilan

Raspberry PI multiple LAN netoworks


I'm trying to connect my Raspberry Pi 3 model B to two different LAN networks at the same time. One is connected directly to the raspberry and otherr is connected to usb-ethernet adapter.

Both work by them selves correctly, I can acces e.g google through both of them. But when I attach both of them I cannot access the network connected to the adapter.

I found some instructions online on how to connect to two wifi networks, but these didnt really help.

In my network config file I have

auto eth0 iface eth0 inet manual

auto eth1 iface eth1 inet manual

Is there some setting to allow connection through both of them at the same time?

I need the secondary network(through adapter) only for pinging this network. The other is used to ping other network and for other things.

EDIT: To clarify the situation, I dont need internet access through either of them, but I do need to have access to two separate local networks. Both netwroks run with static IP addresses.


Solution

  • All I had to do was remove the default gateway for the other network. Because having two default networks caused the default gateway to be set as the default gateway of eth1.