V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
013231
V2EX  ›  问与答

自己架设的VPN, 无法连接.

  •  
  •   013231 · 2012-01-15 01:48:09 +08:00 · 20797 次点击
    这是一个创建于 4695 天前的主题,其中的信息可能已经有所发展或是发生改变。
    linode VPS, Ubuntu 10.04. 按照这个教程架设的VPN:
    http://b.gkp.cc/2010/06/19/setup-ipsec-l2tp-on-centos-55/



    之后就可以启动 l2tp 了,先用 debug 方式启动,有错误可以直接在 console 看到
    xl2tpd -D

    这一步时出问题了, 无法连接.
    使用iPhone, 联通3G线路连接时手机提示:
    通讯设备已中断了您的连接. 请重试连接. 如果问题继续存在, 请验证您的设置.

    服务器端日志如下:
    4 xl2tpd[8677]: control_finish: Peer requested tunnel 6 twice, ignoring second one.
    5 xl2tpd[8677]: Connection established to 112.224.2.14, 57587. Local: 2475, Remote: 6 (ref=0/0). LNS session is 'default'
    6 xl2tpd[8677]: start_pppd: I'm running:
    7 xl2tpd[8677]: "/usr/sbin/pppd"
    8 xl2tpd[8677]: "passive"
    9 xl2tpd[8677]: "nodetach"
    10 xl2tpd[8677]: "10.1.2.1:10.1.2.2"
    11 xl2tpd[8677]: "refuse-pap"
    12 xl2tpd[8677]: "refuse-chap"
    13 xl2tpd[8677]: "auth"
    14 xl2tpd[8677]: "debug"
    15 xl2tpd[8677]: "file"
    16 xl2tpd[8677]: "/etc/ppp/options.xl2tpd"
    17 xl2tpd[8677]: "/dev/pts/1"
    18 xl2tpd[8677]: Call established with 112.224.2.14, Local: 58053, Remote: 6675, Serial: 1
    19 /usr/sbin/pppd: In file /etc/ppp/options.xl2tpd: unrecognized option 're-mschap-v2'
    20 xl2tpd[8677]: child_handler : pppd exited for call 6675 with code 2
    21 xl2tpd[8677]: call_close: Call 58053 to 112.224.2.14 disconnected
    22 xl2tpd[8677]: write_packet: tty is not open yet.
    23 xl2tpd[8677]: result_code_avp: result code out of range (768 58053 14). Ignoring.
    24 xl2tpd[8677]: control_finish: Connection closed to 112.224.2.14, serial 1 ()
    25 xl2tpd[8677]: Terminating pppd: sending TERM signal to pid 8685
    26 xl2tpd[8677]: pppd 8685 successfully terminated
    27 xl2tpd[8677]: result_code_avp: result code out of range (256 58053 14). Ignoring.
    28 xl2tpd[8677]: control_finish: Peer tried to disconnect without specifying result code.
    29 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    30 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    31 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    32 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    33 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    34 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    35 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    36 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    37 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    38 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    39 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    40 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    41 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    42 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    43 xl2tpd[8677]: get_call: can't find call 58053 in tunnel 2475
    44 (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 6 (got 4, expected 6)
    45 xl2tpd[8677]: Maximum retries exceeded for tunnel 2475. Closing.
    46 xl2tpd[8677]: Connection 6 closed to 112.224.2.14, port 57587 (Timeout)
    47 xl2tpd[8677]: Unable to deliver closing message for tunnel 2475. Destroying anyway.

    又尝试使用电信线路连接, 同样无法连接, 日志如下:

    xl2tpd[8677]: control_finish: Peer requested tunnel 7 twice, ignoring second one.
    xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 2, expected 1)
    xl2tpd[8677]: handle_packet: bad control packet!
    xl2tpd[8677]: Connection established to 218.23.115.121, 55546. Local: 27794, Remote: 7 (ref=0/0). LNS session is 'default'
    xl2tpd[8677]: start_pppd: I'm running:
    xl2tpd[8677]: "/usr/sbin/pppd"
    xl2tpd[8677]: "passive"
    xl2tpd[8677]: "nodetach"
    xl2tpd[8677]: "10.1.2.1:10.1.2.2"
    xl2tpd[8677]: "refuse-pap"
    xl2tpd[8677]: "refuse-chap"
    xl2tpd[8677]: "auth"
    xl2tpd[8677]: "debug"
    xl2tpd[8677]: "file"
    xl2tpd[8677]: "/etc/ppp/options.xl2tpd"
    xl2tpd[8677]: "/dev/pts/1"
    xl2tpd[8677]: Call established with 218.23.115.121, Local: 56872, Remote: 42431, Serial: 1
    /usr/sbin/pppd: In file /etc/ppp/options.xl2tpd: unrecognized option 're-mschap-v2'
    xl2tpd[8677]: child_handler : pppd exited for call 42431 with code 2
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Error 9 (Bad file descriptor)
    xl2tpd[8677]: read_packet: Too many errors. Declaring call dead.
    xl2tpd[8677]: network_thread: tossing read packet, error = Bad file descriptor (9). Closing call.
    xl2tpd[8677]: call_close: Call 56872 to 218.23.115.121 disconnected
    xl2tpd[8677]: write_packet: tty is not open yet.
    xl2tpd[8677]: result_code_avp: result code out of range (768 27749 14). Ignoring.
    xl2tpd[8677]: control_finish: Connection closed to 218.23.115.121, serial 1 (Bad file descriptor)
    xl2tpd[8677]: Terminating pppd: sending TERM signal to pid 8705
    xl2tpd[8677]: pppd 8705 successfully terminated
    xl2tpd[8677]: result_code_avp: result code out of range (256 27749 14). Ignoring.
    xl2tpd[8677]: control_finish: Peer tried to disconnect without specifying result code.
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: get_call: can't find call 56872 in tunnel 27794
    (ref=0/0)xl2tpd[8677]: check_control: Received out of order control packet on tunnel 7 (got 4, expected 6)
    xl2tpd[8677]: Maximum retries exceeded for tunnel 27794. Closing.
    xl2tpd[8677]: Connection 7 closed to 218.23.115.121, port 55546 (Timeout)
    xl2tpd[8677]: Unable to deliver closing message for tunnel 27794. Destroying anyway.

    这是什么原因呢?
    7 条回复    2018-12-08 22:18:30 +08:00
    reus
        1
    reus  
       2012-01-15 04:09:17 +08:00 via Android
    xl2tpd: unrecognized option 're-mschap-v2'
    aveline
        2
    aveline  
       2012-01-15 06:19:40 +08:00
    re- mschap-v2应该是require-mschap-v2
    013231
        3
    013231  
    OP
       2012-01-15 15:20:05 +08:00
    @aveline 谢谢, 这个问题已经解决了.
    可是又有一个新问题:

    mkdir /var/run/xl2tpd/
    ln -s /usr/local/sbin/l2tp-control /var/run/xl2tpd/l2tp-control

    可是只要重启机器, 这个/var/run/xl2tpd/目录就消失了. 应该如何使它保留在那里?
    aveline
        4
    aveline  
       2012-01-15 18:39:16 +08:00
    @013231 将以下内容添加到/etc/rc.local文件的末端。

    mkdir /var/run/xl2tpd/
    ln -s /usr/local/sbin/l2tp-control /var/run/xl2tpd/l2tp-control
    013231
        5
    013231  
    OP
       2012-01-15 20:40:53 +08:00
    @aveline 我现在正是这么做的, 在/usr/local/sbin/xl2tpd前加入那两行代码. 但作者给出的rc.local文件中并没有那两行代码, 所以我怀疑是不是有什么办法把 /var/run/xl2tpd/l2tp-control固定在那儿, 而不是每次重启都新建一个.
    reus
        6
    reus  
       2012-01-16 19:13:31 +08:00
    不要直接改/usr/local/sbin/xl2tpd,升级可能就被覆盖掉了
    hyrz
        7
    hyrz  
       2018-12-08 22:18:30 +08:00 via Android
    术业有专攻,直接走付费的
    https://topvpn.github.io
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4295 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 05:33 · PVG 13:33 · LAX 21:33 · JFK 00:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.