`
soboer
  • 浏览: 1314041 次
文章分类
社区版块
存档分类
最新评论

linux下二级代理软件desproxy教程

 
阅读更多
desproxy的功能就是一级代理+端口映射
对本地指定的一个端口的请求会经过代理送到远程的主机
远程主机是代理服务器的话就实现了二级代理的功能:)

  1. 怎样获得Desproxy?
    http://desproxy.sourceforge.net/
    页面最下面右下角,有一个project page的链接
    真正的下载页面是
    http://sourceforge.net/project/showfiles.php?group_id=30464&release_id=90041
    现在有三个平台的支持,windows,linux和macos,我们就用linux吧
  2. 安装
    下载后获得一个desproxy-0.1.0-pre1.tgz文件(很快的,只有55k)
    推荐使用root安装,不会碰到什么麻烦
    解压:
    $tarzxvfdesproxy-0.1.0-pre1.tgz
    得到desproxy目录,进入这个目录
    $./configure
    $make
    $makeinstall
    如果在./configure时,遇到错误
    checking for C compiler default output... configure: error: C compiler cannot create executables
    可能是库的问题,通过如下方法解决:
    sudoapt-getinstalllibc6-dev
  3. desproxy的一般用法是
    $desproxyremote_hostremote_portproxy_hostproxy_portlocal_port
    如果第一级代理proxy_host:proxy_port需要简单的用户密码验证(desproxy只支持简单的验证)
    使用全局变量来设置:
    exportPROXY_USER=username:password
    就可以设置浏览器通过127.0.0.1:local_port来通过两层代理浏览
    Establishing proxy...

    -----------------------------------
    desproxy 0.1.0-pre3

    (C) 2003 Miguelanxo Otero Salgueiro
    -----------------------------------

    TCP port 8080 Bound & Listening
    Press <Control+C> to Quit

    Connection request from 127.0.0.1, port 1135
    Connecting to http proxy (xxx.xxx.xxx.xxx:8080)
    Connection #0: bidirectional connection stablished

    Connection #0: client -> proxy 522 bytes read
    Connection #0: proxy -> client 1448 bytes read
    Connection request from 127.0.0.1, port 1137
    Connecting to http proxy (xxx.xxx.xxx.xxx:8080)
    Connection #1: bidirectional connection stablished

  4. 启动脚本和配置文件
    ----------------/etc/init.d/desproxy------------------------
    #!/bin/bash
    if[!-x/usr/local/bin/desproxy];then
    echo"Missingdesproxyexecfile!Maynotinstalledproperly."
    exit0
    fi

    if[!-f/etc/desproxy.conf];then
    echo"Missingconfigurationfile!"
    exit0
    fi
    ./etc/desproxy.conf

    start_desproxy
    (){
    if[-n"$(ps-eo"%a"|grep/usr/local/bin/desproxy
    |grep-vgrep)
    "];
    then
    echo"Desproxyhasalreadyrun!"
    exit0
    fi
    envPROXY_USER
    =$PROXY_USER/usr/local/bin/desproxy$REMOTE_SERVER
    $REMOTE_PORT$PROXY_SERVER$PROXY_PORT$LOCAL_PORT
    1>/var/log/desproxy.log2>&1&
    echo"Desproxyisrunningnow!"
    }

    stop_desproxy
    (){
    DESPROXYPID
    =$(ps-eo"%p%a"|grep/usr/local/bin/desproxy
    |grep-vgrep
    )
    kill-
    15$DESPROXYPID1>/dev/null2>&1
    echo"Desproxyisterminated!"
    }

    case
    "$1"in
    start)
    start_desproxy
    ;;
    stop
    )
    stop_desproxy
    ;;
    restart
    )
    stop_desproxy
    start_desproxy
    ;;
    *
    )
    echo"Usage:/etc/init.d/desproxy{start|stop|restart}"
    exit1
    esac
    exit0


    ----------------------------/etc/desproxy.conf-----------------------

    PROXY_USER=xxxxxx:xxxxxxxxx
    REMOTE_SERVER=xxx.xxx.xxx.xxx
    REMOTE_PORT=xxxx
    PROXY_SERVER=xxxx.xxx.xxx.xxx
    PROXY_PORT=xxxx
    LOCAL_PORT=xxxx

内容参考南大小百合LinuxUnix版精华区http://bbs.nju.edu.cn/vd27676/bbs0an?path=/groups/GROUP_3/LinuxUnix/D8DB6E33F/D8CF8846E/DBD002EF3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics