I know how to prevent a SSH idle timeout on client and server side, but is there a way to configurate this on gateways?

I am asking because our company network consists of hundreds of clients and dozens of servers. Configurating all ssh_config files on all servers would be a lot of work.

Is there an easy solution to my problem?

  • Do you mean on switches and/or routers?
    – user36472
    Commented Sep 22, 2017 at 7:33
  • 2
    You should specify which brand and model of equipment, as the answer is dependent on this. The answer from Hung Tran is valid for Cisco stuff.
    – JFL
    Commented Sep 22, 2017 at 7:57
  • Most SSH session use keepalive to keep a session working (e.g. through NAT), so detecting 'unused' SSH sessions on a central router (or better: firewall) can be quite complex. Any answer will depend on the equipment used. If you have that many hosts to configure, you should consider deploying SSH config using a central management system like ansible, chef, puppet, salt, etc.
    – Teun Vink
    Commented Sep 22, 2017 at 12:23
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Feb 21, 2018 at 16:37

2 Answers 2


Updated my answer as it is for Cisco:

Under line vty 0 15 configuration part, you can set exec-timeout to zero (0). Zero means the telnet/ssh session remains alive until you close it.

line vty 0 4
 exec-timeout 0
line vty 0 15
 exec-timeout 0
  • This only fixed connection to the router, not SSH connections routed by the device, which seems to be what the OP is asking.
    – Teun Vink
    Commented Sep 22, 2017 at 13:38
  • This is not recommended to have on a production environment, as sessions can stuck and you will be unable to reconnect to your router once all of available sessions will be depleted. Commented Mar 21, 2018 at 15:46
  • @AndreyProkhorov Agreed!
    – Hung Tran
    Commented Mar 21, 2018 at 22:18

@JFL is right. There is no generic solution for gateways as they are just forwarding the connections. But the manufacturer do provide solutions for such configurations on top of a basic router/gateway/switch. Hence different products provide different settings to achieve this and some don't even provide anything like this.

Like Cisco has something @Hung Tran mentioned.

Brocade provides something like this ::

device(config)#ip ssh idle-time 30

Syntax: ip ssh idle-time minutes

If an established SSH session has no activity for the specified number of minutes, the Brocade device closes it. An idle time of 0 minutes (the default value) means that SSH sessions never time out. The maximum idle time for SSH sessions is 240 minutes.

  • Does a RV325 Gigabit Dual WAN VPN-Router support this function? I couldn't find any option to prevent ssh timeout in the firewall settings.
    – Mio K.
    Commented Sep 22, 2017 at 10:52
  • try through CLI.
    – enZyme
    Commented Sep 22, 2017 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.