我的番茄炒蛋
生活如此精彩,挑战无处不在!

导航

 

ip2="192.168.0.2"
ip3="192.168.0.3"
int_if  = "dc0"
ext_if1 = "fxp0"
ext_if2 = "fxp1"
ext_gw1 = "222.88.33.11"
ext_gw2 = "219.150.10.9"


#  nat outgoing connections on each internet interface
nat on $ext_if1 from $ip2 to any -> ($ext_if1)
nat on $ext_if2 from $ip3 to any -> ($ext_if2)

#  default deny
block in  from any to any
block out from any to any

#  pass all outgoing packets on internal interface
pass out on $int_if from any to any
#  pass in quick any packets destined for the gateway itself
pass in quick on $int_if from any to $int_if

pass in on $int_if route-to \
    ($ext_if1 $ext_gw1) \
     from $ip2 to any keep state

pass in on $int_if route-to \
     ($ext_if2 $ext_gw2)  \
    from $ip3 to any keep state

#  general "pass out" rules for external interfaces
pass out on $ext_if1 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if1 proto { udp, icmp } from any to any keep state
pass out on $ext_if2 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if2 proto { udp, icmp } from any to any keep state

#  route packets from any IPs on $ext_if1 to $ext_gw1 and the same for
#  $ext_if2 and $ext_gw2
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any

posted on 2009-12-25 17:18  bluesky  阅读(273)  评论(0编辑  收藏  举报