I have a VirtualBox running an Ubuntu OS. I'd like to access this Ubuntu machine using ssh or telnet. In order to do that I've performed the following steps:

  1. sudo apt-get install telnetd
  2. sudo /etc/init.d/openbsd-inetd restart

Then I tried to access this system using telnet from another machine but unfortunately the connection become timed out:

# telnet
telnet: connect to address Connection timed out
telnet: Unable to connect to remote host: Connection timed out

Also I'd like to mention that I could easily ping this machine (both ways):

# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=57 time=2.34 ms
64 bytes from icmp_seq=2 ttl=57 time=1.81 ms

EDIT: I have also performed the open ports scan and it seems ok:

$ sudo nmap -p 20-2550 localhost 

Starting Nmap 5.00 ( http://nmap.org ) at 2012-06-11 15:31 IDT
Warning: Hostname localhost resolves to 2 IPs. Using
Interesting ports on localhost (
Not shown: 2526 closed ports
22/tcp  open  ssh
23/tcp  open  telnet
25/tcp  open  smtp
587/tcp open  submission
631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 1.54 seconds

EDIT2: ifconfig from the VirtualBox Ubuntu:

eth0      Link encap:Ethernet  HWaddr 08:00:27:0d:43:7d  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe0d:437d/64 Scope:Link
          RX packets:9247631 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10147 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3145994247 (3.1 GB)  TX bytes:727714 (727.7 KB)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:30446 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30446 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1280714 (1.2 MB)  TX bytes:1280714 (1.2 MB)

Windows IP Configuration

Ethernet adapter Local Area Connection:

    Connection-specific DNS Suffix  . : xxx.com
    IP Address. . . . . . . . . . . . :
    Subnet Mask . . . . . . . . . . . :
    Default Gateway . . . . . . . . . :

Ethernet adapter VirtualBox Host-Only Network:

    Connection-specific DNS Suffix  . :
    IP Address. . . . . . . . . . . . :
    Subnet Mask . . . . . . . . . . . :
    Default Gateway . . . . . . . . . :

Any ideas?

  • Did you check if the correct port is open with nmap or similar programs?
    – milo5b
    Jun 11, 2012 at 12:31
  • Yeah, sure. I added and EDIT to my answer.
    – Eugene S
    Jun 11, 2012 at 12:32
  • Can you run ifconfig on both host and VM please? Jun 11, 2012 at 13:05
  • @AlexChamberlain Added as EDIT2!
    – Eugene S
    Jun 11, 2012 at 13:15
  • 2
    Telnetd is considered bad practice these days. Don't use it, don't run the daemon on your system. Use sshd instead. Spend your time learning about a secure way of connecting to your system instead of something that makes your server vulnerable by design.
    – jippie
    Jun 11, 2012 at 21:01

2 Answers 2


So here are in one answer a summary of my comments.

You have 3 solutions depending on your environment:

A. Your Windows host is connected to a network

1- Use "Bridge networking"

And select the Windows network interface that is configured under Windows to have network access.

Make sure you have no firewall on Ubuntu: sudo iptables -L should give you no rules.

2- Use "NAT" with port-forwarding

Select NAT and unflod the advanced settings of the NAT interface in VirtualBox settings. Then you click on the Port Forwarding button and create a new rule, you name it "telnet" (or whatever you prefer), protocol should be "TCP", leave the fields Host and Guest IP empty, but set the Host and Guest Port to 23.

Check the external IP address of the VM to access it. This IP address is the same one as for the VirtualBox Host-only network, you can check the IP in Windows networking center by clicking on the interface and displaying its status/details. Or you can check in VirtualBox preferences (not the VM Settings, but the VirtualBox preferences) under network, check the IP address of the Host-only ethernet adpater (click on the Edit button of this interface).

Make sure you have no firewall on Ubuntu: sudo iptables -L should give you no rules.

B. Your Windows host has no network

Use "Host-only" networking. Nothing else to configure.

The IP address to use is the one given in Ubuntu when you run ifconfig.

Make sure you have no firewall on Ubuntu: sudo iptables -L should give you no rules.

  • Thank you for your detailed answer! So since I have my Windows host connected to the network I used the first option, which is using Bridged Connection. I chose the "Broadcom NetXtreme 57xx Gigabit Controller" which is an actual physical controller installed on the PC. I've also checked that there are no firewall configured in Ubuntu. After starting the machine I got the exact condition I had from the very beginning.. I can ping both ways inside the network (I have few Linuxes in the network). I can ssh to all these from Ubuntu. The only problem is that I cannot ssh TO this Ubuntu system.
    – Eugene S
    Jun 12, 2012 at 13:31
  • When you are on one of your Linux boxes, what does ssh tells you when you ask it to be verbose? Like with ssh -v <USER VM>@<IP VM>? And you confirm that from another Linux boxes you can ping <IP VM> and it is working? What about sudo nmap -A <IP VM> (not using localhost, but really being from another Linux machine and entering the IP address of the VM)?
    – Huygens
    Jun 12, 2012 at 14:00
  • Verbose output of the ssh give only the following: OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to [] port 22. I afraid it will be impossible to nmap from another machine since the rest of them are Red Hats with no nmap on them..
    – Eugene S
    Jun 12, 2012 at 14:15
  • I've just noticed that I can telnet AND ssh to that Ubuntu system from Windows(on which the VB is running) and the connection succeeded! However I still can't ssh to that Ubuntu from any other Linux system. This is really getting strange for me..
    – Eugene S
    Jun 12, 2012 at 14:21
  • If you have Red Hat CD/DVD or subscription and administrative rights, then you could install nmap on these machines, it is just not part of the default Red Hat installation. However, if you can telnet from Windows to VM but not from an external system to VM while in bridge networking, then there is a firewall of some sort on your windows box that is blocking the network stream.
    – Huygens
    Jun 12, 2012 at 14:26

I'm pretty sure this is problem with network configuration on you VirtualBox.

Open up VM settings:

enter image description here

  1. Make sure you select Bridged Adapter ( I expect you have NAT configured which does not allows to route connections from outside to your VM)

  2. Select available network card (I used MS Loopback adapter, on your PC it will be different)

More info here and here

  • 2
    Or you can leave it to NAT, but you have to click on the Port Forwarding button and Set a new rule, you name it "telnet", protocol should be "TCP", leave the fileds Hos and Guest IP empty, but set the Host and Guest Port to 23.
    – Huygens
    Jun 11, 2012 at 15:16
  • @Huygens, +1 you are correct, but I think for OP is probably more easy to setup it this way.You can also post this as answer.
    – rkosegi
    Jun 11, 2012 at 15:42
  • 1
    It is a bridged adapter (as was discussed in the comments). But selecting the correct adapter might help.
    – lgarzo
    Jun 11, 2012 at 15:58
  • Thank you for your answer. So regarding the first point, I do have Bridged Adapter configured. I've configured the "Microsoft Loopback Adapter", as you proposed (I had to install it on my Windows first). But then, after I restarted the virtual machine, I was not able to reach the PC from the VM and vice versa.
    – Eugene S
    Jun 12, 2012 at 6:30
  • @EugeneS : you need to configure IP of MS Virtual Loopback adapter to something from same subnet as your VM has.Eg if your VM is and netmak is then set IP of virtual loopback adapter to (or similar).
    – rkosegi
    Jun 12, 2012 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.