OpenBSD : Creating a transparent bridge

This post will be short, because it is actually easier than I expected … Anyway, considering my memory, better blog out that for later reference 😉

A bridge is a network device used to connect two or more network segments. You can achieve this easily on OpenBSD with the following commands :

# echo 'up' > /etc/hostname.if0
# echo 'up' > /etc/hostname.if1
# echo 'add if0 add if1 up' > /etc/bridgename.bridge0

This will setup the two interfaces if0 and if1 (replace with your own, like rl0, em0, etc etc) and add them into the bridge0.

Then you need to enable ip forwarding so that IP packets will pass from one interface to the others as needed. You do that by editing the file /etc/sysctl.conf and uncommenting the line which reads :

#net.inet.ip.forwarding=1
Once this is all done, reboot to activate.

This bridge is IP-less, which means it is “harder” to attack. You can still filter at MAC level and at IP level through PF (the firewall of OpenBSD).

Tested on OpenBSD 3.9

Man pages :