I'm using VirtualBox on Windows 7 to run Fedora 7. I seem to have my SSH on, as /sbin/service sshd status tells me. When I do an /sbin/ifconfig, I get this:

eth0   Link encap:Ethernet  HWaddr 08:00:27:CF:5A:0B
       inet addr:  Bcast:  Mask:

I do an ssh from inside Fedora, and connect back to the guest machine.

When I do an ipconfig on my Windows machine, I get this information:

Ethernet adapter VirtualBox Host-Only Network:

    Connection-specific DNS Suffix  . :
    Link-local IPv6 Address . . . . . : fe80::b42c:a852:a0e8:1636%19
    IPv4 Address. . . . . . . . . . . :
    Subnet Mask . . . . . . . . . . . :

When I now use PuTTY, to connect to, it says connection refused. Connection to times out.

SSH service is running. I have disabled SELinux. Also, I have allowed ssh as a trusted service in system-configure-securitylevel. I have tried to switch the firewall completely, but it turns back on automatically.

  • 2
    Did you read VirtualBox manual? What's your virtual machine's network adapter mode? If it's NAT, you need to set up port forwarding.
    – Bender
    Nov 15, 2009 at 22:48
  • If he's trying to ssh into a vm on his own box he doesn't need port forwarding at all.
    – John T
    Nov 15, 2009 at 23:24
  • John, if you disagree I suggest you too read vbox manual.
    – Bender
    Nov 16, 2009 at 5:17

4 Answers 4


Found the solution. The manual contains it all. Thanks Bender.

VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

I'd suggest not turning off the firewall if your VM has internet access. Try running service network restart (pretty sure it works in Fedora) or simply type ifdown eth0 then ifup eth0. Try connecting to your newly supplied address.

You could also set it statically for example:

/sbin/ifconfig eth0 netmask broadcast

Give the sshd service a restart too for good measure, then try to connect to

  • I tried service network restart, but get again, to which I failed to connect. When I set ip statically, my internet connection stops working from guest machine. Before I did anything, I tried to pint, and it worked perfectly. gives a connection timeout. Can also ping my Windows 7 machine from my Linux guest, when ip is, which is dynamically allocated.
    – 0fnt
    Nov 16, 2009 at 6:50

You seem to have a simple networking issue.
The IP Networks for your two machines are different.
Try changing your hosted Fedora IP address to and mask

To confirm this, try to ping from one machine to the other without the changes I suggest above. They should be unreachable both-ways.

  • Most computers on the internet are in a different network than mine, but I can still connect to them? Even in my own network I have 192.168.x.x and 10.x.x.x mixed, but no problems connecting. (And ping responses may fail for other reasons?)
    – Arjan
    Nov 16, 2009 at 8:56

In your VirtualBox settings for your Fedora 7 VM, set the network adapter to "bridged adapter", and choose your primary ethernet card. This will put the VM on the same subnet as your Windows 7 machine, and Fedora should pick up an IP address from your dhcp server. If you're not using dhcp, configure the Fedora 7 adapter (within Fedora) manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .