linux command

telnet

Linux Command – telnet เป็นโปรโตรคอลเชื่อมต่อสื่อสารด้วยข้อมูลตัวอักษร

 

คำสั่ง

telnet <IP/Domain> <Port>

root$root telnet localhost 22
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1

root@root:~$ telnet google.com 80
Trying 216.58.196.206…
Connected to google.com.
Escape character is ‘^]’.

 

โครงสร้างคำสั่ง

 telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]

 

รายละเอียด

โปรโตรคอลเชื่อมต่อสื่อสารด้วยข้อมูลตัวอักษร นิยมใช้กันบน internet หรือ network ภายใน สามารถสื่อสารได้ทั้ง 2 ทางด้วยตัวอักษร โดยการสร้างหน้าจอ terminal ขึ้นมา และสือสารด้วยข้อมูล 8bit ผ่านทาง TCP/IP เราสามารถใช้คำสั่ง telnet เพื่อสร้าง connection ไปยัง IP และ Port ของปลายทางที่กำหนดได้ ซึ่งการเชื่อมต่อจะสำเร็จได้ถ้า network routing สามารถไปถึงปลายทาง และ เครื่องปลายทางมีการเปิด port ที่กำหนดเป็น สถานะ LISTEN รอไว้ ส่วนมากเราใช้ telnet สำหรับการตรวจสอบแก้ปัญหาการใช้งานของ service อื่นๆเช่น SMTP, IRC, HTTP, FTP หรือ POP3 เพื่อตรวจสอบว่า routing และ port ที่เครื่องปลายทางยังทำงานได้ปกติ

 

Option

 -4 Force IPv4 address resolution.

 -6 Force IPv6 address resolution.

 -8 Request 8-bit operation. This causes an attempt to negotiate the TELNET BINARY option for both input and output. By default telnet is not 8-bit clean.

 -E Disables the escape character functionality; that is, sets the escape character to ``no character''.

 -L Specifies an 8-bit data path on output. This causes the TELNET BINARY option to be negotiated on just output.

 -a Attempt automatic login. Currently, this sends the user name via the USER variable of the NEW-ENVIRON option if supported by the remote system. The username is retrieved via
 getlogin(3).

 -b address
 Use bind(2) on the local socket to bind it to a specific local address.

 -d Sets the initial value of the debug toggle to TRUE.

 -r Emulate rlogin(1). In this mode, the default escape character is a tilde. Also, the interpretation of the escape character is changed: an escape character followed by a dot
 causes telnet to disconnect from the remote host. A ^Z instead of a dot suspends telnet, and a ^] (the default telnet escape character) generates a normal telnet prompt.
 These codes are accepted only at the beginning of a line.

 -S tos Sets the IP type-of-service (TOS) option for the telnet connection to the value tos.

 -e escapechar
 Sets the escape character to escapechar. If no character is supplied, no escape character will be used. Entering the escape character while connected causes telnet to drop
 to command mode.

 -l user
 Specify user as the user to log in as on the remote system. This is accomplished by sending the specified name as the USER environment variable, so it requires that the
 remote system support the TELNET NEW-ENVIRON option. This option implies the -a option, and may also be used with the open command.

 -n tracefile
 Opens tracefile for recording trace information. See the set tracefile command below.

 host Specifies a host to contact over the network.

 port Specifies a port number or service name to contact. If not specified, the telnet port (23) is used.

 Protocol:

 Once a connection has been opened, telnet will attempt to enable the TELNET LINEMODE option. If this fails, then telnet will revert to one of two input modes: either “character at a
 time” or “old line by line” depending on what the remote system supports.

 When LINEMODE is enabled, character processing is done on the local system, under the control of the remote system. When input editing or character echoing is to be disabled, the
 remote system will relay that information. The remote system will also relay changes to any special characters that happen on the remote system, so that they can take effect on the
 local system.

 In “character at a time” mode, most text typed is immediately sent to the remote host for processing.

 In “old line by line” mode, all text is echoed locally, and (normally) only completed lines are sent to the remote host. The “local echo character” (initially “^E”) may be used to
 turn off and on the local echo (this would mostly be used to enter passwords without the password being echoed).

 If the LINEMODE option is enabled, or if the localchars toggle is TRUE (the default for “old line by line“; see below), the user's quit, intr, and flush characters are trapped
 locally, and sent as TELNET protocol sequences to the remote side. If LINEMODE has ever been enabled, then the user's susp and eof are also sent as TELNET protocol sequences, and
 quit is sent as a TELNET ABORT instead of BREAK There are options (see toggle autoflush and toggle autosynch below) which cause this action to flush subsequent output to the terminal
 (until the remote host acknowledges the TELNET sequence) and flush previous terminal input (in the case of quit and intr).

 

กลุ่มคำสั่ง

ssh, scp, rcp

 

Reference:

คำสั่ง Unix – Linux Command

Linux, Unix

 

Author: Suphakit Annoppornchai

Credit: https://saixiii.com

2 Thoughts to “telnet – Linux Command คำสั่งโปรโตรคอลเชื่อมต่อสื่อสารด้วยข้อมูลตัวอักษร”

  1. […] telnet, scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-argv0(1), ssh-keygen(1), ssh-keyscan(1), tun(4), ssh_config(5), ssh-keysign(8), sshd(8) […]

Leave a Reply