<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Checking if telnet works in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846383#M98970</link>
    <description>the answer is /etc/inetd.conf&lt;BR /&gt;&lt;BR /&gt;and there should be an entry like(not commented): &lt;BR /&gt;telnet       stream tcp6 nowait root /usr/lbin/telnetd  telnetd&lt;BR /&gt;&lt;BR /&gt;the master daemon inetd consults this file for many network services. do a more /etc/inetd.conf&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 21 Aug 2006 17:01:27 GMT</pubDate>
    <dc:creator>inventsekar_1</dc:creator>
    <dc:date>2006-08-21T17:01:27Z</dc:date>
    <item>
      <title>Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846375#M98962</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;I need to check if telnet works&lt;BR /&gt;&lt;BR /&gt;i.e.&lt;BR /&gt;&lt;BR /&gt;telnet box1   # this works and gives meaningful output &lt;BR /&gt;&lt;BR /&gt;telnet box2   # error, doesn't work, record different output&lt;BR /&gt;&lt;BR /&gt;Problem is, once I get into the telnet program, it's interactive, and I would like to do it with a script.&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Aug 2006 15:49:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846375#M98962</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2006-08-18T15:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846376#M98963</link>
      <description>Bear in mind there could many many reasons that telnet is not working: wrong hostname, unreachable, bad user name, bad passwd, no telnetd daemon listening, ...&lt;BR /&gt;&lt;BR /&gt;Probably the easist method would be to download and install the Perl module, Net::Telnet. You get all the error checking for free without having to slug through stderr yourself.&lt;BR /&gt;&lt;BR /&gt;Another approach would be to use expect but Net::Telnet is easier.&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Aug 2006 16:12:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846376#M98963</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-18T16:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846377#M98964</link>
      <description>download expect from &lt;A href="http://expect.nist.gov/" target="_blank"&gt;http://expect.nist.gov/&lt;/A&gt; and use it for automating telnet.</description>
      <pubDate>Fri, 18 Aug 2006 16:20:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846377#M98964</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-18T16:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846378#M98965</link>
      <description>Okay, I spent about 5 minutes throwing together a complete working Perl script, checktelnet.pl. All it really does is check to see if the telnet daemon is listening on a given host. It returns a zero status on success and non-zero on failure and prints any error messages on stdder --- just like a real UNIX command. It doesn't try to login so usernames and passwords are not checked although that could be easily added.&lt;BR /&gt;&lt;BR /&gt;Use it like this (and note that I am discarding stderr):&lt;BR /&gt;---------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset STAT -i STAT=0&lt;BR /&gt;typeset REMHOST="mickey"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;checktelnet.pl ${REMHOST} 2&amp;gt;/dev/null&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    echo "Ok"&lt;BR /&gt;  else&lt;BR /&gt;    echo "Cannot connect to ${REHHOST}; status ${STAT}"&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;-------------------------------&lt;BR /&gt;You can treat the Perl script as a blackbox since all you really want to know is telnetd running on a given host.&lt;BR /&gt;&lt;BR /&gt;You will probably need to install the Net::Telnet module. Get it from:&lt;BR /&gt;&lt;A href="http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm" target="_blank"&gt;http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;and the attached perl script, checktelnet.pl:&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Aug 2006 17:06:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846378#M98965</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-18T17:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846379#M98966</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;Here's one approach:&lt;BR /&gt;&lt;BR /&gt;# cat ./probe&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset HOST=${1} &lt;BR /&gt;telnet ${HOST} 21 |&amp;amp;&lt;BR /&gt;sleep 3&lt;BR /&gt;read  -p REPLY&lt;BR /&gt;read  -p REPLY&lt;BR /&gt;print -p quit&lt;BR /&gt;ACTION=`echo ${REPLY}|cut -d" " -f1`&lt;BR /&gt;if [ "${ACTION}" != "Connected" ]; then&lt;BR /&gt;    echo "${HOST} FAILED to connect"&lt;BR /&gt;else&lt;BR /&gt;    echo "${HOST} reponded_ok!"&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;...Run as:&lt;BR /&gt;&lt;BR /&gt;# ./probe somehostname&lt;BR /&gt;&lt;BR /&gt;...OR: Add a driver loop to query multiples hosts.  A simple file of hostnames (or IP addresses) serves as input in that case.&lt;BR /&gt;&lt;BR /&gt;...The exact message(s) returned may vary.&lt;BR /&gt;&lt;BR /&gt;...for a good, working host:&lt;BR /&gt;&lt;BR /&gt;# ./probe goodhost&lt;BR /&gt;Connection closed by foreign host.&lt;BR /&gt;goodhost reponded_ok!&lt;BR /&gt;&lt;BR /&gt;...for a non-working host:&lt;BR /&gt;&lt;BR /&gt;# ./probe badhost&lt;BR /&gt;telnet: connect: A remote host refused an attempted connect operation.&lt;BR /&gt;./probe[7]: print: 0403-039 No query process for pipe.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 18 Aug 2006 17:08:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846379#M98966</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-08-18T17:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846380#M98967</link>
      <description>Thanks for the ideas. The problem is complicated by the fact that I am telneting to remote console servers and checking which ports are active and which aren't. So the first time I am login in to the console server, which doesn't mean anything. The second time I should get a prompt for the actual console of the machine. It's this 2nd time that I am interested in. &lt;BR /&gt;&lt;BR /&gt;There doesn't appear to be an easy way of scripting this, short of using expect. I got expect installed and am contemplating scripting it, but from my experience with it, it's very tedious (much more than Perl or ksh) and you have to take care of all input possibilities to make the right decision in the 'if' statements.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Aug 2006 13:21:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846380#M98967</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2006-08-21T13:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846381#M98968</link>
      <description>Shalom etc,&lt;BR /&gt;&lt;BR /&gt;Could be that telnet or inetd is nor running on the second box.&lt;BR /&gt;&lt;BR /&gt;Some consoles don't accept telnet at all. The new ilo consoles I'm receiving now only work with ssh.&lt;BR /&gt;&lt;BR /&gt;If you have physical access to the second box:&lt;BR /&gt;&lt;BR /&gt;Make sure telnetd is enabled in inetd.conf&lt;BR /&gt;make sure inetd itself is running&lt;BR /&gt;&lt;BR /&gt;tail -f /var/adm/syslog/syslog.log&lt;BR /&gt;&lt;BR /&gt;Try your telnet, then try ssh.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 21 Aug 2006 13:31:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846381#M98968</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-08-21T13:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846382#M98969</link>
      <description>I will keep in mind the suggestion about inetd &lt;BR /&gt;&lt;BR /&gt;Are you sure you can ssh to a remote console server? I've never seen it done, and every time I tried, it has failed while telnet always worked. I've always assumed it was a built-in feature. If this is configurable, where does it get set?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Aug 2006 14:05:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846382#M98969</guid>
      <dc:creator>dictum9</dc:creator>
      <dc:date>2006-08-21T14:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846383#M98970</link>
      <description>the answer is /etc/inetd.conf&lt;BR /&gt;&lt;BR /&gt;and there should be an entry like(not commented): &lt;BR /&gt;telnet       stream tcp6 nowait root /usr/lbin/telnetd  telnetd&lt;BR /&gt;&lt;BR /&gt;the master daemon inetd consults this file for many network services. do a more /etc/inetd.conf&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Aug 2006 17:01:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846383#M98970</guid>
      <dc:creator>inventsekar_1</dc:creator>
      <dc:date>2006-08-21T17:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846384#M98971</link>
      <description>Suggest you run autoexpect. This utility starts a script and records all the commands that are typed by the user into a file "script.exp". After you are done telnet'ing into eachj of the remote server's GSP you can exit out of the script and examine it contents. It will have all that you need in order to automate the process of checking the LAN console of each of the remote GSP's.&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
      <pubDate>Tue, 22 Aug 2006 00:11:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846384#M98971</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-22T00:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846385#M98972</link>
      <description>&lt;BR /&gt;Do something like:&lt;BR /&gt;&lt;BR /&gt;echo ^C\n |telnet box2 |grep Connected &lt;BR /&gt;&lt;BR /&gt;That will remove the interactive part...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 22 Aug 2006 09:19:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846385#M98972</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-08-22T09:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if telnet works</title>
      <link>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846386#M98973</link>
      <description>I was able to write a perl script to do a similar task using Net::Telnet as suggested by ACS above.  &lt;BR /&gt;&lt;BR /&gt;Here's a command line just like GW's that makes more sense to me.  (Probably just fooling myself)&lt;BR /&gt;&lt;BR /&gt;# sh&lt;BR /&gt;# #working&lt;BR /&gt;# echo ^] | telnet hueco | grep Connected&lt;BR /&gt;Connected to hueco.rsn.hp.com.&lt;BR /&gt;&lt;BR /&gt;# #bad hostname&lt;BR /&gt;# echo ^] | telnet nothing | grep Connected&lt;BR /&gt;nothing: Unknown host&lt;BR /&gt;&lt;BR /&gt;# #machine not booted&lt;BR /&gt;# #takes a while to timeout!&lt;BR /&gt;# echo ^] | telnet svvp12 | grep Connected&lt;BR /&gt;telnet: Unable to connect to remote host: Connection timed out&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The trick here is how to send the ctrl-].  Use this key sequence: ctrl-v ctrl-].&lt;BR /&gt;You can use ctrl-v and then any other ctrl sequence to get that exact sequence.&lt;BR /&gt;&lt;BR /&gt;Note that cut-n-paste from this forum will NOT grab the ctrl-C or ctrl-]!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:29:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/checking-if-telnet-works/m-p/3846386#M98973</guid>
      <dc:creator>Kalim  Jacobs</dc:creator>
      <dc:date>2006-10-11T13:29:40Z</dc:date>
    </item>
  </channel>
</rss>

