1

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 127.0.0.1/8 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 10.0.2.15/24 brd 10.0.2.255 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 10.0.2.15 (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: 192.168.1.100 Host Port: 22 Guest IP: 10.0.2.15 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?

1 Answer 1

1

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: 192.168.1.100

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 192.168.1.100 Port 22 --> 10.0.2.15 port 22 BUT you could have just as easily done.... 192.168.1.100 port 10022 --> 10.0.2.15 port 22. From you LAN you could now access your virtual guest by:

ssh -p 10022 [email protected]

Shanman

You must log in to answer this question.

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