Решил обновить систему с нуля до FreeBSD 10.1, собственно поднял nat на основе ipnat, с поддержкой на уровне ядра. Конфиг простой до безобразия..#SQUID
#rdr xl0 0/0 port 80 -> 127.0.0.1 port 3128 tcp
#rdr ng0 0/0 port 80 -> 127.0.0.1 port 3129 tcp
#
map em0 192.168.0.0/24 -> xxx.xxx.xxx.xxx/32 proxy port ftp ftp/tcp
map em0 192.168.0.0/24 -> xxx.xxx.xxx.xxx/32 portmap tcp/udp 20000:25000#Redirect SSLPOP
rdr em0 from any to xxx.xxx.xxx.xxx/32 port = 995 -> 192.168.0.1 port 995
rdr ste0 from any to xxx.xxx.xxx.xxx/32 port = 995 -> 192.168.0.1 port 995
#Redirect VOIP
rdr em0 from any to xxx.xxx.xxx.xxx/32 port = 5060 -> 192.168.0.114 port 5060
rdr ste0 from any to xxx.xxx.xxx.xxx/32 port = 5060 -> 192.168.0.114 port 5060
#ipf не включал, так как роль фаервола выполняет ipwf.
Проблема в том что при серфинге в инете с клиенских машин некоторые сайты очень долго открываются. Происходит это хаотично, на разных клиентах-машинах один и тот же сайт открывается по разному, может открыться сразу а может немерено времени дуплить. Мало того если трафик на клиентах в настройках браузера завернуть на прокси - сквид, то проблема исчезает. DNS тут не причем, эту версию исключил сразу прописав на клиентах другой DNS, да и сам DNS родной отвечает быстро и работает без проблем. Да и с точно такими же конфигами на Free 7 и 8 работало отлично. Уже 2 дня голову ломаю ничего сделать не могу :(.
Похоже проблема решилась тем, что в rc.conf закоментировал tcp_extensions="NO". Угадал чисто от безысходности. :)
Еще заметил закономерность в проблеме... после старта системы или ipnat -CF -f долго грузились почти все сайты, и похоже только по http, только в первый раз... достаточно было 1 раз зайти на какой-то сайт, после этого именно с этим интернет-ресурсом лагов не было. C https вообще лагов не было.
Проблемы с ipnat продолжаются. Все время растет значение inuse:
ipnat -s | grep inuse
1787 inuse in
1993 inuse out
И это всего при работающих 7 машинах (без торрентов!) через этот шлюз, активных сессий:
ipnat -s | grep active
142 active
Ночью число активных сессий вообще не более 10, но при этом значения inuse значительно не уменьшаются. Специально прождал 2 выходных и наблюдал, значения inuse так же сильно не уменьшились.
Параллельно использую шлюз на Freebsd 7.2 в котором старый ipnat, на нем работают более 30 машин... вот что на нем:
ipnat -s
mapped in 475029329 out 621161921
added 13356530 expired 13319116
no memory 0 bad nat 8405
inuse 2518
Ночью значение inuse на этом шлюзе падает меньше 100...
Настройки таймаутов ipfilter у обоих шлюзов одинаковые и имеют значения по умолчанию.
Если не перегружать ipnat на FreeBSD 10.1, то через неделю другую параметр inuse вырастает до заоблачного значения более 60000, и понятно что начинаются жуткие лаги при соединении.
Выкладываю с FreeBSD 10.1 ipf -T list
ipf_flags min 0 max 4294967295 current 0
active min 0 max 0 current 0
control_forwarding min 0 max 1 current 0
update_ipid min 0 max 1 current 0
chksrc min 0 max 1 current 0
min_ttl min 0 max 1 current 4
icmp_minfragmtu min 0 max 1 current 68
default_pass min 0 max 4294967295 current 134217730
tcp_idle_timeout min 1 max 2147483647 current 864000
tcp_close_wait min 1 max 2147483647 current 480
tcp_last_ack min 1 max 2147483647 current 60
tcp_timeout min 1 max 2147483647 current 480
tcp_syn_sent min 1 max 2147483647 current 480
tcp_syn_received min 1 max 2147483647 current 480
tcp_closed min 1 max 2147483647 current 60
tcp_half_closed min 1 max 2147483647 current 14400
tcp_time_wait min 1 max 2147483647 current 480
udp_timeout min 1 max 2147483647 current 240
udp_ack_timeout min 1 max 2147483647 current 24
icmp_timeout min 1 max 2147483647 current 120
icmp_ack_timeout min 1 max 2147483647 current 12
ip_timeout min 1 max 2147483647 current 120
ipf_flags min 0 max 4294967295 current 0
active min 0 max 0 current 0
control_forwarding min 0 max 1 current 0
update_ipid min 0 max 1 current 0
chksrc min 0 max 1 current 0
min_ttl min 0 max 1 current 4
icmp_minfragmtu min 0 max 1 current 68
default_pass min 0 max 4294967295 current 134217730
tcp_idle_timeout min 1 max 2147483647 current 864000
tcp_close_wait min 1 max 2147483647 current 480
tcp_last_ack min 1 max 2147483647 current 60
tcp_timeout min 1 max 2147483647 current 480
tcp_syn_sent min 1 max 2147483647 current 480
tcp_syn_received min 1 max 2147483647 current 480
tcp_closed min 1 max 2147483647 current 60
tcp_half_closed min 1 max 2147483647 current 14400
tcp_time_wait min 1 max 2147483647 current 480
udp_timeout min 1 max 2147483647 current 240
udp_ack_timeout min 1 max 2147483647 current 24
icmp_timeout min 1 max 2147483647 current 120
icmp_ack_timeout min 1 max 2147483647 current 12
ip_timeout min 1 max 2147483647 current 120
log_suppress min 0 max 1 current 1
log_all min 0 max 1 current 0
log_size min 0 max 524288 current 32768
state_max min 1 max 2147483647 current 4013
state_size min 1 max 2147483647 current 5737
state_lock min 0 max 1 current 0
state_maxbucket min 1 max 2147483647 current 26
state_logging min 0 max 1 current 1
state_wm_high min 2 max 100 current 99
state_wm_low min 1 max 99 current 90
state_wm_freq min 2 max 999999 current 20
nat_lock min 0 max 1 current 0
nat_table_size min 1 max 2147483647 current 2047
nat_table_max min 1 max 2147483647 current 30000
nat_rules_size min 1 max 2147483647 current 127
rdr_rules_size min 1 max 2147483647 current 127
hostmap_size min 1 max 2147483647 current 2047
nat_maxbucket min 1 max 2147483647 current 22
nat_logging min 0 max 1 current 1
nat_doflush min 0 max 1 current 0
nat_table_wm_low min 1 max 99 current 90
nat_table_wm_high min 2 max 100 current 99
proxy_debug min 0 max 31 current 0
ftp_debug min 0 max 127 current 0
ftp_pasvonly min 0 max 1 current 0
ftp_insecure min 0 max 1 current 0
ftp_pasvrdr min 0 max 1 current 0
ftp_forcepasv min 0 max 1 current 1
ftp_single_xfer min 0 max 1 current 0
tftp_read_only min 0 max 1 current 1
ftp_debug min 0 max 127 current 0
ftp_pasvonly min 0 max 1 current 0
ftp_insecure min 0 max 1 current 0
ftp_pasvrdr min 0 max 1 current 0
ftp_forcepasv min 0 max 1 current 1
ftp_single_xfer min 0 max 1 current 0
И еще мне не понятно почему 2 раза выводятся значения одних и тех же параметров? На старом ipnat (Freebsd 7.2) такого нет.ipnat.conf:
map em0 192.168.0.0/24 -> xxx/32 proxy port ftp ftp/tcp
map em0 192.168.0.0/24 -> xxx/32 portmap tcp/udp 20000:25000
#Redirect SSLPOP
rdr em0 from any to xxx/32 port = 995 -> 192.168.0.1 port 995
rdr ste0 from any to xxx1/32 port = 995 -> 192.168.0.1 port 995
#Redirect VOIP
rdr em0 from any to xxx/32 port = 5060 -> 192.168.0.114 port 5060
rdr ste0 from any to xxx1/32 port = 5060 -> 192.168.0.114 port 5060
#
ipf.conf:
pass out quick on em0 proto tcp/udp from 192.168.0.0/24 to any keep state
block in quick on em0 from any to 192.168.0.0/24
#
rc.conf:
#IPNAT
tcp_drop_synfin="YES"
icmp_drop_redirect="YES"
icmp_log_redirect="NO"
ipfilter_enable="YES"
ipnat_enable="YES"
ipfilter_rules="/etc/ipf.rules"
ipnat_rules="/etc/ipnat.rules"Ipnat работает на уровне ядра.
Вот не пойму, что нужно сделать чтобы не забивалась таблица соединений (inuse)?
Похожая проблема, как то решил?
> Похожая проблема, как то решил?Перешел на IPFW nat... Там получается баг в 10.1 c ipnat.
>> Похожая проблема, как то решил?
> Перешел на IPFW nat... Там получается баг в 10.1 c ipnat.ip_nat.h
#ifndef NAT_SIZE
# ifdef LARGE_NAT
//# define<--->NAT_SIZE<------>2047
# define<----->NAT_SIZE<------>4095
# else
//# define<--->NAT_SIZE<------>127
# define<----->NAT_SIZE<------>4095
# endif
#endif
#ifndef RDR_SIZE
# ifdef LARGE_NAT
//# define<--->RDR_SIZE<------>2047
# define<----->RDR_SIZE<------>4095
# else
//# define<--->RDR_SIZE<------>127
# define<----->RDR_SIZE<------>4095
# endif
#endif
#ifndef HOSTMAP_SIZE
# ifdef LARGE_NAT
//# define<--->HOSTMAP_SIZE<-->8191
# define<----->HOSTMAP_SIZE<-->16383
# else
//# define<--->HOSTMAP_SIZE<-->2047
# define<----->HOSTMAP_SIZE<-->16383
# endif
#endif
#ifndef NAT_TABLE_MAX
/*
* This is newly introduced and for the sake of "least surprise", the numbers
* present aren't what we'd normally use for creating a proper hash table.
*/
# ifdef>LARGE_NAT
//# define<--->NAT_TABLE_MAX<->18000
# define<----->NAT_TABLE_MAX<->1000000
# else
//# define<--->NAT_TABLE_MAX<->30000
# define<----->NAT_TABLE_MAX<->1000000
# endif
#endif
#ifndef NAT_TABLE_SZ
# ifdef LARGE_NAT
//# define<--->NAT_TABLE_SZ<-->16383
# define<----->NAT_TABLE_SZ<-->32767
# else
//# define<--->NAT_TABLE_SZ<-->2047
# define<----->NAT_TABLE_SZ<-->32767