
rc.conf:
Цитат |
ifconfig_rl0="inet 10.10.2.232 netmask 255.255.0.0 up" ifconfig_rl1="inet 192.168.0.1 netmask 255.255.0.0 up" sendmail_enable="NONE" hostname="mp-linux" gateway_enable="YES" mpd_enable="YES" ipfilter_enable="YES" ipfilter_flags="-Fa -f /etc/ipf.rules" ipmon_enable="YES" ipmon_flags="-Ds" ipnat_enable="YES" sshd_enable="YES" |
ipf.rules:
Цитат |
pass in quick on lo0 all pass out quick on lo0 all pass in quick on rl1 all pass out quick on rl1 all # Let clients behind the firewall send out to the internet, and replies to come pass out quick on rl0 proto tcp all keep state pass out quick on ng0 proto tcp all keep state pass out quick on rl0 proto udp all keep state pass out quick on ng0 proto udp all keep state pass out quick on rl0 proto icmp all keep state pass out quick on ng0 proto icmp all keep state # Since nothing should be coming from these address ranges, block them block in quick on rl0 from 192.168.0.0/16 to any block in quick on ng0 from 192.168.0.0/16 to any block in quick on rl0 from 172.16.0.0/12 to any block in quick on ng0 from 172.16.0.0/12 to any block in quick on rl0 from 127.0.0.0/8 to any block in quick on ng0 from 127.0.0.0/8 to any block in quick on rl0 from 192.0.2.0/24 to any block in quick on ng0 from 192.0.2.0/24 to any # Let's let people access the services running on this system pass in quick on rl0 proto tcp from any to any port 30000 >< 50000 flags S keep pass in quick on rl0 proto tcp from any to any port = 50505 flags S keep state pass in quick on rl0 proto udp from any to any port = 50505 #BitComet pass in quick on rl0 proto tcp from any to any port = 21 #FTP pass in quick on rl0 proto tcp from any to any port = 22 #SSH pass in quick on rl0 proto tcp/udp from any to any port = 53 #DNS pass in quick on rl0 proto tcp from any to any port = 80 #WWW # Block everything else block in quick on rl0 all |
ipnat.rules:
Цитат |
map ng0 192.168.0.0/24 -> 0.0.0.0/32 proxy port ftp ftp/tcp map ng0 192.168.0.0/24 -> 0.0.0.0/32 portmap tcp/udp 49152:65000 map ng0 192.168.0.0/24 -> 0.0.0.0/32 |
На ipf.rules трябва да разчистя още малко pass in, щото нямам сървъри, ама първо това с free съвъра ми е болката

А, ами това
Цитат |
kldload ipfw sysctl net.inet.ip.fw.one_pass=1 ipfw add 00100 allow ip from any to any via lo0 ipfw add 00200 divert 8668 ip from 10.10.0.100 to me via xl0 ipfw add 00201 divert 8668 ip from 192.168.0.2 to 10.10.0.100 via xl0 ipfw add 65530 allow ip from any to any |