On Jul 6, 2011, at 11:01 AM, Marek Salwerowicz wrote:
> The idea is to share the Internet connection to both networks, and block any 
> traffic between them.
> 
> I was trying to set up the firewall like this:
> 
> #!/bin/sh
> 
> cmd="ipfw -q"
> 
> $cmd flush
> 
> $cmd add 50 check-state
> 
> $cmd add 80 divert natd ip from any to any via em0
> 
> $cmd add 100 allow ip from any to me
> $cmd add 101 allow ip from me to any
> 
> $cmd add 200 allow ip from 10.0.1.0/24 to 10.0.0.0/24 keep-state
> $cmd add 300 allow ip from 10.0.2.0/24 to 10.0.0.0/24 keep-state
> 
> But it doesn't really work for me

These rules don't provide any means for LAN traffic to pass outside, just 
traffic to and from the firewall and to and from the 10.0.1.0/24 & 10.0.2.0/24 
subnets.

> when I set at the end:
> 
> $cmd add 500 allow ip from any to any

Yes, but that's too broad.  Try more like:

$cmd add 500 deny ip from 10.0.1.0/24 to 10.0.2.0/24
$cmd add 510 deny ip from 10.0.2.0/24 to 10.0.1.0/24
$cmd add 520 allow ip from any to any

Again, rule 520 is also too broad, but you can test and confirm this is 
allowing NAT traffic to and from the Internet, but blocking the subnets from 
communicating.  If that is working, replace 520 with more narrowly tailored 
allow and deny rules.

Regards,
-- 
-Chuck

_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to