Operating System - Linux
1828785 Members
2904 Online
109985 Solutions
New Discussion

Unsuccesfull TCP session does not time out

 
Paul Ambro
Occasional Advisor

Unsuccesfull TCP session does not time out

I am seeing a problem with my TCP stack in which I try to connect to a machine which is listed on DNS but is not "pinagble" and
the port is not active. The problem is that the connection doesn't time-out. If I do it from windows, the connection times out.

Here is an example:

[root@xxxxxxxx root]# telnet nyxxxxxadm3
Trying 10.221.7.135...

***On Linux it just sits there forever.

H:\>telnet nyxxxxxadm3
Connecting To nyxxxxxadm3...Could not open a connection to host on port 23 : Conn
ect failed

******On windows it disconnects after a while.

Any clues why, and how it can be fixed on Linux so it times out??

thanks,
paul
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Unsuccesfull TCP session does not time out

You have no network connectivity.

On the console, look at the /var/log/messages file.

Check your network for a duplicate IP address. If found, change your linux configuration.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Paul Ambro
Occasional Advisor

Re: Unsuccesfull TCP session does not time out

I am not concerned about the network connectivity. The issue is why Linux does not times-out a TCP connection (e.g telnet) if it is not able establish a session. Windows sends me a message and returns to the prompt, Linux hangs until I have to manually intervene with crtl-C.
Jan Sladky
Trusted Contributor

Re: Unsuccesfull TCP session does not time out

Hi Paul,

I just tried telnet, ssh and ftp on nonexisting address and after cca 5 min got message Connection timed out
I know it isn't exactly same case, but you can try it also.

without developer's knowledge of TCP/IP stack and telnet aplication is hard to say, maybe you have longer timeout or some kind of philosophy on your Linux distro ;-)


Jan
GSM, Intelligent Networks, UNIX
Ermin Borovac
Honored Contributor

Re: Unsuccesfull TCP session does not time out

You can try setting tcp_syn_retries parameter to a lower value with

# echo 3 > /proc/sys/net/ipv4/tcp_syn_retries

Now telnet to unreachable host should take about 45 seconds.

If you want to make it permanent put an entry in /etc/sysctl.conf.
Paul Ambro
Occasional Advisor

Re: Unsuccesfull TCP session does not time out

Ermin,

You suggestion seems to solve the issue. I also found some documentation on Microsoft explaining the TCP stack differences and it mentions the retry limit.

Thanks for your help

pa