telnet doesn't work between two VM in the same virtual network Azure

7.1k Views Asked by At

I have à new account in azure (it's my first time) for test i have two VMs with ip adress 10.0.0.4/5

the ping is ok between the two VM but the telnet don't works

when i do from vm 1

telnet 10.0.0.5

Trying 10.0.0.5...
telnet: Unable to connect to remote host: Connection refused

it works just with port 22 but it don't with other port

i start from scratch and i created a security group but i can't create a network interface in the Azure UI because it not finds my virtual network and my security group knowing i have a one virtual network and one security network. some thing is wrong and i don't know what

can you help me how can i open the connection between my VMs

4

There are 4 best solutions below

5
On BEST ANSWER

For a Linux VM, telnet service is not installed by default. According to your error log, it seems that the telnet service is not installed. You should install the service firstly. I install telnet service in my Ubuntu VM.

Please refer to the article.

Notes: if /etc/inetd.conf /etc/xinetd.d/telnet not exist, you could create these files manual.

You could use the following command to ensue whether the port is listening.

netstat -ant|grep 23

Based on my knowledge, if you want to telnet by using private IP in the same VNet, you could not open port in Azure NSG. However, if you want to telnet by using Public IP, you should configure NSG (Inbound rule). Please refer to the article.

0
On

If you're rocking a telnet server on 10.0.0.5 then make sure you are allowing inbound port 23/TCP in the Network Security Group (NSG) attached to the network interface. By default, for Linux VMs only 22/TCP (SSH) is wide open.

More on NSGs here: https://learn.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-nsg-quickstart-portal

Infrastructure questions are best asked on ServerFault.

0
On

Since port 22/TCP (SSH) is open, I'd suggest simply using ssh instead of telnet.

try to connect to the other machine using "ssh", assuming that the username on both VMs is the same, the following command should work:

ssh 10.0.0.5

You'll be prompt for password, and you'll need to enter the password of your user on that VM

In general you can use ssh in the following form:

ssh [email protected]

some links for more info: https://support.suso.com/supki/SSH_Tutorial_for_Linux

0
On

First things first, Install "Telnet Server and Clients" in VM's

Then you need to create the "Network Security Group" or edit the existing group and add "Inbound Security Rules" as per your need by adding ports to allow connection with VM.

Later try these steps(Something is better than nothing..Right!!?),

*Search for system "services" and enable/start "Telnet" service.

*Turn OFF firewall and check Telnetting between the VM's

*Start RPC using Private ip / Localhost ip -- (10.0.0.5 port)