Page 1 of 1

CentOS 5.5 sshd problem

Posted: 1. Aug 2010, 16:12
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 ?

Re: CentOS 5.5 sshd problem

Posted: 1. Aug 2010, 16:17
by Sasquatch
Problem is reading the manual. You didn't do that. Adding NAT rules changed. Check the new syntax.

Re: CentOS 5.5 sshd problem

Posted: 1. Aug 2010, 16:42
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 ?

Re: CentOS 5.5 sshd problem

Posted: 2. Aug 2010, 15:38
by Nightshadow
Anybody able to help me ?

Re: CentOS 5.5 sshd problem

Posted: 2. Aug 2010, 23:52
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.

Re: CentOS 5.5 sshd problem

Posted: 3. Aug 2010, 11:07
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 ?

Re: CentOS 5.5 sshd problem

Posted: 3. Aug 2010, 20:03
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.

Re: CentOS 5.5 sshd problem

Posted: 4. Aug 2010, 01:30
by Nightshadow
I meant how to connect from outside, from some other computer, not from computers in my network..

Re: CentOS 5.5 sshd problem

Posted: 4. Aug 2010, 19:19
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.

Re: CentOS 5.5 sshd problem

Posted: 5. Aug 2010, 00:43
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.

Re: CentOS 5.5 sshd problem

Posted: 5. Aug 2010, 21:06
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".

Re: CentOS 5.5 sshd problem

Posted: 6. Aug 2010, 15:51
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 ?

Re: CentOS 5.5 sshd problem

Posted: 7. Aug 2010, 19:13
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.