Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0

I do an ssh 10.0.2.15 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. . . . . . . . . . . : 192.168.56.1
    Subnet Mask . . . . . . . . . . . : 255.255.255.0

When I now use PuTTY, to connect to 192.168.56.1, it says connection refused. Connection to 10.0.2.15 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.

share|improve this question
1  
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 '09 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 '09 at 23:24
    
John, if you disagree I suggest you too read vbox manual. –  Bender Nov 16 '09 at 5:17

4 Answers 4

up vote 1 down vote accepted

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
share|improve this answer

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.

share|improve this answer

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 192.168.56.2 and mask 255.255.255.0.

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

share|improve this answer
    
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 '09 at 8:56

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 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255

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

share|improve this answer
    
I tried service network restart, but get 10.0.2.15 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 192.168.56.1, and it worked perfectly. 10.0.2.15 gives a connection timeout. Can also ping my Windows 7 machine 172.24.1.203 from my Linux guest, when ip is 10.0.2.15, which is dynamically allocated. –  user18151 Nov 16 '09 at 6:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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