Setting up a bridge

December 13, 2004 ·
About 1 minutes

A bridge is a machine that connects two different physical networks (like a switch). I've just set up my box to act as a bridge between my Mac (connected to the ne0 interface) and my home network (connected to the vr0 interface).

It has been easy as hell due to the excellent quality of the NetBSD manual pages ;-) After reading bridge(4), I saw a reference to brconfig(8), which I read too. And, fortunately, there is a simple but useful example in it.

So, I started by rebuilding my kernel to add pseudo-device bridge and created /etc/ifconfig.bridge0 with the following lines in it:

create!brconfig $int add vr0 add ne0 up

After a reboot, the bridge was just working :-) The Mac now has transparent access to my home network, something that didn't happen before when I used two different subnets. For example, it now has access to the DHCP server and there is no need to add an extra route anywhere.