CentOS 5.5 sshd problem

Discussions about using Linux guests in VirtualBox.
Post Reply
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

CentOS 5.5 sshd problem

Post by Nightshadow »

Hi all,

I have installed CentOS 5.5 on my Vbox which I'm running on w7.
Everything is okey, except the fact that I can't connect to CentOS from outside.Even from my host OS.
I did a search and I found out that I need to type some commands in order to portforward in virtual box.I did this.

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata nightshadow "VBoxInte
rnal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.


C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata nightshadow "VBoxInte
rnal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.


C:\Program Files\Oracle\VirtualBox>VBoxManage setextradata nightshadow "VBoxInte
rnal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.
As you can see, I did that from command prompt on my host computer.
When I type VBoxManage getextradata nightshadow enumerate I got this

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage getextradata nightshadow enumerate

Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.

Key: GUI/Fullscreen, Value: on
Key: GUI/LastCloseAction, Value: powerOff
Key: GUI/LastGuestSizeHint, Value: 1680,1050
Key: GUI/LastWindowPostion, Value: 0,0,0,0,max
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol, Value: TCP
I did portforwarded both, 2222 and 22 ports (UDP and TCP).I don't have any firewall software installed.
When I try to connect to my Guest OS, I just get Connection refused message.

What is the problem ?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

Problem is reading the manual. You didn't do that. Adding NAT rules changed. Check the new syntax.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

I typed this command
VBoxManage modifyvm "nightshadow" --natpf1 "guestssh,tcp,,2222,,22"
And now I can't even start my VM.
I got this

Code: Select all

Failed to open session for the virtual machine nightshadow
Configuration error: Failed to get the ''MAC'' value (VERF_CFGM_VALUE_NOT_FOUND).
Unknown error creating VM
(VERF_CFGM_VALUE_NOT_FOUND)   
Just great.
How to fix this now ?
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

Anybody able to help me ?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

The command you used last should work, but it's possible that your old data is still entered in the VM xml file. Edit it with notepad when VB is shut down completely and remove the first tried information.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

That worked, now I can start my VM.
Thanks.
Now, I typed this command
VBoxManage modifyvm "nightshadow" --natpf1 "guestssh,tcp,,2222,,22"
And I can connect from my host computer(127.0.0.1, port 222).
But now, how do I connect from outside ?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

You connect to the IP that the Host has. Let's say it has 192.168.1.100, then other systems on your network connect to 192.168.1.100 on port 2222.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

I meant how to connect from outside, from some other computer, not from computers in my network..
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

Oh, connect to the VM from the internet? Then you forward port 2222 on your router to your Host. Double NAT requires a double forward.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

Yea, that's what I want.
Khm, I'm not sure if I understood that.
I typed ipconfig in my cmd from host machine, windows 7, and I got this for my VM

Code: Select all

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::6907:19f9:ad31:eabf%22
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
So I guess I need to forward port 2222 to 192.168.56.1 ?
I did that, but it's not working.
Sorry if I'm too boring, but I'm new to these things.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

You forwarded to a non-existing IP address for the router. That Host-Only address only exists on the Host. Your router does not know about it. You can find the IP address of the Host on the Network Center (Vista and 7) then the Status of the physical interface. If you are going to use 'ipconfig', then you have to look for the IP address noted at the physical interface section. It would look like this (quick grab from a W7 VM):

Code: Select all

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::e578:5894:d823:f7d5%11
   IPv4 Address. . . . . . . . . . . : 10.0.2.15
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.0.2.2
Pay close attention to the name. Your output said "VirtualBox Host-Only Network", mine says "Local Area Connection".
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Nightshadow
Posts: 7
Joined: 1. Aug 2010, 16:04
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: CentOS 5.5

Re: CentOS 5.5 sshd problem

Post by Nightshadow »

Khm..

Code: Select all

root@veverica:/home/darkooo# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        0.0.0.0         255.255.255.0   U     202    0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         10.0.2.2        0.0.0.0         UG    202    0        0 eth0
It's from my VM.
So, I should forward 2222 to 10.0.2.2 ?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CentOS 5.5 sshd problem

Post by Sasquatch »

No. Please, read www.portforward.com for instructions. This is no longer a VB issue. You need to figure out what your HOST IP address is and put that in the router config.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply