What should I do?

I installed VirtualBox 4.2.6

I installed CentOS 6.3

It's powered on

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:5f:8c:47 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet6 fe80::a00:27ff:fe5f:8c47/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 08:00:27:c0:31:8f brd ff:ff:ff:ff:ff:ff

ip addr shows eth0 as (I just enabled DHCP)

In VirtualBox, right-clicking on my VM and clicking on settings and then clicking on the Network button on the left-hand side of the VM's settings in VirtualBox shows that I have a virtual NIC with NAT enabled

And then clicking on the Port Forwarding button, I added one rule:

Name: SSH Protocol: TCP Host IP: Host Port: 22 Guest IP: Guest Port: 22

So I can hit this VM via SSH through my local computer through port 22, however I don't know how to make it so that I can hit this VM via SSH from a remote machine?

Can someone please help?


You just need to port forward in your 'real' router that your Internet comes through and forward port 22 to your host IP which is:

You only need TCP port forwarding for it to work.

I might also recommend that instead of having port 22 open to the world that you actually pick an obscure port number from the outside like: 10022 (or anything in the higher numbers really) and then have the router send it to port 22. It would work the same way as you set it up in virtualbox. You showed that you setup the Advanced Port forward in it from Port 22 --> port 22 BUT you could have just as easily done.... port 10022 --> port 22. From you LAN you could now access your virtual guest by:

ssh -p 10022 yourname@


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.