Results 1 to 9 of 9

Thread: Is there a way to check which ports are open?

  1. #1
    Join Date
    Apr 2007
    Beans
    513

    Is there a way to check which ports are open?

    I installed apache2 and then removed it (it would not work for me, and openSSH fits my needs better.), and I want to make sure port 80 or whatever it is, is closed again.

  2. #2
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Beans
    1,393
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Is there a way to check which ports are open?

    A port is only open if something is actually listening on it. If you apache was truly removed then there should be no problem.

    You can run the following if you wish:
    Code:
    sudo netstat -anltp|grep :80

    If by some chance apache were still listening you would see something like the following:
    Code:
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     10528/apache2

  3. #3
    Join Date
    Mar 2007
    Beans
    1,208
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Is there a way to check which ports are open?

    You could try the Shields Up utility on this site http://www.grc.com/intro.htm
    How To Use Ubuntu - Tips and guides for ubuntu
    How To Make A Band - Tips and ideas for anyone in a band

  4. #4
    Join Date
    May 2007
    Beans
    7,032
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Is there a way to check which ports are open?

    Monicker's trick above will tell you what ports are open on your machine. If you use a router or gateway, chances are that your network is even further locked down. To check, you can run the following commands:
    Code:
    sudo apt-get install nmap curl
    and then:
    Code:
    nmap -P0 $(curl www.whatismyip.org
    The second command may take several minutes to run, but will give you an accurate picture of which (if any) ports are open to the world outside your home network.
    I am aware of all internet traditions. | Getting the best help | Text formatting codes | My last.fm profile
    Should I PM support questions? NO!

  5. #5
    Join Date
    Apr 2007
    Beans
    513

    Re: Is there a way to check which ports are open?

    Quote Originally Posted by Monicker View Post
    A port is only open if something is actually listening on it. If you apache was truly removed then there should be no problem.

    You can run the following if you wish:
    Code:
    sudo netstat -anltp|grep :80

    If by some chance apache were still listening you would see something like the following:
    Code:
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     10528/apache2
    This is what I get. Is it OK?

    Code:
    tcp        0      0 100.100.1.100:4####     90.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     92.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     90.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     91.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     98.100.90.100:80        TIME_WAIT   -
    Edit: Yes I modified the numbers up there. Also, #### is a series of numbers.
    Last edited by patrickaupperle; May 12th, 2008 at 01:42 AM.

  6. #6
    Join Date
    Apr 2008
    Location
    Phoenix, AZ
    Beans
    1,393
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Is there a way to check which ports are open?

    Yes, you are fine. The only thing showing are outbound connections to the web site of these fourms. Nothing is listening to port 80 on your machine, and there are no established connections to port 80 on your machine.

    An external scan, as suggested by Tatty and p_quarles, is still a good thing to do once in a while, just to make sure there are no other exposed services that you might not be aware of.

  7. #7
    Join Date
    Jan 2007
    Beans
    1,010
    Distro
    Kubuntu Development Release

    Re: Is there a way to check which ports are open?

    Oh, that is an excellent idea. Though... I don't think one needs to install curl when wget is already available:

    Code:
    nmap -P0 $(wget -q http://www.whatismyip.org -O-)

  8. #8
    Join Date
    May 2007
    Beans
    7,032
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Is there a way to check which ports are open?

    Quote Originally Posted by patrickaupperle View Post
    This is what I get. Is it OK?

    Code:
    tcp        0      0 100.100.1.100:4####     90.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     92.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     90.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     91.100.90.100:80        TIME_WAIT   -               
    tcp        0      0 100.100.1.100:4####     98.100.90.100:80        TIME_WAIT   -
    Edit: Yes I modified the numbers up there. Also, #### is a series of numbers.
    That output shows that you are using a web browser to connect to Ubuntu Forums. Those are outbound connections. "Open ports" would be indicated by any connections which showed the computer's address in that fifth column.
    I am aware of all internet traditions. | Getting the best help | Text formatting codes | My last.fm profile
    Should I PM support questions? NO!

  9. #9
    Join Date
    Apr 2007
    Beans
    513

    Talking Re: Is there a way to check which ports are open?

    Quote Originally Posted by Monicker View Post
    Yes, you are fine. The only thing showing are outbound connections to the web site of these fourms. Nothing is listening to port 80 on your machine, and there are no established connections to port 80 on your machine.

    An external scan, as suggested by Tatty and p_quarles, is still a good thing to do once in a while, just to make sure there are no other exposed services that you might not be aware of.
    Thank you.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •