ZRS
V2EX  ›  问与答

如何解决 mac 唤醒之后的 ssh 重连延迟?

  •  
  •   ZRS · Oct 21, 2016 · 2064 views
    This topic created in 3493 days ago, the information mentioned may be changed or developed.

    目前使用的 iTerm2 ,每次唤醒之后休眠之前没有断掉的 ssh 回话就会假死非常久,然后跳出一个 broken pipe

    假死过程中任何操作都不响应,往往我手动关掉这个窗口重新建立一个 ssh 连接会快的多,但是每次这么折腾还是挺麻烦的

    怎么样才能缩短这个等待时间让其直接断开呢?

    2 replies    2016-10-21 22:48:55 +08:00
    ynyounuo
        1
    ynyounuo  
       Oct 21, 2016 via iPhone
    换 mosh 解决一切 ssh 连接问题
    AntonChen
        2
    AntonChen  
       Oct 21, 2016   ❤️ 1
    Host *
    #连接超时时间 5 秒
    ConnectTimeout 5
    #连接失败重试 3 次
    ConnectionAttempts 3
    #Client 每隔 15 秒心跳
    ServerAliveInterval 15
    #三次心跳检查失败后断开连接
    ServerAliveCountMax 3
    #开启 Session 保存
    ControlMaster auto
    #Session 存储路径
    ControlPath ~/.ssh/session/%h-%p-%r
    #Session 有效期
    ControlPersist 6h
    #默认用户
    User root
    GSSAPIAuthentication no
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1228 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 17:41 · PVG 01:41 · LAX 10:41 · JFK 13:41
    ♥ Do have faith in what you're doing.