阅读背景:

Google Cloud ssh超时:如何增加会话时间?

来源:互联网 

For connection from Linux I use:

对于从Linux的连接,我使用:

gcloud compute --project "xxx" ssh --zone "europe-west-b" "yyy"

gcloud compute --project“xxx”ssh --zone“europe-west-b”“yyy”

After ~10 minutes of innactivity my console freeze or I see error 255.

在大约10分钟的无效后,我的控制台冻结或者我看到错误255。

2 个解决方案

#1


Google cloud has a session timeout across the board of 10 minutes, so you need to use a keepalive. Try adding the argument --ssh-flag="-ServerAliveInterval=30" - any value less than 600 should do the trick there.

Google云的会话超时时间为10分钟,因此您需要使用keepalive。尝试添加参数--ssh-flag =“ - ServerAliveInterval = 30” - 任何小于600的值都应该在那里做。

There's a description of the timeout here, and full usage details for gcloud ssh here.

这里有超时的描述,以及gcloud ssh的完整使用细节。

#2


It freezes because of KEEP_ALIVE. In Linux systems it's not started automatically.

它因KEEP_ALIVE而冻结。在Linux系统中,它不是自动启动的。

You should run that command in the linux client or in the compute engine instance:

您应该在Linux客户端或计算引擎实例中运行该命令:

sudo /sbin/sysctl -w net.ipv4.tcp_keepalive_time=60 net.ipv4.tcp_keepalive_intvl=60 net.ipv4.tcp_keepalive_probes=5

For MAC OS client:

对于MAC OS客户端:

sudo sysctl -w net.inet.tcp.always_keepalive=1 net.inet.tcp.keepidle=60000 net.inet.tcp.keepinit=60000 net.inet.tcp.keepintvl=60000

For Windows on the path:

对于路径上的Windows:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\

Add these settings or change the values to:

添加这些设置或将值更改为:

KeepAliveInterval: 1000
KeepAliveTime: 60000
TcpMaxDataRetransmissions: 10

After that your client console will be able to keep a bigger session time !!!

之后,您的客户端控制台将能够保持更长的会话时间!


分享到: