Raspberry PI multiple LAN netoworks - networking

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.

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.

Related

Pi 4: Wireless network interface doesn't work if both eth0 and wlan0 are active/connected

I'm running Pi4 with Raspbian for my home automation, and it's connected to its both network interface: eth0 (ethernet) and wlan0 (wifi).
The wlan0 is connected to the network 10.10.10.0/24, which is the VLAN for management. This VLAN is configured on the unifi edgerouter x and uap-ac-lite access point. If only wlan0 is active (i.e, I only use the wifi on the Pi), the Pi should be able to see devices on the other VLANs, for example 10.10.50.0/24 for IoT devices.
However, as the Pi is running Unifi controller, I also need to connect it to the edge router's physical network 192.168.10.0/24 so I can manage the access point. This means, the eth0 is active, which somehow makes VLAN 10.10.50.0/24 inaccessible. I disconnect the ethernet cable and the 10.10.50.0/24 is accessible again.
My best guess is that if both interfaces are enabled, only 1 of them (eth0 in this case) will be used for the default routing. Is it possible to make both routing accessible, depending on the destination networks?
Never mind, I have found the answer: Simply change priority of the wifi network routing by adding metric 100 to wlan0 section in dhcpcd.conf

Sending packets through a virtual interface whose subnet is also same as subnet of another interface

I have a Linux machine with two interfaces eth0 and eth1.
eth0 has 192.168.2.30 and eth1 has 172.16.30.20. eth0 is connected to a router which is the gateway too for the WAN. eth1 is connected to LAN. All is working well until I had to connect a
set of devices with IP rage 192.168.2.5 - 192.168.2.15 to the LAN to which eth1 is also connected.
I want to send a multicast packet to these devices. Since the multicast works on the same subnet, I created an IP alias using following.
system("ifconfig eth1:1 192.168.2.100 netmask 255.255.255.0 up");
Despite adding the above, the packets are not going through eth1. This is found to be because eth0 is also having the same subnet as that of eth1: 1.
I tried calling ip route add <multicast ip> dev eth1. But, no success.
Appreciate if anyone could offer suggestions.
From the looks of it you have at least two problems here and depending on the solution you choose other issues may arise.
Problem one, Overlapping subnets: The absolute 100% correct way to resolve this is to change the subnets so they don't overlap. I can't stress enough how important this is in your situation. If these computer on 192.168.2.5 - 192.168.2.15 are suppose to be connected to the same network as eth0 then you need to reconsider your setup as this would never work because you will create a networking loop or bad routes.
In the first situation where 192.168.2.5 - 192.168.2.15 and 192.168.2.15 aren't physically connected in any way and if someone above you says you can't do this you can try creating a NAT on eth1 so that your system sees the subnet on a different network. But this can make understanding the routes confusing and may interfere with multicast traffic.
After this is done run a tracerroute to ensure traffic is passing correctly. If not please provide the output and the route you expect it to take along with the current setup.
If multicasting doesn't work still then I recommend to create another question for it.

Devstack networking/can't ping instances

I am facing a problem how to set up network correctly while using ubuntu 17.10 in virtualbox. I have problem with pinging my instances from host PC and even from guest VM. Same problem in instances, they can't ping VMs or host pc. In virtualbox I am using 3 network adapters (NAT for internet access, 2x host only network paravirtualized [one for communication between nodes another one was meant to be public interface for instances]).
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# VirtualBox NAT -- for Internet access to VM
auto enp0s3
iface enp0s3 inet dhcp
auto enp0s8
iface enp0s8 inet static
address 172.18.161.6
netmask 255.255.255.0
auto enp0s9
iface enp0s9 inet manual
up ip link set dev $iface up
down ip link set dev $iface down
And devstack local.conf was from this page (tried all of them):
https://docs.openstack.org/devstack/latest/guides/neutron.html
I don't know what your configuration files looks like, but for sure, I can suggest for these kinda issues, try to debug step by step.
1: From instance, ping default GW, i.e. virtual router connecting internal network with the external network. If success, go to step 2. If fail, you got your culprit.
2: from the virtual router, ping host endpoint. If successful, try the other way round. If fail, you got your culprit.
If everything works fine, check configuration files, default gw, routing rules etc ...
Do let me, if it works or not !!
After to successfully install Devstack, if you want to grant access from and to instances, you need configure a bunch of settings:
In Security Groups add ingress rules to ICMP, SSH, HTTP, HTTPS, etc;
In the private Network, edit private-subnet to add a DNS Name Servers (8.8.8.8, 1.1.1.1, etc);
Allocated some Floating IP's;
Launch some instances;
Associate a floating IP to each instance;
Set the proxy_arp and iptables (in the host Devstack).
Try to follow this:
How to expose the Devstack floating ip to the external world?

debian networking sets wrong ip

I'm currently trying to automate our beaglebone flashing - therefore we have to manually change the ip address.
I created a script which basically adds sth. like:
# The primary network interface
auto eth0
iface eth0 inet static
address theip
netmask 255.255.255.0
gateway gateway
to /etc/network/interfaces
After adding this I restart networking via:
service networking restart
Which returns "ok", but ifconfig doesn't return "theip" it seems like it just ignores the changes and still uses dhcp.
When rebooting the system, the ip is changed and everything works as expected, but I don't want to restart the system. So how do I correctly restart the networking?
Thanks in advance,
Lukas
Do ip addr flush dev eth0 first and then restart the networking service.
Explanation
The /etc/network/interfaces file is used by the ifupdown system. This is different than the graphical NetworkManager system that manages the network by default.
When you add lines to control eth0 in the /etc/network/interfaces file, most graphical network managers assume you are now using the ifupdown service for that interface and drops the option to manage it.
The ifupdown system is less complicated and less sophisticated. Since eth0 is new to the ifupdown system, it assumes that it is unconfigured and tries to "add" the specified address using the ip command. Since the interface already has an ip address assigned by dhclient for that network, I suspect it is erroring out. You then need to put the interface in a known state for ifupdown to be able to start managing it. That is without an address assigned to the interface via the ip command.

Configuring multiple IPs for amazon EC2

I need a separate ip addresses for my two sites, so I'm manually configuring Amazon Web services to have 2 public ips with an instance. I've set up 2 elastic ips that are pointed to 2 private ips and they are all under a single network interface.
What manual changes do I need to make to OS (Debian 7) to make the secondary elastic (public) ip to work?
This is what /etc/network/interfaces looks like right now:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
P.S. There does not seem to be a ec2-net-utils package for debian, so I'm doing it manually, thus also learning how networking works.
As per my knowledge, You cannot setup multiple IP in amazon Ec2. You need to assign the IP to each instance and normal EC2 will allow only one IP per instance.
And you can configure two website with one public IP and it will not create any performance issue. If you are particular about two public IP, you can check with VPC in amazon WS

Resources