0
  • 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?

1
  • When... What? It's kind of helpful if you finish the title.
    – Wuffers
    Commented Mar 20, 2011 at 14:44

2 Answers 2

1

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
0

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.

You must log in to answer this question.