Bridging of eth0 and USB adapter based eth1 works and not Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
dpsguard
Posts: 45
Joined: Mon Aug 03, 2020 12:48 am

Bridging of eth0 and USB adapter based eth1 works and not

Post by dpsguard »

Hello all,

I wanted to create a kind of passthrough connection between the onboard ethernet port and a second ethernet port by plugging a USB to ethernet adapter. The reason was that I wanted to plug an RPi running Zabbix in between ISP handoff and the network to test data consumed over certain time in GB (not speed graph in K/Mbps).

So I did the following and that gives me something like a NIC teaming ( active / passive), but I was expecting bridging that allows full L2 passthru including dhcp and that does not happen.

I followed this document and then did the config as shown below.

https://wiki.linuxfoundation.org/networking/bridge

I used HDMI Monitor to do this (left most HDMI port on RPI 4B) to ensure I don't get locked out.

apt install bridge-utils

reboot

brctl addbr br0
brctl setfd br0 0
brctl addif br0 eth0 eth1

eth1 above is USB ethernet adapter.

nano /etc/network/interfaces

#add at the bottom the following

and under existing #Ethernet stanza, comment out all the lines

#Disable DHCP client on bridge interfaces
iface eth0 inet manual
iface eth1 inet manual

# Bridge setup
auto br0
iface br0 inet static
bridge_ports eth0 eth1
address 192.168.2.111
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 9.9.9.9 1.1.1.1

Also under /etc/resolv.conf, I had to specify name servers.

With this diet-pi will show eth0 ON but disconnected and will ask to set up this interface via dietpi-config. Hit enter to login.

The ifconfig (I installed net-tools and traceroute as well as mc :) ) shows br0 has IP address and is up and so are the eth0 and eth1 up, but no IP on these of course).


And I can then plug either of the ethernet port to the network and I can SSH into it as well as RPi is online. But if I use the second port to connect to a test laptop, I don't get dhcp IP. I also tried by assigning static IP address on laptop NIC, in same subnet but still nothing.

Anyone having done any bridging setup something similar to my needs, please share your configuration. There is standard setup of Wireless AP bridged to ethernet for upstream access to Internet.

Thanks and stay healthy everyone.
dpsguard
Posts: 45
Joined: Mon Aug 03, 2020 12:48 am

Re: Bridging of eth0 and USB adapter based eth1 works and not

Post by dpsguard »

I added following to make the passthru traffic work.

ifconfig eth0 -arp promisc 0.0.0.0 up
ifconfig eth1 -arp promisc 0.0.0.0 up

Did a reboot and now with laptop attached to either of eth0 or eth1 with other port connected to the network, I have laptop as well as RPi online and working.

Though it does not work to meet my needs of Zabbix application to see the traffic. Probably Zabbix is only able to see the traffic that leaves the bridge / interface and goes up the IP stack. So I will try some other way.
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: Bridging of eth0 and USB adapter based eth1 works and not

Post by Joulinar »

Hi,

thanks for sharing your solution to setup a bridged network.
BTW: ifconfig deprecated and was replaced by ip command ;)

Regarding your network analyze, I found following interesting guide on the web. Not sure if this what you are looking for https://brooks.sh/2019/11/17/network-fl ... rometheus/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply