ytil Опубликовано 31 июля, 2018 · Жалоба 3 часа назад, Ivan_83 сказал: А если написать один - ругается? заработало, если 1 шлюз указать. pf.rules сейчас такой table <LAN1> {192.168.66.0/24} table <LAN2> {192.168.67.0/24} int_if = "em2" ext_if1 = "em0" ext_if2 = "em1" ext_gw1 = "1.1.1.1" ext_gw2 = "1.1.1.1" # default nat nat on $ext_if1 from <LAN1> to any -> 1.1.1.2 nat on $ext_if2 from <LAN2> to any -> 1.1.1.3 # default deny block in from any to any block out from any to any # manag access pass in from any to $ext_if1 pass in from any to $ext_if2 # pass all outgoing packets on internal interface pass out on $int_if from any to <LAN1> pass out on $int_if from any to <LAN2> # pass in quick any packets destined for the gateway itself pass in quick on $int_if from <LAN1> to $int_if pass in quick on $int_if from <LAN2> to $int_if # load balance outgoing tcp traffic from internal network. pass in on $int_if route-to ($ext_if1 $ext_gw1) proto tcp from <LAN1> to any flags S/SA modulate state pass in on $int_if route-to ($ext_if2 $ext_gw2) proto tcp from <LAN2> to any flags S/SA modulate state # load balance outgoing udp and icmp traffic from internal network pass in on $int_if route-to ($ext_if1 $ext_gw1) proto { udp, icmp } from <LAN1> to any keep state pass in on $int_if route-to ($ext_if2 $ext_gw2) proto { udp, icmp } from <LAN2> 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 Теперь вопрос, какой маршрутизатор производительнее будет, с pf или с setfib @st_re Спасибо, тоже попробую сделать, у меня с setfib не получалось, потому что net.add_addr_allfibs=0 не делал, мне не подходит что маршрутов кроме дефолта не будет во второй таблице. Но ежели setfib побыстрее работает, останусь на нем Вставить ник Цитата Ответить с цитированием Поделиться сообщением Ссылка на сообщение Поделиться на других сайтах More sharing options...
Ivan_83 Опубликовано 31 июля, 2018 · Жалоба Не знаю значит быстрее, вряд ли у вас будет затык по скорости. Есть несколько моментов. 1. Блокировать исходящий трафик есть смысл только для определённых портов и дст хостов, и то с оговоркой что есть некий сервис на самом фаере который туда может пойти, например прокси. Я вообще всё на выход разрешаю: pass out quick inet proto udp to 224.0.0.0/4 no state allow-opts pass out quick inet proto igmp to 224.0.0.0/4 no state allow-opts pass out quick inet6 proto udp to ff00::/8 no state allow-opts # Allow send multicast pass out quick allow-opts 2. Для хостов их локалки лучше делать block drop чтобы бедолаги получали сразу отлуп и не ждали у моря погодытаймаута соединения. 3. pass in from any to $ext_if1 - с такими правилами - зачем вам вообще какие то блокировки?) Достаточно одного pass quick. 4. pass in on $int_if route-to - это кажется лишним, вроде в документации было что route-to применяется только для OUT, что в принципе логично. 5. pass in on $int_if route-to ($ext_if1 $ext_gw1) proto tcp from <LAN1> to any flags S/SA modulate state pass in on $int_if route-to ($ext_if2 $ext_gw2) proto tcp from <LAN2> to any flags S/SA modulate state pass in on $int_if route-to ($ext_if1 $ext_gw1) proto { udp, icmp } from <LAN1> to any keep state pass in on $int_if route-to ($ext_if2 $ext_gw2) proto { udp, icmp } from <LAN2> to any keep state вырождается во что типа: table <int_nets_tbl> persist const { $int_if:network, 255.255.255.255 } # Intenal networks pass in on $int_if proto from <int_nets_tbl> flags S/SA modulate state pass in from any to $ext_if1 pass in from any to $ext_if2 pass in quick on $int_if from <LAN1> to $int_if pass in quick on $int_if from <LAN2> to $int_if вырождается во что типа: table <self_addrs_static_tbl> persist const { self } pass in quick to <self_addrs_static_tbl> и тп, на самом деле проще всё переписать :) Нюансов там много. Вставить ник Цитата Ответить с цитированием Поделиться сообщением Ссылка на сообщение Поделиться на других сайтах More sharing options...