- 论坛徽章:
- 0
|
一台双电源旧式服务器,不运行pf做nat可以长时间运行,但一旦作为网关就不定期自动重启.
pf规则如下:
TRANSLATION RULES:
nat on dc0 all -> (dc0) round-robin
rdr pass on dc0 inet proto tcp from any to X.X.X.X port = 49999 -> 172.16.16.4 port 80
rdr pass on dc0 inet proto tcp from any to any port = 49998 -> 172.16.16.58 port 3389
FILTER RULES:
scrub in all fragment reassemble
block drop in quick on fxp0 inet proto tcp from <RES_ALL> to any port = 1863
block drop in quick on fxp0 inet proto tcp from <RES_ALL> to any port 444 >< 3127
block drop in quick on fxp0 inet proto tcp from <RES_ALL> to any port > 3129
block drop in quick on fxp0 inet proto udp from any to any port = loc-srv
block drop in quick on fxp0 inet proto udp from any to any port = profile
block drop in quick on fxp0 inet proto udp from any to any port = netbios-ns
block drop in quick on fxp0 inet proto udp from any to any port = netbios-dgm
block drop in quick on fxp0 inet proto udp from any to any port = netbios-ssn
block drop in quick on fxp0 inet proto udp from any to any port = microsoft-ds
block drop in quick on fxp0 inet proto udp from any to any port 52 <> 8001
pass quick on lo0 all
pass in quick on dc0 inet proto tcp from any to X.X.X.X port 45000 >< 65535 keep state queue
oSsh
block drop in quick on dc0 inet from <PRIV_NETS> to X.X.X.X
block drop all
pass out on dc0 all keep state queue oOther
pass out on fxp0 all keep state
pass in on fxp0 inet all keep state queue other
pass in on fxp0 inet proto tcp from any to any port = ssh keep state
pass in on fxp0 inet proto tcp from any to any port = 50000 keep state
pass out on dc0 proto tcp from (dc0) to any port = ssh keep state queue oSsh
pass out on dc0 proto tcp from (dc0) to any port = 50000 keep state queue oSsh
pass out on dc0 proto udp from (dc0) to any port = domain keep state queue oQuick
pass out on dc0 proto tcp from (dc0) to any port = domain keep state queue oQuick
pass out on dc0 proto icmp from (dc0) to any keep state queue oQuick
pass out on dc0 proto tcp from (dc0) to any port = smtp keep state queue oQuick
pass out on dc0 proto tcp from (dc0) to any port = pop3 keep state queue oQuick
pass out on dc0 proto tcp from (dc0) to any port = imap keep state queue oQuick
pass out on dc0 proto tcp from (dc0) to any port = http keep state queue web
pass out on dc0 proto tcp from (dc0) to any port = https keep state queue web
pass out on dc0 proto tcp from (dc0) to any port = 50001 keep state queue web
pass in on fxp0 inet proto tcp from <RES_NET> to any port = ssh keep state queue ssh
pass in on fxp0 inet proto tcp from <RES_NET> to any port = 50000 keep state queue ssh
pass in on fxp0 inet proto udp from any to any port = domain keep state queue mQuick
pass in on fxp0 inet proto tcp from any to any port = domain keep state queue mQuick
pass in on fxp0 inet proto icmp all keep state queue mQuick
pass in on fxp0 inet proto tcp from any to any port = smtp keep state queue mQuick
pass in on fxp0 inet proto tcp from any to any port = pop3 keep state queue mQuick
pass in on fxp0 inet proto tcp from any to any port = imap keep state queue mQuick
pass in on fxp0 inet proto tcp from <RES_NET> to any port = http keep state queue eQuick
pass in on fxp0 inet proto tcp from <RES_NET> to any port = https keep state queue eQuick
pass in on fxp0 inet proto tcp from <RES_NET> to any port = 50001 keep state queue eQuick
pass in on fxp0 inet proto tcp from <RES_ALL> to any port = http keep state queue lQuick
pass in on fxp0 inet proto tcp from <RES_ALL> to any port = https keep state queue lQuick
pass in on fxp0 inet proto tcp from <RES_ALL> to any port = 50001 keep state queue lQuick
ALTQ:
queue root_fxp0 bandwidth 4Mb priority 0 cbq( wrr root ) {ssh, mQuick, eQuick, lQuick, other}
queue ssh bandwidth 400Kb priority 7 cbq( red ecn borrow )
queue mQuick bandwidth 400Kb priority 6 cbq( red ecn borrow )
queue eQuick bandwidth 1.60Mb priority 5 cbq( red ecn borrow )
queue lQuick bandwidth 1.20Mb priority 4 cbq( red ecn borrow )
queue other bandwidth 400Kb priority 2 cbq( red ecn borrow default )
queue root_dc0 bandwidth 500Kb priority 0 cbq( wrr root ) {oSsh, oQuick, web, oOther}
queue oSsh bandwidth 50Kb priority 7 cbq( red ecn borrow )
queue oQuick bandwidth 50Kb priority 6 cbq( red ecn borrow )
queue web bandwidth 250Kb priority 5 cbq( red ecn borrow )
queue oOther bandwidth 150Kb priority 2 cbq( red ecn borrow default )
sysctl.conf:
kern.coredump=0
net.inet.tcp.rfc1323=1
net.inet.tcp.rfc1644=1
net.inet.tcp.rfc3042=1
net.inet.tcp.rfc3390=1
net.inet.ip.forwarding=1
kern.ipc.maxsockbuf=8388608
#kern.ipc.somaxconn=32768
#kern.ipc.shmall=32768
kern.maxfiles=524688
kern.maxfilesperproc=262344
net.inet.tcp.delayed_ack=0
net.inet.tcp.sendspace=524688
net.inet.tcp.recvspace=524688
net.inet.udp.recvspace=262344
net.inet.udp.maxdgram=114688
net.local.stream.recvspace=524688
net.local.stream.sendspace=524688
net.inet.icmp.bmcastecho=0
net.inet.icmp.maskrepl=0
net.inet.icmp.icmplim=100
net.inet.tcp.always_keepalive=0
net.inet.ip.intr_queue_maxlen=2000
net.inet.tcp.inflight.enable=1
kern.ipc.nmbclusters=262246
loader.conf如下:
kern.ipc.maxsockets="262344"
net.inet.tcp.tcbhashsize="10240"
squid没有开
网卡一张是intel(fxp0)的,另一张是dc0, |
|