å¨Linuxä¸telnetåncè¿ä¸¤ä¸ªå½ä»¤é½æ¯æ¯ç¨æ¥æµè¯ç«¯å£è¿éæ§ãå
¶ä¸telnetå¯ä»¥æµè¯tcp端å£çè¿éæ§ãncå¯ä»¥æµè¯tcpåudp端å£çè¿éæ§ã
å
·ä½ä½¿ç¨æ¹æ³å¦ä¸ï¼
1ãç¡®ä¿linuxæºå¨ä¸å·²ç»å®è£
äºncæè
telnetå½ä»¤ï¼å¦æ没æéè¿yumå®è£
# yum install nc
# yum install telnet
2ãtelnetå½ä»¤ç使ç¨ï¼
è¯æ³ï¼telnet <hostname/IP address> <port number>
ä¾åï¼
æµè¯éè¿åä¼æ¾ç¤ºä¸é¢çæåï¼
# telnet 192.118.20.95 22
Trying 192.118.20.95...
Connected to 192.118.20.95.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
Protocol mismatch.
Connection closed by foreign host.
æµè¯ä¸éè¿ï¼
# telnet 192.118.20.95 22
Trying 192.118.20.95...
telnet: connect to address 192.118.20.95: No route to host
3ãncæµè¯TCP端å£çè¿éæ§
è¯æ³ï¼nc -z -v <hostname/IP address> <port number>
æµè¯éè¿ï¼
# nc -z -v 192.118.20.95 22
Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!
æµè¯ä¸éè¿ï¼
# nc -z -v 192.118.20.95 22
nc: connect to 192.118.20.95 port 22 (tcp) failed: No route to host
4ãncæµè¯UDP端å£çè¿éæ§
è¯æ³ï¼nc -z -v -u <hostname/IP address> <port number>
æµè¯éè¿ï¼
# nc -z -v -u 192.118.20.95 123
Connection to 192.118.20.95 123 port [udp/ntp] succeeded!