1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Test if port open on IP address.

Discussion in 'Tomato Firmware' started by Overflow-ar, Aug 13, 2007.

  1. Overflow-ar

    Overflow-ar LI Guru Member

    Is there any way I can test if a port is open on some IP address? I've tried doing a "telnet port" but as telnet requires user to press enter and so on. I'm stuck :S

    The port is used by PcAnywhere (port 5631) on other machine that is NOT connected to my router.

    I need this, as I'm trying to place an script on the router to light DMZ when PcAnywhere is running on my father's home. :biggrin:
  2. yaqui

    yaqui LI Guru Member

    Place your commands in a script and make it executable.

    Something like this :
    portclosed=$(telnet <address here> <port # here> | grep refused)
    portopen=$(telnet <address here> <port # here> | grep <some string matching output of open port>)
    if [ -n "$portclosed" ] ; then 
       echo <or logger> port is closed
       elif [ -n "$portopen" ] ; then
            echo <or logger> port is open and reachable
            some command for starting dmz ( service dmz start ??)   

Share This Page