Redirection with a bridge ?

Charles Swiger cswiger at mac.com
Mon Jun 21 14:01:42 PDT 2004


On Jun 21, 2004, at 4:48 PM, matt at example.com wrote:
> Is it possible to redirect packets that are being passed through a 
> bridge
> based on their protocol/port, so that if a HTTP packet (port 80) goes
> through the bridge, no matter what its destination is, it will be
> redirected to IP address 4.3.2.1.

Yes.  In order to redirect packets to a different IP address, you have 
to rewrite those packets, which is what natd or ipnat do, working at 
layer 3.

> Thats what I'm trying to solve.  I know that you can do the above
> successfully if you are using a NAT (ipnat) or if you are doing routing
> (IPFW's forward command), but is it possible to do it with a bridge?

Bridging works at layer-2.  Without using NAT, bridging alone will 
forward the traffic but not change the destination IP to 4.3.2.1.

Note that the IPFW forward command redirects traffic via a specific 
outbound interface, it does not perform layer-3 routing (ie, your 
traditional IP stuff using netmasks, gateways, and the local routing 
table that most people mean by the word "routing").

-- 
-Chuck



More information about the freebsd-questions mailing list