Arch Network Bridge
So I have this nice 4-port nic that I bought with the same expectations as one would buy a raspberry pi. I figured I would buy it, it would sit in the box for a few months, and then I would feel pressured into some project so I can justify the purchase. This is that project.
So there are multiple ways to go about this. We could go the ARP poisoning route, or we could go the bridge route. Obviously due to the aforementioned vacant ethernet ports, I am going to use a virtual bridge. Another reason is that I want as little latency as possible. I definitely didn’t look this up but I assume ARP poisoning is going to have a higher cost than a virtual bridge.
Options for you kids with one port
Buy a cheap switch with port mirroring. Look, there’s one!
Or you can do ARP poisoning. Theres a link at the end for some further reading on that, but I won’t discuss it here. (It’s on the list)
Actually Doing The Thing
Extremely easy to set up the bridge with iproute2 package:
ip link add name bridge_name type bridge ip link set bridge_name up
Just go read the wiki, it’s not that scary. We need to add both interfaces to the bridge, and bring the bridge up. Make sure the interfaces are up to while your at it.
Enable IPv4 forwarding:
sysctl -w net.ipv4.ip_forward=1. From the man page
sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/
To make the change permanent you can add
net.ipv4.ip_forward=1 to a sysctl conf file.
- Learn what a bridge is
- Using ARP Cache Poisoning for Packet Analysis
- That cheap smart switch I mentioned
- Arch Wiki - Tap Networking With QEMU
- Arch Wiki - Network Bridge (scroll to “Creating bridge manually”)