linux下二级代理软件desproxy教程

本文介绍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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值