LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 03-02-2006, 09:59 PM   #1
jcrowley
LQ Newbie
 
Registered: Mar 2006
Posts: 17

Rep: Reputation: 0
Get 'connection was forcibly closed'


Have a Red Hat 9 server.

Am trying to connect to the server from a Windows 2000 machine (for a couple of different applications).

Telnet is running on the server (I can self-connect to telnet on the server). If I try to connect from the Win box, I always get a "An existing connection was forcibly closed by the remote host" message.

Wrote a simple TestPort routine in the Win box -- feed it an IP address and list of ports and it will try to open a socket connection to each port.

Every port returns the same error as above (usually after about a 30 second delay).

On the Linux box netstat shows listeners active for all the ports.

Both machines are on the same sub-net, and I'm using IP addresses instead of names, so not going through any DNS. Both machines can ping each other.

I'm a newbie to Linux, and suspect it's some type of authorization issue, but have been trolling the Web all day without coming up with an answer. Appreciate any help.

Thanks.
 
Old 03-02-2006, 10:11 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
If you get that for all ports, it may be a firewall on the Linux box. Have you used nmap from http://www.insecure.org/nmap/ before? There is a Windows version so you can scan the Linux box from Windows and see what ports are open.

One the Linux box, have a look in /etc/init.d for a file called iptables (or firewall, or something like that). Try, as root, running service iptables stop and then run nmap again (or just try and telnet to the box).

It may be that telnet is disabled - it's not the best choice for remote access. Have you tried ssh?
 
Old 03-02-2006, 10:12 PM   #3
jcrowley
LQ Newbie
 
Registered: Mar 2006
Posts: 17

Original Poster
Rep: Reputation: 0
May have solved this -- turned off the firewall.

Of course, in normal practice I want a firewall enabled, so what do I have to configure to let these ports through?
 
Old 03-02-2006, 10:40 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
The standard telnet port is 23 and the standard ssh port is 22. If you're using iptables, you can use something like:
For telnet
Code:
iptables -t filter -A INPUT  -p TCP --dport 23 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -t filter -A OUTPUT -p TCP --sport 23 -m state --state ESTABLISHED -j ACCEPT
For SSH
Code:
iptables -t filter -A INPUT  -p TCP --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -t filter -A OUTPUT -p TCP --sport 22 -m state --state ESTABLISHED -j ACCEPT
That can be refined to only allow new connections with SYN set, or only connections from certain IPs, etc. Also, if you have more than one network card in the box, you should specify the interface.
 
Old 03-03-2006, 07:14 AM   #5
jcrowley
LQ Newbie
 
Registered: Mar 2006
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks

Stopping the firewall did the trick.

Thanks for the help and the link to NMAP.
John
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
checking if a connection is closed using select(); Thinking Programming 7 12-13-2005 04:19 PM
how do i know if the connection is closed using a nonblocking socket? Thinking Programming 2 10-06-2005 09:53 AM
ssh connection closed by server m_yates Linux - Security 3 08-10-2005 04:12 PM
Proftpd - 421 connection closed toddism Linux - Software 0 11-24-2004 05:08 PM
Pop3 connection closed Madrinator Linux - Networking 3 09-29-2003 12:47 PM


All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration