Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
  • My wireless is listening on 192.168.1.4
  • SSH is listening on 192.168.1.4:22
  • No firewall is running
  • TCP wrappers are not configured,
  • I can connect wirelessly to the Internet
  • My kernel logs show that I'm trying to connect from another host, but an nmap scan shows all ports are closed.

How do I get a port to open?

share|improve this question

migrated from serverfault.com Mar 20 '11 at 12:16

This question came from our site for professional system and network administrators.

    
When... What? It's kind of helpful if you finish the title. –  Wuffers Mar 20 '11 at 14:44
add comment

2 Answers 2

Do you have public IP address? Where do you run NMAP? It sounds like you are trying to use your local network IP from Internet. Effectively the computers aren't same network and cannot reach each other. Instead, you should use internet facing IP address.

Before checking if ports are open try to run ping command between hosts.

On source computer:

ping 192.168.1.4

If ping packets go through it is possible to form a connection between two computers.

Then you can also run netstat -l command on the host computer to see that SSH daemon really listens to port 22:

netstat -l
share|improve this answer
add comment

Your question isn't very clear, would you mind clarifying?

Unless a service is running on a port nmap wont show it as open. In Ubuntu as far as I know the default policy for iptables is ACCEPT, so if you start up a service running on X port it will be put through the firewall without any issues. So those ports arent really "closed" in the sense that they are blocked, its just that there is nothing there to listen for anything on them.

That being said If you want to explicitly open a port you can open it with iptables

iptables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -I INPUT -p udp --dport 53 -j ACCEPT

You can change the -p to a different protocol, and the --dport to a different port number. iptables has a whole bunch of other options that you can look into. The -j ACCEPT can be changed to DROP or REJECT if you want to block them.

share|improve this answer
add comment

Your Answer

 
discard

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