• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Change the Default Timeout Settings for Telnet Session in CentOS/RHEL

by admin

To modify the telnet timeout you need to change the value of the tcp keepalive parameters. Let us first check the default values of TCP keepalive parameter.

# cat /proc/sys/net/ipv4/tcp_keepalive_time
7200
# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
75
# cat /proc/sys/net/ipv4/tcp_keepalive_probes
9

The first two parameters are expressed in seconds, and the last is the pure number. This means that the keepalive routines wait for two hours (7200 secs) before sending the first keepalive probe, and then resend it every 75 seconds. If no ACK response is received for nine consecutive times, the connection is marked as broken. So we need to change the value for the tcp_keepalive_time, to prevent the disconnection after 5 minutes, these changes has to be made in the client side.

The system need to have smaller value in the tcp_keepalive_time, if 7200 secs is two hours, 4 minutes will be 240 secs, the keepalive need to start after four minutes of channel inactivity, and then send probes in intervals of one minute e.g:

# echo 240 > /proc/sys/net/ipv4/tcp_keepalive_time ( this value is below the 5 minutes)
# echo 60 > /proc/sys/net/ipv4/tcp_keepalive_intvl
# echo 20 > /proc/sys/net/ipv4/tcp_keepalive_probes
Note: These values are to be tested and adjust them if need it.

Makign Changes Permanent

After getting the right values we can make the changes to be persistent after reboot by adding the parameter values in the configuration file /etc/sysctl.conf:

# vi /etc/sysctl.conf
net.ipv4.tcp_keepalive_time = [value]
net.ipv4.tcp_keepalive_intvl = [value]
net.ipv4.tcp_keepalive_probes = [value]

Filed Under: CentOS/RHEL 6, Linux

Some more articles you might also be interested in …

  1. “map in use” error while removing multipath device in CentOS/RHEL
  2. ufw Command Examples in Linux
  3. Understanding SELinux Policies in Linux
  4. kwriteconfig5: command not found
  5. How To Disable Or Extend System Logging Rate-limit on CentOS/RHEL 6
  6. ifrename Command Examples in Linux
  7. Configure VSFTPD Chroot Environment in CentOS and RHEL
  8. Extend the Size of /boot Partition on XFS Filesystem (CentOS/RHEL 7)
  9. CentOS / RHEL 6 : How to extract initramfs image and edit/view it
  10. Beginners Guide to Automounting File Systems in CentOS / RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright