I'm trying to test whether machine A can connect to machine B on certain ports. The sysadmins of machine A have seen fit to remove the
telnet command. What would be a convenient replacement? Machine A is CentOS.
iirc, telnet isn't installed by default on centos 6 machines anymore. if you don't have tools like
nc available you can always talk to a network socket using python. (not sure if this fits your "convenient" requirement though... )
to simply test if the connection can be established:
[gryphius@ut ~]$ python Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> conn=socket.create_connection(('gmail-smtp-in.l.google.com',25))
If that didn't throw an error so far the connection is ok. If you also want to test receiving/sending data, you could continue like this:
>>> input=conn.makefile() >>> print input.readline() 220 mx.google.com ESMTP p2si6911139eeg.7 - gsmtp >>> conn.sendall('HELO example.com\r\n') >>> print input.readline() 250 mx.google.com at your service >>> conn.sendall('QUIT') >>> conn.close() >>>
Any of: nc (netcat), nmap, hping.