开发者_运维百科
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this questionWith that command what does really happen?
telnet somehost 25
Does it mean that I create a connection between my host and somehost on port 23 with telnet and that telnet of somehost forward it after to the port 25?
thank your for your help!
cheers
Daniel
There's no port forwarding in your example. Your example simply means to make a telnet connection to port 25 of somehost
. What happens then depends on what's listening on port 25 of that machine; it could theoretically be running a server that would forward the connection to some other machine, but that is separate from the actual telnet connection. Telnet itself does not have any port forwarding features. If you want that, use ssh instead. (Actually, use ssh anyway, as telnet is not secure.)
No port forwarding but direct connection to the mentioned port.
And especially if you specify the port with telnet explicitly, telnet
does not use its own telnet protocol it uses when talking to a telnetd.
So you are connecting directly to port 25 (probably a SMTP server because thats the well known port for it) on somehost.
This can be very usefull to test ASCII based protocols like for example SMTP.
telnet somehost 25
just means that you are opening a connection from your local machine to somehost on port 25. See the "[host-name [port]]" in the usage output below.
Try looking at your local telnet man page or built in help for the telnet command. On my system, the builting help is displayed when you enter invalid params (which --help happens to be):
$ telnet --help
telnet: illegal option -- -
usage: telnet [-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-c] [-d]
[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] [-r] [-s src_addr]
[-u] [-P policy] [host-name [port]]
You can also run telnet
with no arguments and type ? or help.
Neither the telnet protocol, nor the implementations (Linux, Windows, etc) support port forwarding. There are two possible answers to your question.
1) Generally when people refer to port forwarding these days they mean ssh port forwarding. ssh supports forwarding either direction (e.g. when someone telnets to your local machine, redirect them to a remote machine, or when someone telnets to a remote machine, redirect them to a local machine.) There are lots of examples on the internet on setting up ssh port forwarding, but note that if you want to forward port 23, a privileged port, you will need to be root.
2) You can telnet from host A to host B, then telnet from B to C. This is not strictly port forwarding, but accomplishes the same task
精彩评论