Why Does This Work ?

The Jetman jetman516 at hotmail.com
Tue Apr 15 12:32:00 PDT 2003

    I'm using 4.8-RELEASE to implement MAC-filtering bridge for my 
wireless network.  Altho I am relatively new w/ FBSD (since Apr '02), 
I've been getting the desired results writing my own rules for IPFW.  My 
1st attempt w/ IPFW2 was successful, but I can't figure out why !

${fwcmd} -f flush
####    permit all traffic from our wksta to anywhere via our internal iface
(1)  ${fwcmd} add permit ${ipanyany} MAC any ${wksmac} in via ${iif}
${fwcmd} add permit ${ipanyany} MAC ${wksmac} any out via ${iif}
####    permit all traffic from/to the outside iface....
${fwcmd} add permit ${ipanyany} MAC ${oifmac} any in via ${oif}
${fwcmd} add permit ${ipanyany} MAC any ${oifmac} out via ${oif}
####    block anything else coming from/going to the internal iface....
(2) ${fwcmd} add deny log ${ipanyany} MAC any any in via ${iif}
(3) ${fwcmd} add allow ${ipanyany}

    Only rules (1), (2), and (3) fire.  Rule (1) fires for obvious 
reasons (bec it matches the pattern I've anticipated.)  Bec of how IP-based 
IPFW1 rules work, I *thought* one would have to have matching inbound/outbound 
rules.  What's most baffling is that while non-approved MAC addrs are blocked 
as desired [at rule (2)], but legal traffic is permitted back thru the bridge 
to its sender [via rule (3).]  WHY ????  I'm only showing the simplest example 
of the scripts I've been experimenting with.  I've got other scripts that 
do permit other MACs thru the bridge (either wireless of Ethernet), so I'm 
close to what I want.

    My principal concern is that I don't rely on bogus (ie. broken) behavior 
of IPFW2, only to discover at some unspecified time in the future, this 
was never really working and my LAN was never really protected.  Or worse 
still, after I start making the script more complex, something unrelated goes 
wrong.  The only help I've been able to find is a single site, where a guy 
showed his 1st effort at an IPFW2 script, intended to do the same thing I'm 
trying to do.  Actually, I used his script, as a starting place for my 


===============  From the desk of Jethro Wright, III  ================
+  Never attribute to malice that which is adequately explained by   +
+  incompetence.                                                     +
===  jetman516 at hotmail.com  =====================  Hanlon's Razor  ===

More information about the freebsd-questions mailing list