-2

I frequently work in different locations, and need to have a virtualbox version of Ubuntu server running locally.

While I was at home getting it set up, I was able to ssh into the server using the locally allocated IP address. However, now that I'm elsewhere, ifconfig is still showing the old 10.0.x.x ip address, but instead of being in the 10.0.x.x space, my laptop's ip starts with 192.168.x.x

With that in mind, if there a straightforward way to set up the virtual box Ubuntu server in such a way that I can just connect using "ssh servername" regardless of it's ip address?

Don H
  • 147
  • 1
  • 6
  • remove the word "virtual" and see if the answer progresses logically from your question. Also the answer will depend on how you have your VirtualBox NIC set up. – voretaq7 Nov 10 '12 at 20:42
  • I appreciate your taking time to answer, but don't see how it helps. My use of virtualbox is to allow me to have a development environment on this laptop that is set up in a similar way to my Linode hosted live server. If you're suggesting I set up a static testing machine in a fixed location for this purpose, then that's not helpful. I do not have any such option. – Don H Nov 10 '12 at 21:41
  • 1
    It looks like my question is very similar to here: http://superuser.com/questions/357120/how-do-i-setup-a-virtualbox-server-with-a-static-ip – Don H Nov 10 '12 at 21:45

1 Answers1

1

To clarify my comment, I'm suggesting (heck, I'm saying outright) that there's nothing special about your system just because it's a VM - Configure it exactly as you would any other system.
(Since you're on Server Fault I have to assume you know how to handle that part - if not that's a question for Ask Ubuntu.)

The only difference is that your VM is connected to a "virtual switch" inside virtual box (which is probably one of Bridged, NAT, or Host Only networking). You should (must) read the Virtual Box documentation on the type of network connections available, and decide which best meets your needs.

My inclination is that you probably want a NAT adapter (so the VM can see the outside world, but you can only SSH to it from your laptop), with the IP address of your Ubuntu VM configured statically (as in the question you linked to), and possibly an entry in /etc/hosts on your laptop so you don't have to type the IP every time.

voretaq7
  • 79,879
  • 17
  • 130
  • 214
  • Thanks for clarifying, I've currently got a combination of Bridged in the first adaptor and Host Only in the second, which I set up to use a fixed IP in the hopes it wouldn't change when I go to different networks. I'll look into NAT instead of Bridged and see if it's better for this purpose. – Don H Nov 11 '12 at 00:11