drio
14
Sure this covers everything: Router - Community Help Wiki.
And here are my notes. Basically we are setting up two network interfaces on a raspberry pi to work in bridge mode. That means all packets entering either of the interfaces will be sent to the other device.
The interesting thing is that you have access to the bridge device (br0) and you can inspect and do whatever you want with those packets.
# For testing manually
sudo apt install bridge-utils
sudo ifconfig eth1 0.0.0.0
sudo ifconfig eth2 0.0.0.0
sudo brctl addbr bridge0
sudo brctl addif bridge0 eth1
sudo brctl addif bridge0 eth2
sudo ifconfig bridge0 up
# To make it permanent:
$ sudo cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
# This is the new part
auto br0
iface br0 inet static
address 0.0.0.0
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.0.255
bridge-ports eth1 eth2
I do not set an ip address because I have another interface (eth0, the one that comes with the pi) connected to another network so I can ssh into the box using that interface. I also have the wlan0 interface setup for redundancy.
Once all is setup you just need to power the pi and connect ethernet cables to the right places: one coming from your router(gl-inet device) and another one coming from the your network switch.
Let me know if that makes sense.