LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-20-2012, 02:39 PM   #1
HogFather
LQ Newbie
 
Registered: Feb 2012
Distribution: Slackware 14
Posts: 7

Rep: Reputation: Disabled
ssh stopped accepting connections after port change


Hello all,

I have the following issue - after i changed my port of ssh to 2222, it stopped accepting connections from the outside world
Before that it was OK on port 22, but i'm recieving a lot of brute force attacks, so i decide to minimize the automatic attacks by changing the port. Now i can ssh only from my internal network. Here is some info:

Server Slackware 13.37
running L.A.M.P.; Nagios, ftp, ssh, simple firewall(currently stopped)
The server is then connected to a router and has a firewall with masquarade

sshd_config:
Code:
Port 2222
#AddressFamily any  
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2
netstat:
Code:
netstat -ntlp | grep 2222
tcp        0      0 0.0.0.0:2222            0.0.0.0:*               LISTEN      1592/sshd           
tcp        0      0 :::2222                 :::*                    LISTEN      1592/sshd
firewall-stat:
Code:
Chain POSTROUTING (policy ACCEPT 36 packets, 3413 bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1    16358 1200K MASQUERADE  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0 

iptables.filter:
Chain INPUT (policy ACCEPT 20855 packets, 2090K bytes)
num   pkts bytes target     prot opt in     out     source               destination         
1       15  1083 fail2ban-BadBots  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           multiport dports 80,443 
2      228 16770 fail2ban-SSH  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:2222
nmap:
Code:
Nmap scan report for MyServer (ip-of-server)
Host is up.
PORT     STATE    SERVICE
2222/tcp filtered EtherNet/IP-1
I tried banner grabbing with telnet, but i didn't get results (i guess because it's filtered )

i know i'm missing something, just don't see what is it

Any help is appreciated.
regards
 
Old 12-21-2012, 03:11 AM   #2
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
Just a guess, but what about the router ? Maybe you need a NAT rule for port 2222 for it ?
 
Old 12-21-2012, 03:48 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Is the router connected to only the server (or routes all internet traffic to the server)? Or does it forward port 2222 traffic to the server? Is port 2222 open on the router?

Quote:
The server is then connected to a router and has a firewall with masquarade
Which has the firewall you are describing, the server or the router? I read it as the server.

It appears that Internet traffic is handled the same as LAN traffic. Since ssh on port 2222 works from LAN hosts, I suspect that Internet traffic on port 2222 isn't reaching the server.

So my advice is the same as heinblod's, but I wanted to add that a default ACCEPT policy for the INPUT chain isn't a good idea.

Last edited by jschiwal; 12-21-2012 at 04:28 AM.
 
Old 12-21-2012, 04:02 AM   #4
HogFather
LQ Newbie
 
Registered: Feb 2012
Distribution: Slackware 14
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jschiwal View Post
Is the router connected to only the server or do you forward port 2222 traffic to the server? Is port 2222 open on the router?
The rouoter is after the server. So when i ssh, i ssh directly to the server. I have a laptob that is connected to router and i have no trouble connecting to the server from the internal network.
I could change the connection setting and put the router in fron of the network, but it's an old router and i prefer the server to be the firs
 
Old 12-21-2012, 05:38 AM   #5
HogFather
LQ Newbie
 
Registered: Feb 2012
Distribution: Slackware 14
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi guys,

Turns out the the office network was filtering the non-standart ports. I tried from different network and it works
I guess i had to do some putty tunneling now

Thanks and sorry for wasting your time

Happy Holidays
 
  


Reply



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
SSH is still listening on port 22 after change to a new port? boyla Linux - Server 6 04-08-2011 12:26 AM
SSH Server Accepting Connections, and then Dropping Them RazielX SUSE / openSUSE 3 10-26-2010 04:21 AM
ssh port forwarding as a proxy server: how to be aware of the current connections Gozer404 Linux - Security 2 07-15-2009 11:22 AM
[SOLVED] Change the prompt during ssh connections. angel115 Linux - Newbie 2 09-26-2005 04:02 AM
port 110 isn't accepting connections member57 Linux - Networking 8 07-23-2003 09:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:49 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
Open Source Consulting | Domain Registration