Страница 1 из 1
squid 30
Добавлено: 2009-12-21 23:41:23
RAGNAR
Прошу прокомментировать настройки проксти - прозрачного. может что не так поправте. на боевом срваке не до эксперементов ((
Код: Выделить всё
http_port 3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 90 MB
cache_swap_high 95
cache_swap_low 90
maximum_object_size 1024 KB
maximum_object_size_in_memory 512 KB
memory_pools off
cache_dir ufs /usr/local/squid/cache 1300 8 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
error_directory /usr/local/etc/squid/errors/Russian-1251
cache_mgr xxxxx
visible_hostname xxxx
tcp_outgoing_address x.x.x.x
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
ignore_unknown_nameservers on
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.0/8
acl our_networks src 192.168.1.0/24
http_access allow our_networks
http_access allow localhost
http_access allow all
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
coredump_dir /usr/local/squid/cache
pid_filename /usr/local/squid/logs/squid.pid
Re: squid 30
Добавлено: 2009-12-22 10:13:53
hizel
не вижу ключевого слова transparent в конфиге
в современном мире очень хорошо развиты средства виртуализации
Re: squid 30
Добавлено: 2009-12-22 11:40:47
RAGNAR
тоесть
http_port 3128 transparent
Re: squid 30
Добавлено: 2009-12-22 12:41:18
RAGNAR
пробую ставить
что могут быть за ошибки конфиг выше
Код: Выделить всё
unix# squid -z
2009/12/22 12:34:50| cache_cf.cc(346) squid.conf:47 unrecognized: 'httpd_accel_host'
2009/12/22 12:34:50| cache_cf.cc(346) squid.conf:48 unrecognized: 'httpd_accel_port'
2009/12/22 12:34:50| cache_cf.cc(346) squid.conf:49 unrecognized: 'httpd_accel_with_proxy'
2009/12/22 12:34:50| cache_cf.cc(346) squid.conf:50 unrecognized: 'httpd_accel_uses_host_header'
2009/12/22 12:34:50| Creating Swap Directories
2009/12/22 12:34:50| /usr/local/squid/cache exists
2009/12/22 12:34:50| /usr/local/squid/cache/00 exists
2009/12/22 12:34:50| Making directories in /usr/local/squid/cache/00
2009/12/22 12:34:50| /usr/local/squid/cache/01 exists
2009/12/22 12:34:50| Making directories in /usr/local/squid/cache/01
Re: squid 30
Добавлено: 2009-12-22 12:48:12
hizel
Re: squid 30
Добавлено: 2009-12-22 13:06:05
RAGNAR
уже понял и переделал.
есть вопрос у меня две сетевые смотрят в локал сеть, они в мосте. как лучше пречислить ip или оставить просто порт. на серваке есть днс кеширующий.
Код: Выделить всё
http_port 3128 transparent
эта закоментил
#httpd_accel_host virtual
#httpd_accel_port 80
#httpd_accel_with_proxy on
#httpd_accel_uses_host_header on
даю каманду сдесь все ок
Код: Выделить всё
unix# squid -z
2009/12/22 13:02:00| Creating Swap Directories
2009/12/22 13:02:00| /usr/local/squid/cache exists
2009/12/22 13:02:00| /usr/local/squid/cache/00 exists
2009/12/22 13:02:00| Making directories in /usr/local/squid/cache/00
2009/12/22 13:02:00| /usr/local/squid/cache/01 exists
2009/12/22 13:02:00| Making directories in /usr/local/squid/cache/01
а вот тут нечего и в top тоже.
Код: Выделить всё
unix# /usr/local/etc/rc.d/squid start
unix# ps -ax | grep squid
1344 p0 R+ 0:00.01 grep squid
Re: squid 30
Добавлено: 2009-12-22 13:21:20
(leo)
а в от еще
Код: Выделить всё
######CONFIG START
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
no_cache deny QUERY
cache_mem 8 MB
maximum_object_size 50960 KB
maximum_object_size_in_memory 16 KB
cache_dir diskd /var/squid/cache 40000 16 256
cache_access_log /var/squid/log/access.log
cache_log none
cache_store_log none
pid_filename /var/run/squid.pid
hosts_file /etc/hosts
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 10080
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80 # http
acl Safe_ports port 8080 #also http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
acl blacklist dstdomain ./usr/local/etc/squid/blacklist.txt.
http_access deny blacklist
http_access allow manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
#change below 10.0.1.0/24 to what matches your LAN IP address space
acl our_networks src 192.168.1.0/24
http_access allow our_networks
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
cache_mgr dante@new-order.org
cache_effective_user squid
visible_hostname neptun.new-order.org
cachemgr_passwd secret all
coredump_dir /var/squid/coredump
######CONFIG END
Re: squid 30
Добавлено: 2009-12-22 15:57:51
RAGNAR
с эти вроде разобрался блогодарю за конфиг.
остался маленький вопрос про NAT. я использую ipnat
Код: Выделить всё
rdr fxp0 0.0.0.0/0 port 80 -> 192.168.1.2 port 3128
map tun0 192.168.1.0/24 -> 84.x.x.x/32 portmap tcp/udp auto
вообще у меня мост из 2 сетевых, значит и 2 тут нужно прописывать?
и еще непонятки вот с этим правелом , его вроде нужно указывать до диверта нат. а у меня ipnat ??
Код: Выделить всё
fwd 127.0.0.1,3128 tcp from 192.168.0.0/24 to any 80 via fxp0
Re: squid 30
Добавлено: 2009-12-22 21:37:24
RAGNAR
тема актуально, поскажите! что то с правилами ipnat у меня все идет не через сквид а напремую.
squid.conf
Код: Выделить всё
http_port 127.0.0.1:3128 transparent
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 90 MB
maximum_object_size 1024 KB
maximum_object_size_in_memory 512 KB
memory_pools off
cache_dir ufs /usr/local/squid/cache 1300 8 256
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
cache_mgr sysctl@mail.ru
visible_hostname sysctl@mail.ru
tcp_outgoing_address 84.x.x.x
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 10080
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80
acl Safe_ports port 8080
acl Safe_ports port 443 563
acl CONNECT method CONNECT
http_access allow manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl our_networks src 192.168.1.0/24
http_access allow our_networks
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_user squid
coredump_dir /usr/local/squid/cache
pid_filename /usr/local/squid/logs/squid.pid
cache.log я так понел тут ошибок нет .
Код: Выделить всё
2009/12/22 21:18:28| Squid Cache (Version 3.0.STABLE19): Exiting normally.
2009/12/22 21:19:25| Starting Squid Cache version 3.0.STABLE19 for i386-portbld-freebsd7.2...
2009/12/22 21:19:25| Process ID 1847
2009/12/22 21:19:25| With 14720 file descriptors available
2009/12/22 21:19:25| DNS Socket created at 0.0.0.0, port 54402, FD 7
2009/12/22 21:19:25| Adding nameserver 127.0.0.1 from /etc/resolv.conf
2009/12/22 21:19:25| Adding nameserver 84.x.x.x from /etc/resolv.conf
2009/12/22 21:19:25| Adding nameserver 84.x.x.x from /etc/resolv.conf
2009/12/22 21:19:25| Unlinkd pipe opened on FD 12
2009/12/22 21:19:25| Swap maxSize 1331200 + 92160 KB, estimated 109489 objects
2009/12/22 21:19:25| Target number of buckets: 5474
2009/12/22 21:19:25| Using 8192 Store buckets
2009/12/22 21:19:25| Max Mem size: 92160 KB
2009/12/22 21:19:25| Max Swap size: 1331200 KB
2009/12/22 21:19:25| Version 1 of swap file with LFS support detected...
2009/12/22 21:19:25| Rebuilding storage in /usr/local/squid/cache (CLEAN)
2009/12/22 21:19:25| Using Least Load store dir selection
2009/12/22 21:19:25| Set Current Directory to /usr/local/squid/cache
2009/12/22 21:19:25| Loaded Icons.
2009/12/22 21:19:25| Accepting transparently proxied HTTP connections at 127.0.0.1, port 3128, FD 14.
2009/12/22 21:19:25| HTCP Disabled.
2009/12/22 21:19:25| Ready to serve requests.
2009/12/22 21:19:25| Done reading /usr/local/squid/cache swaplog (0 entries)
2009/12/22 21:19:25| Finished rebuilding storage from disk.
2009/12/22 21:19:25| 0 Entries scanned
2009/12/22 21:19:25| 0 Invalid entries.
2009/12/22 21:19:25| 0 With invalid flags.
2009/12/22 21:19:25| 0 Objects loaded.
2009/12/22 21:19:25| 0 Objects expired.
2009/12/22 21:19:25| 0 Objects cancelled.
2009/12/22 21:19:25| 0 Duplicate URLs purged.
2009/12/22 21:19:25| 0 Swapfile clashes avoided.
2009/12/22 21:19:25| Took 0.05 seconds ( 0.00 objects/sec).
2009/12/22 21:19:25| Beginning Validation Procedure
2009/12/22 21:19:25| Completed Validation Procedure
2009/12/22 21:19:25| Validated 25 Entries
2009/12/22 21:19:25| store_swap_size = 0
2009/12/22 21:19:26| storeLateRelease: released 0 objects
ipnat
Код: Выделить всё
rdr fxp0 192.168.1.0/24 port 80 -> 127.0.0.1 port 3128 tcp
rdr fxp0 192.168.1.0/24 port 8080 -> 127.0.0.1 port 3128 tcp
я так понемаю вот тут касяк, убираю, инет гаснет совсем.
map tun0 192.168.1.0/24 -> 84.42.28.194/32 portmap tcp/udp auto
в ipfw кекаких правил нет по форвардингу
Re: squid 30
Добавлено: 2009-12-23 0:58:01
goshanecr
Я вот ipnat не пользовал но вроде как строки:
Код: Выделить всё
rdr fxp0 192.168.1.0/24 port 80 -> 127.0.0.1 port 3128 tcp
rdr fxp0 192.168.1.0/24 port 8080 -> 127.0.0.1 port 3128 tcp
Обозначают следующее:
Всё что идёт с сетки 192.168.1.0/24 и порт ИСТОЧНИКА 80 или 8080 переправляется на прозрачный прокси. А должно быть: Всё что идёт с сетки 192.168.1.0/24 и порт НАЗНАЧЕНИЯ 80 или 8080 переправляется на прозрачный прокси.
Ещё раз повторю что с ipnat не работал, потому могу ошибаться. С ipfw это делается так:
Код: Выделить всё
ipfw add 100 fwd 127.0.0.1,3128 all from 192.168.1.0/24 to any 80,8080 via tun0 out
Ну и для работы форвардинга надо в rc.conf добавить:
И раз уж пользуем ipfw то и nat можно сделать ipfw + natd, для этого в ядре:
Код: Выделить всё
options IPDIVERT
options IPFIREWALL
options IPFIREWALL_FORWARD
для natd в rc.conf:
/etc/natd.conf
Код: Выделить всё
use_sockets yes
same_ports yes
unregistered_only yes
dunamic yes
Ну и проброс с и на нат в фаерволе дополнительно к первому правилу:
Код: Выделить всё
ipfw add 200 divert natd all from 192.168.1.0/24 to any not 80,8080 via tun0 out
ipfw add 300 divert natd all from any to ВНЕШНИЙ_ИП via tun0 in
Вроде так.
Re: squid 30
Добавлено: 2009-12-23 13:58:05
RAGNAR
вобщем разобрался.
работает только в этой конструкции,
а ежли вместо 0.0.0.0 а если вписывать сеть 192.168.1.0/24 редирект не происходит !!!
кто небудь можжет обяснить это явление?
Код: Выделить всё
rdr fxp0 0.0.0.0/0 port 80 -> 127.0.0.1 port 3128 tcp
rdr fxp0 0.0.0.0/0 port 8080 -> 127.0.0.1 port 3128 tcp