Ssh timeout settings solution: 1. modify the etc/ssh/sshd_configClientAliveInterval60 # The server sends a request to the client every 60 seconds, and then the client responds to the request, so as to keep the connection to www.2cto. comClientAliveCou... ssh timeout settings solution: 1. modify the etc/ssh/sshd_configClientAliveInterval 60 # The server sends a request to the client every 60 seconds, and then the client responds, so that the connection to www.2cto.com ClientAliveCountMax 3 # after the server sends a request, if the client does not respond 3 times, the connection is automatically disconnected. Normally, the client does not respond 2. modify the etc/ssh/ssh_config on the client to add the following: Server aliveinterval 60 # The client sends a request to the server every 60 seconds, and then the server responds, so that the connection to ServerAliveCountMax 3 # after the client sends a request, if the server does not respond 3 times, the connection is automatically disconnected. Normally, the server does not respond to www.2cto.com 3. another method: Do not modify the configuration file. in the command parameter, ssh-o ServerAliveInterval = 60 will only maintain a persistent connection in the required connection, after all, not all connections must be persistent ================================ =================== keeping your ssh session alive through pesky (annoying, troublesome) NAT firewils. NAT firewils like to time out Idle sessions to keep their state tables clean and their memory footprint low. NAT firewall prefers to Time Out idle sessions to ensure their state tables are clean and their memory usage is low. Some firewils are nice, and let you idle for up to a day or so; some are gestapo and terminate your session after 5 minutes. some firewalls are friendly and allow your free sessions to take a day or even more than one day. Others, such as Gaishi Taibao, terminate your sessions if you are idle for five minutes. I finally got tired of my ssh sessions getting disconnected at places where I don't control the firewils, and figured out how to stop it. I eventually lost my ssh connection session and found a solution to block it. Turn out ssh has a nice inband keepalive mechanic, and even lets you set it on a per-destination basis. the conclusion is that ssh has a good mechanism to keep the session alive, and even allows you to set it on each target machine. Just create ~ /. Ssh/config file with something like the following (* will match any host, if you wanted you cocould restrict this to particle destinations like * kehlet. cx): You only need to use the following similar content to create ~ /. Ssh/config file (* will match all hosts. if you want to, you can strictly set it as a specific target host, such as kehlet. cx): ---------------- Host * ServerAliveInterval 240 -------------- That's how often, in seconds, ssh will send a keepalive request (at the application layer) to the other end if the connection's been otherwise idle. 4 minutes shocould be good :-). this is usually in seconds. if the connection is idle, ssh will send a surviving request (at the application layer) to the other end. 4 minutes should be good. The Host line lets you pattern match your destinations. minimal effort, no impact to your system (say, as you wowould have if you mucked with your system's default TCP keepalive settings), and it works like a charm. host exercise you match your target Host. A very small effort will have no impact on your system (that is, if you mess up your system's default TCP retention time setting, it will affect your system) and will be very effective.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.