Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im trying to open a Port(2012) on my VPS so i can access it over the internet.

This is the output of sudo iptables -L produces

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
fail2ban-ssh  tcp  --  anywhere          anywhere             multiport dports ssh
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             loopback/8     reject-with icmp-port-      
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED  
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:2012
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
ACCEPT     icmp --  anywhere             anywhere            
LOG        all  --  anywhere             anywhere             limit: avg 5/min burst 5    LOG    level debug prefix "iptables denied: "
DROP       all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere  

Nmap discovers just ports 25,22 and 80. Please what might i be doing wrong?

Edit :

netstat -anp | grep :2012 show this :

sudo netstat -anp | grep :2012
tcp        0      0 127.0.0.1:2012          0.0.0.0:*               LISTEN      15303/X-engine
share|improve this question
1  
Are you sure service listening on port 2012 is started ? provide netstat -anp | grep :2012 –  krisFR Aug 22 at 22:34
    
show iptables-save -c , lsof -i :2012 and netstat -tan output –  val0x00ff Aug 22 at 22:46
    
@val0x00ff these are the outputs - pastebin.com/WXgabCEL –  dev Aug 22 at 22:54
    
@krisFR this is the output - pastebin.com/qNzgcee6 –  dev Aug 22 at 22:56
    
@dev Line 37 and 44 are the same. Then on line 38 you've fail2-ban which will do nothing if your sshd runs on port 2012 Then, where is the output of lsof -i :2012. Also Can you show the output of grep -E '(^Port|[^#]ListenAddress)' /etc/ssh/sshd_config And as KrisFR is suggesting, sshd is running on the loopback address which is not routable. You've probably set ListenAddress in sshd_config –  val0x00ff Aug 22 at 23:01

2 Answers 2

up vote 2 down vote accepted

Your service listening on port 2012 is only listening on localhost (127.0.0.1).

This is not routable.

Make it listen on server's IPV4 (or IPV6).

share|improve this answer
    
Thank You so Much. Working now! –  dev Aug 22 at 23:08

By default nmap probes only the 1000 most often used ports. If you want to scan a specific port, use nmap like this:

nmap ... -p2012 ...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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