V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
daodao
V2EX  ›  程序员

虚拟服务器上要怎么配置 VPN 啊,想通过思科 AnyConnect 连接~

  •  
  •   daodao · 2014-12-22 17:55:17 +08:00 · 5400 次点击
    这是一个创建于 3652 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题

    发现AnyConnect连VPN很稳定,操作也很简单。

    现在我有几台国外的虚拟服务器,但不会配置...求教~
    6 条回复    2014-12-23 15:06:07 +08:00
    felinx
        1
    felinx  
       2014-12-22 17:58:51 +08:00
    简单的上pptp
    lolicon
        2
    lolicon  
       2014-12-22 18:02:05 +08:00 via Android
    现成的文章一大把,谷歌一下这么难?
    ooxxcc
        3
    ooxxcc  
       2014-12-22 18:03:14 +08:00
    google ocserv
    daodao
        4
    daodao  
    OP
       2014-12-22 18:12:23 +08:00
    @ooxxcc 谢谢!就是不懂搜什么关键词....
    yywudi
        5
    yywudi  
       2014-12-22 18:16:32 +08:00
    ocserv
    icinessz
        6
    icinessz  
       2014-12-23 15:06:07 +08:00
    以下内容用于ubuntu,不包含证书生成,iptables仅为参考需要根据实际情况修改

    apt-get update
    apt-get install build-essential autogen pkg-config
    apt-get install libgnutls28-dev
    apt-get install libprotobuf-c-dev libtalloc-dev libreadline-dev libpam0g-dev libhttp-parser-dev libpcl1-dev
    wget ftp://ftp.infradead.org/pub/ocserv/ocserv-0.8.8.tar.xz
    xz -d ocserv-0.8.8.tar.xz
    tar -xvf ocserv-0.8.8.tar
    cd ocserv-0.8.8/
    ./configure --prefix=/opt/ocserv --sysconfdir=/etc
    make
    make install
    mkdir /etc/ocserv
    cp doc/sample.config /etc/ocserv/ocserv.conf
    vi /etc/ocserv/ocserv.conf
    //修改以下内容
    auth = "plain[/etc/ocserv/ocpasswd]"
    max-same-clients = 0
    server-cert = /etc/ocserv/xxxxxx.cert.pem
    server-key = /etc/ocserv/xxxxxx.key.pem
    cookie-timeout = 86400
    run-as-group = nogroup
    default-domain = xxxxxx.com
    dns = 8.8.8.8
    dns = 8.8.4.4
    #route = 192.168.1.0/255.255.255.0
    #route = 192.168.5.0/255.255.255.0
    //修改以上内容
    /opt/ocserv/bin/ocpasswd -c /etc/ocserv/ocpasswd xxxxxx
    vi /etc/init.d/ocserv
    //写入以下内容
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: ocserv
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    ### END INIT INFO
    # Copyright Rene Mayrhofer, Gibraltar, 1999
    # This script is distibuted under the GPL

    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/ocserv/sbin
    DAEMON=/opt/ocserv/sbin/ocserv
    PIDFILE=/var/run/ocserv.pid
    DAEMON_ARGS="-c /etc/ocserv/ocserv.conf"

    case "$1" in
    start)
    if [ ! -r $PIDFILE ]; then
    echo -n "Starting OpenConnect VPN Server Daemon: "
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
    $DAEMON_ARGS > /dev/null
    echo "ocserv."
    else
    echo -n "OpenConnect VPN Server is already running.\n\r"
    exit 0
    fi
    ;;
    stop)
    echo -n "Stopping OpenConnect VPN Server Daemon: "
    start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
    echo "ocserv."
    rm -f $PIDFILE
    ;;
    force-reload|restart)
    echo "Restarting OpenConnect VPN Server: "
    $0 stop
    sleep 1
    $0 start
    ;;
    status)
    if [ ! -r $PIDFILE ]; then
    # no pid file, process doesn't seem to be running correctly
    exit 3
    fi
    PID=`cat $PIDFILE | sed 's/ //g'`
    EXE=/proc/$PID/exe
    if [ -x "$EXE" ] &&
    [ "`ls -l \"$EXE\" | cut -d'>' -f2,2 | cut -d' ' -f2,2`" = \
    "$DAEMON" ]; then
    # ok, process seems to be running
    exit 0
    elif [ -r $PIDFILE ]; then
    # process not running, but pidfile exists
    exit 1
    else
    # no lock file to check for, so simply return the stopped status
    exit 3
    fi
    ;;
    *)
    echo "Usage: /etc/init.d/ocserv {start|stop|restart|force-reload|status}"
    exit 1
    ;;
    esac

    exit 0
    //写入以上内容
    chmod 755 /etc/init.d/ocserv
    vi /etc/sysctl.conf
    //修改以下内容
    net.ipv4.ip_forward=1
    //修改以上内容
    sysctl -p
    vi /etc/iptables
    //修改成以下内容
    *filter
    -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
    -A INPUT -m state --state NEW -m udp -p udp --dport 443 -j ACCEPT
    -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
    COMMIT

    *nat
    -A POSTROUTING -o eth0 -j MASQUERADE
    COMMIT
    //修改成以上内容
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1353 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:29 · PVG 01:29 · LAX 09:29 · JFK 12:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.