• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • squid+iptables透明代理

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    參照這篇文章做的代理設置 # NETWORK OPTIONS(有關的 網絡 選項) # ----------------------------------------------------------------------------- http_port 3128 #代理端口 # OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM(作用于鄰居選擇
    參照這篇文章做的代理設置

    # NETWORK OPTIONS(有關的網絡選項) # -----------------------------------------------------------------------------
    http_port 3128 #代理端口

    # OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM(作用于鄰居選擇算法的有關選項)
    #-----------------------------------------------------------------------------

    #禁止緩存
    hierarchy_stoplist cgi-bin ?
    hierarchy_stoplist -i ^https:\ ?
    acl QUERY urlpath_regex -i cgi-bin \? \.asp \.php \.jsp \.cgi
    acl denyssl urlpath_regex -i ^https:\
    no_cache deny QUERY
    no_cache deny denyssl

    # OPTIONS WHICH AFFECT THE CACHE SIZE(定義cache大小的選項)
    # -----------------------------------------------------------------------------

    cache_mem 8 MB   #額外使用內存量,可根據你的系統內存在設定,一般為實際內存的1/3

    cache_swap_low 90    #最低緩存百分比
    cache_swap_high 95     ##最高緩存百分比,就是上面那個額外內存的使用百分比

    maximum_object_size 4096 KB  #單個文件最大緩存大小,超過這個大小將不緩存

    maximum_object_size_in_memory 8 KB  #在內存中單個文件最大緩存大小,超過這個大小將不緩存到內存中

    #有DNS正反解所得到的IP存在緩存區的大小,這樣可以加快解析速度
    ipcache_size 1024
    ipcache_low 90
    ipcache_high 95
    fqdncache_size 1024


    # LOGFILE PATHNAMES AND CACHE DIRECTORIES(定義日志文件的路徑及cache的目錄)
    # ----------------------------------------------------------------------------- 

    cache_dir aufs /Cache1 100 16 256 
    cache_dir aufs /Cache2 100 16 256

    #日志存放位置
    cache_aclearcase/" target="_blank" >ccess_log /usr/local/squid/var/logs/access.log
    cache_log /usr/local/squid/var/logs/cache.log

    #  TAG: cache_store_log
    cache_store_log /usr/local/squid/var/logs/store.log

    #  TAG: pid_filename
    pid_filename /usr/local/squid/var/logs/squid.pid

    # OPTIONS FOR EXTERNAL SUPPORT PROGRAMS(外部支持程序選項)
    # -----------------------------------------------------------------------------

    #用代理登陸匿名ftp服務選項
    #  TAG: ftp_user
    ftp_user Squid@    #用戶名
    ftp_passive on     #被動模式

    #認證
    #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

    # OPTIONS FOR TUNING THE CACHE(調整cache的選項)
    # -----------------------------------------------------------------------------

    #  TAG: refresh_pattern    Cache更新時間設置
    #<refresh_pattern> <regex> <最小時間> <百分比> <最大時間>

    refresh_pattern ^ftp:      1440   20%   10080
    refresh_pattern ^gopher:   1440   0%   1440
    refresh_pattern .      0   20%   4320

    #上面第一行如果網址開頭是 ftp 的話,那么在一天(1440分鐘)后,
    #如果proxy 再次取用這個檔案時,則 cache 內的數據會被更新!

    # TIMEOUTS (超時)
    # -----------------------------------------------------------------------------
    #連接到其他機器的最大嘗試時間
    connect_timeout 1 minute

    #連接到上層代理的超時時間
    peer_connect_timeout 30 seconds

    #返回超時
    request_timeout 2 minutes

    #持續連接時間
    persistent_request_timeout 1 minute

    # ACCESS CONTROLS(訪問控制)
    # -----------------------------------------------------------------------------

    #  TAG: acl

    #Examples:
    #acl myexample dst_as 1241
    #acl password proxy_auth REQUIRED
    #acl fileupload req_mime_type -i ^multipart/form-data$
    #acl javascript rep_mime_type -i ^application/x-javascript$
    #
    #Recommended minimum configuration:
    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 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 inside src 192.168.0.0/24   #內部網IP段
    acl localmac arp "/usr/local/squid/localmac"  #mac地址文件

    #  TAG: http_access
    http_access allow inside  #允許inside規則通過
    #http_access allow localmac  #允許localmac里面有登記的mac地址通過

    #
    #Recommended minimum configuration:
    #
    # Only allow cachemgr access from localhost
    http_access allow manager localhost
    http_access deny manager
    # Deny requests to unknown ports
    http_access deny !Safe_ports
    # Deny CONNECT to other than SSL ports
    http_access deny CONNECT !SSL_ports
    #

    #http_access deny to_localhost
    #
    # And finally deny all other access to this proxy
    http_access deny all

    #  TAG: http_reply_access

    http_reply_access allow all

    #  TAG: icp_access

    #icp_access allow all

    #  TAG: cache_peer_access

    # ADMINISTRATIVE PARAMETERS(管理參數)
    # -----------------------------------------------------------------------------

    #  TAG: cache_mgr
    cache_mgr webmaster@localhost  #管理員信箱

    #  TAG: cache_effective_user
    cache_effective_user squid  #運行squid時的用戶
    cache_effective_group  squid #運行squid時的組

    #  TAG: visible_hostname
    visible_hostname ProxyServer  #代理服務器名稱


    # OPTIONS FOR THE CACHE REGISTRATION SERVICE(cache注冊服務選項)
    # -----------------------------------------------------------------------------


    # HTTPD-ACCELERATOR OPTIONS(HTTPD加速選項)
    # -----------------------------------------------------------------------------
    #設定透明代理
    httpd_accel_host ProxyServer  #主機名
    httpd_accel_port 80  #透明代理端口
    httpd_accel_with_proxy on
    httpd_accel_uses_host_header on


    # MISCELLANEOUS(雜項)
    # -----------------------------------------------------------------------------

    #  TAG: logfile_rotate
    logfile_rotate 4

    #  TAG: forwarded_for   on|off
    #關閉此項將在訪問某些論壇時顯示的IP是unknown,
    #如果打開則顯示的是你client的內網IP

    forwarded_for off


    #圖標文件目錄
    # icon_directory /usr/local/squid/share/icons

    #錯誤提示文件目錄
    # error_directory /usr/local/squid/share/errors/Simplify_Chinese

    #  TAG: snmp_port
    #   Squid can now serve statistics and status information via SNMP.
    #   By default it listens to port 3401 on the machine. If you don't
    #   wish to use SNMP, set this to "0".
    #
    #Default:
    # snmp_port 3401

    #  TAG: snmp_access
    #   Allowing or denying access to the SNMP port.
    #
    #   All access to the agent is denied by default.
    #   usage:
    #
    #   snmp_access allow|deny [!]aclname ...
    #
    #Example:
    # snmp_access allow snmppublic localhost
    # snmp_access deny all
    #
    #Default:
    # snmp_access deny all

    # DELAY POOL PARAMETERS (all require DELAY_POOLS compilation option)(延時池參數)
    # -----------------------------------------------------------------------------


    #  TAG: coredump_dir
    #當squid突然掛掉的時候,或者突然出現什么故障的時候,將squid在內存中的資料寫到硬盤中
    coredump_dir /usr/local/squid/var/cache

    二、設置iptables支持透明代理
    #!/bin/bash
    OUT_IP="221.000.000.0"
    IN_IP="192.168.0.1"
    echo "1" > /proc/sys/net/ipv4/ip_forward #設置轉發
    modprobe iptable_nat
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp
    /sbin/iptables -t nat -A POSTROUTING -j MASQUERADE #設置nat功能
    iptables -t nat -A PREROUTING -i eth0 -p tcp -s 192.168.1.0/24 --dport 80 -j REDIRECT --to-ports 3128 #將所有80端口的請求都轉發到suqid的3128端口上
    iptables -A FORWARD -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/24 -j SNAT --to-source $OUT_IP

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>