Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running a web (development) server on my Virtualbox (Ubuntu 11.1). I'm moving around a lot and thus I get various IP addresses on my computer.

Each time I get a new IP adr I have to change various config settings to get my site up and going.

Is there a way that I can set "permanent" IP address on my VB and somehow route all trafic to my laptop?

share|improve this question

migrated from serverfault.com Feb 1 '12 at 12:40

This question came from our site for system and network administrators.

    
Is this not just a case of setting a staic IP in the Ubuntu Guest? –  tombull89 Feb 1 '12 at 9:36
    
no, because I need to get out on the net from the dev server. –  Steven Feb 1 '12 at 9:52
    
Please explain which config settings you need to change. You should be able to achieve what you need with DNS. –  Paul Feb 1 '12 at 12:43

2 Answers 2

I had the same problem (VirtualBox 4.1.10, Host Ubuntu 11.10, Guest Ubuntu 11.10). Here's how I fixed it:

Set two network interfaces for the VM. The first one should be NAT and the second should be Host-Only. If you can't add a host-only connection, make sure you've set one up in Preferences -> Network.

In the Guest OS (Ubuntu for me), edit /etc/network/interfaces, adding the following on the end:

auto eth1 # this refers to the Host-only network interface
iface eth1 inet static
address 192.168.56.10 # Arbitrary IP address
netmask 255.255.255.0

and reboot. And that's it. Don't modify anything for eth0, since we need that getting it's settings automatically via DHCP to access the internet. eth1 lets the host and guest communicate with eachother.

share|improve this answer

You can change your VB Guest IP to static by modifying these files.

vim /etc/network/interfaces

Add these lines at the end:

auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

For DNS Setting

vim /etc/resolv.conf

and add:

nameserver xxx.xxx.xxx.xxx
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.