Telnet command to configure an extern server - telnet

I need to telnet a remote server on a different network
When i am at the network I can use the command "telnet 192.168.0.1 25" in commandprompt.
Is it possible to do the same at an extern network?
The WAN IP of that server is 81.82.X.X:3389 but because I need a port to get the correct server I can't fill in the port 25 anymore...
PS: Yes I know telnet is an old protocol but I still need to use it

Related

How to send SQL queries to a computer outside of the network through port?

I have a java program that uses SQL queries. The goal is to send them from my home PC to a workstation on a different network elsewhere.
The SQL server is on Windows Server and I opened port 1433 for inbound connections. From that computer, I can successfully ping the port. However, I can't ping the port from the public ip address, only the local (192.168...), so it doesn't work if I were to try to ping it from my home computer.
Is there a way that I can ping it from my home computer? If so, how would I specify the address for JDBC?
Thanks!
It sounds like your Windows Server is behind an internet gateway/router. You need to configure the gateway to allow and forward inbound connections to TCP port 1433 to the IP of the computer that has SQL Server installed.
Here are some guides that explain how to enable port forwarding on different devices:
How to Forward Ports on Your Router (lifewire.com)
How to Port Forward (No-IP.com)
Also, note that we can ping IP addresses, not ports.

Telnet to a port that is already in use

I'm trying to use telnet to check if the port of an application is open.
But i'm receiving the following error:
Connecting To 192.168.1.10...Could not open connection to the host, on port 3001: Connect failed
I assume the port is closed, but is it also possible the port is being in use by another program? Hence why i'm not able to test using telnet?
Now if this is the case, how come some ports allow simultaneous connections from clients and some don't?
All ports allow simultaneous connections from clients when some program is listing on that port. Connect failed means that the port is not listening or a firewall interfered.
You can find out if that port is open by using netstat or on Windows tcpview.

Is it possible to change the incoming, but not outgoing SSH port in OS X Yosemite?

I SSH into my workstation, which is a mac running OS X Yosemite, daily. Unfortunately, I noticed a while back that enabling remote login into my machine has put it under the fire of many automated dictionary attacks trying to log in using the default port, 22.
To make my machine more secure, I changed the SSH port. To do so, I edited the /etc/services file, and changed the following two lines:
ssh 2123/udp # SSH Remote Login Protocol
ssh 2123/tcp # SSH Remote Login Protocol
That greatly reduced the number of dictionary attacks, but now when I try to SSH from my workstation to other machines, I always need to specify the port (which is usually port 22).
This is easy enough for most simple tasks, just specify the port when SSHing in:
ssh -p22 me#another.computer.com
It becomes a pain for more complicated tasks where specifying the port is not an option, but it can still be done by adding an entry in ~/.ssh/config:
Host github.com
Hostname ssh.github.com
Port 443
Between these two options, I could always connect to any machine I wanted to connect to. However, I'm now writing a script that will connect to machines that will have different IP addresses (and domain names), and there is no optional argument to specify the port number.
I have also been getting frustrated that it does not default to port 22 for outgoing connections, but I do not want to change my incoming port back to 22.
Is it possible to change the incoming SSH port, but still have the default outgoing SSH port? That is, can I only allow people to login to my workstation using port 2123, but when I try connecting to other machines, the default port it tries to use is port 22?
I'm running OS X 10.10.2 Yosemite.
Change the ssh port back in `/etc/services' - that sets the defined port for the ssh protocol.
Then change the port that sshd listens on. On OS-X this is more complicated than it need be. See https://serverfault.com/questions/18761/how-to-change-sshd-port-on-mac-os-x

Able to connect to ssh server on any port using an ssh tunnel

I'm having a little problem with the ssh server running on an ubuntu server. I'm using key-pair authentication, and i'm able to connect just fine, but the problem is that i can connect on any port (using a tunnel), even though "Port 22" is defined in sshd_config. Why am i able to connect on any port? How can i stop ssh from listening to ports other than port 22?
In your screenshot Local Address column tells that you are listening on all interfaces at port 22 (e.g. 0.0.0.0:22). The Foreign Address column tells that anyone can connect from any ip from any port (e.g 0.0.0.0:*). And below the same for IPV6.
The connections are normally started from some random free high number port so it's ok to have wildcard in Foreign address. The only thing you care about is that there is a listener at local port 22. Just as you wanted.
You are connecting the port 22 first (as you don't specify anything else with -p switch) and then ssh directs data from port 54321 of one machine to 80 of the other. So, the path of the data is something like:
Machine A, port 54321 -> Machine A, port random -> Machine B, port 22, Machine B, port 80.
So the thing is, when not defined, it will connect to the ssh server on the default port 22. you can explicitly define the port using "-p xxxx" where xxxx is the ssh server port you want to connect to. When tunneling, the "local port" is the port on your computer you will connect to, and "remote port" is the port on the remote computer that the connection will end on. so its like this:
(localport->randomport)->->->->(sshport->remoteport)
sshport is defined by -p, and the default when not defined is port 22

Telnet - why I can connect despite shortage telnet server

On Linux, when I connect from telnet from one server (client telnet) to another (there isn't telnet server) I can connect on port, which I specify (not default for telnet 23 port). I get:
Connected to myserver (ip adress).
Escape character is '^]'.
Why, despite I haven't telnet server, I can connect with telnet client?
You can telnet to any opening TCP port, because that only means a normal TCP connection initiation work has done.
And your input will be treated as raw data, what happens to the data depends on the program which opened that TCP port, normally as soon as it determined the client side is not sending correct data it will disconnect.