Using telnet to Connect to the Serial Port of an ESXi 6.7 VM
Some virtual machines like router/firewall appliances can be configured with telnet by connecting to the serial port of the VM. This post will demonstrate how to connect to the Serial Port of a Juniper VCP appliance running on ESXi 6.7.
Sometimes you can’t use SSH to connect to an appliance because the management network needs to be configured first. Typing lots of commands at the console is a pain, and so in the following steps we’ll demonstrate how telnet can be used to connect to a Juniper appliance.
Step 1: Enable Firewall Rule
The first thing we need to do is edit the ESXi firewall rules so that the serial port of a VM can be accessed over the ESXi management network.
Login to the web management interface of the ESXi 6.7 host then do the following steps.
- Click Networking.
- Click the Firewall rules tab.
- Scroll down, and right click on VM serial port connected over network.
- Click Enable.
Step 2: Edit Virtual Machine
Next we will edit the virtual hardware of a VM that we want to enable telnet communications on. The following example shows how to enable the serial port on a Juniper VCP virtual machine.
Right click on the powered off VM then click Edit settings.
Click Add other device then Serial port.
Select Use network in the dropdown menu of the new serial port.
For the port URI enter
telnet://:8602, then click Save.
Power on the VM and wait for it for it to finish booting.
Step 3: Test telnet connection
Open up a Terminal/Command prompt then run the following command.
telnet 10.1.1.11 8602
If the virtual machine is configured to allow telnet over the serial port, you should now be connected to the VM. The output below shows the result of the command when connecting to the Juniper VCP appliance.
$ telnet 10.1.1.11 8602 Trying 10.1.1.11... Connected to 10.1.1.11. Escape character is '^]'. login: root Last login: Tue Dec 10 22:29:08 on ttyu0 --- JUNOS 18.1R3.3 Kernel 64-bit JNPR-11.0-20180816.8630ec5_buil root@:~ #
As you can see, we’re logged into the appliance and ready to issue commands.
In this tutorial, we configured the ESXi 6.7 firewall to allow the serial port of a VM to be accessed over the network. We added a serial port to a virtual machine and configured it so that telnet can connect to it. We finished by demonstrating telnet working on a Juniper VCP appliance.