Telnet is a network protocol that enables communication with remote devices; however, issues can arise when trying to use it from a Hyper-V virtual machine running Ubuntu on Windows Server 2012 R2. This guide will walk you through the steps necessary to resolve the inability to telnet from your Ubuntu VM. By following these instructions, you will ensure proper configuration of network settings, firewall rules, and other troubleshooting techniques to restore connectivity effectively.
Check Hyper-V Virtual Switch Configuration
Step 1: Access Hyper-V Manager
Begin by opening the Hyper-V Manager on your Windows Server 2012 R2 system. This powerful tool allows you to manage your virtual machines and their associated network settings effectively.
Step 2: Review Virtual Switch Manager
In the right-hand pane, select Virtual Switch Manager. Take a look at the list of existing virtual switches and confirm that your Ubuntu VM is connected to an External virtual switch. This configuration is critical as it provides direct access to the physical network; in contrast, an Internal or Private switch could limit necessary traffic.

Step 3: Create an External Virtual Switch
If your VM is not connected to an external switch, create one by selecting New virtual network switch and then choosing External. Make sure to assign the switch to the appropriate physical network adapter, then apply the changes to save your settings.

Step 4: Attach the External Switch to Your VM
Shut down the Ubuntu VM if it is currently running. In the VM settings, connect the newly created external switch to the VM’s network adapter. Start the VM again and verify proper network connectivity.
Verify Windows Firewall Rules
Step 1: Open Windows Firewall Settings
On your Windows Server 2012 R2 desktop, access the Windows Firewall with Advanced Security by navigating via the Control Panel or running firewall.cpl.
Step 2: Check Inbound and Outbound Rules
Examine the inbound and outbound rules pertaining to the Hyper-V virtual switch and the network adapter utilized by your Ubuntu VM. Confirm that no rules are obstructing outbound TCP traffic, especially for port 23, which is used by telnet.
Step 3: Create an Outbound Rule
If necessary, create a new outbound rule to allow TCP traffic from the VM subnet or a specific IP address range. Go to New Rule > Port > TCP > enter Specific local ports: 23, allow the connection, and specify the corresponding profiles.
Step 4: Test Telnet Connectivity
Once you’ve applied all necessary changes, conduct a test for telnet connectivity from the Ubuntu VM to an external host.
Configure Ubuntu Network Settings
Step 1: Log into Your Ubuntu VM
After logging in, check the network interface configuration to ensure it is set to use DHCP or has a valid static IP address in the correct subnet. Use the command:
ip addr
Step 2: Test Basic Network Connectivity
Perform a basic connectivity test by pinging an external IP, such as ping 8.8.8.8. If the ping fails, there may be an issue with the VM’s network configuration or the Hyper-V switch settings.
Step 3: Set Correct Gateway and DNS Servers
If using a static IP, confirm that the gateway and DNS servers are properly set in /etc/network/interfaces or /etc/netplan/*.yaml, depending on your Ubuntu version. Restart the networking service with:
sudo systemctl restart networking
Step 4: Test Telnet Connection
Once basic connectivity is verified, attempt a telnet connection to an external server:
telnet example.com 23
If the connection fails again, proceed to the next troubleshooting step.
Test Telnet from Windows Host
Step 1: Open Command Prompt
On the Windows Server 2012 R2 host, open a Command Prompt window and try to telnet to the same external server. If telnet is not installed, enable it with:
dism /online /Enable-Feature /FeatureName:TelnetClient
Step 2: Execute the Telnet Command
Run the following command:
telnet example.com 23
Step 3: Analyze the Results
If telnet fails from the host as well, there may be an issue with the external network or your ISP. However, if it succeeds from the host but not from the Ubuntu VM, the problem likely lies in the VM’s network or Hyper-V settings.
Disable Ubuntu Firewall Temporarily
Step 1: Check for UFW
Ubuntu systems often have Uncomplicated Firewall (UFW) enabled by default. Temporarily disable it to see if it is blocking outbound telnet connections:
sudo ufw disable
Step 2: Retry Telnet Command
Attempt the telnet command again. If it works, you can adjust your firewall rules to allow outbound connections on port 23 and then re-enable the firewall:
sudo ufw allow out 23/tcp
sudo ufw enable
Step 3: Secure Your Configuration
Ensure you only leave the firewall disabled for troubleshooting; remember to re-enable it with the correct settings after testing.
Additional Troubleshooting Steps
Step 1: Check Server Accessibility
Ensure that the destination server is configured to accept telnet connections on port 23, as some modern servers may disable telnet for enhanced security.
Step 2: Consult Network Administrators
If you’re operating behind a corporate firewall or proxy, check with your network administrator to confirm that outbound port 23 is permitted.
Step 3: Explore Alternative Connectivity Solutions
If telnet is not an essential part of your workflow, consider utilizing alternative methods such as SSH for more secure connections (e.g., ssh user@host).
Conclusion
By systematically checking your Hyper-V virtual switch configuration, verifying firewall rules, and ensuring proper network settings in Ubuntu, you can effectively resolve the inability to telnet from your Ubuntu VM on Windows Server 2012 R2. If issues persist, further troubleshooting and consultation with network administrators may be necessary. With these steps, you can restore connectivity and enhance your virtual machine’s network capabilities.
And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!
We do not support or promote any form of piracy, copyright infringement, or illegal use of software, video content, or digital resources.
Any mention of third-party sites, tools, or platforms is purely for informational purposes. It is the responsibility of each reader to comply with the laws in their country, as well as the terms of use of the services mentioned.
We strongly encourage the use of legal, open-source, or official solutions in a responsible manner.


Comments