Reputation: 14852
For connection from Linux I use:
gcloud compute --project "xxx" ssh --zone "europe-west-b" "yyy"
After ~10 minutes of innactivity my console freeze or I see error 255
.
Upvotes: 18
Views: 28889
Reputation: 1444
It freezes because of KEEP_ALIVE. In Linux systems it's not started automatically.
You should run that command in the linux client or in the compute engine instance:
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:
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:
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 !!!
Upvotes: 0
Reputation: 11844
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.
There's a description of the timeout here, and full usage details for gcloud ssh here.
Upvotes: 30