-1

问题:

我有一台 AWS EC2 Ubuntu 16.04 机器设置为每 5 分钟更改一次 IP。我需要通过 SSH 在上面工作,但这显然很难,因为终端控制台冻结,然后我必须通过输入新 IP 重新连接。我已经测试过的另一种方法是使用带有动态 DNS 的 noip.com,但控制台仍然冻结,我通常需要等待几分钟直到 DNS 传播。

问题:

你知道解决这个问题的任何可能的选择吗?尽管频繁更改 IP,我仍希望保持我的 SSH 会话处于活动状态。

4

1 回答 1

0

问题是由于在启动新实例时配置错误的 EC2 实例,尝试创建一个新实例并明智地配置配置安全组。如果这不起作用,请尝试执行

    cd ~/.ssh
    sudo nano config

添加变量及其值

    Sets number of server alive messages which may be sent without ssh 
    receiving any messages back from the server.

    ServerAliveCountMax 3

    # Timeout interval (in seconds) after which if no data has been received 
    from the 
    server, ssh will send a message 
    # through the encrypted channel to request a response from the server.

    ServerAliveInterval 5
于 2019-07-01T19:45:14.457 回答