Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running Ubuntu 12.04 as a VirtualBox guest, but I'm having trouble configuring a static IP. I have the network adapter configured for NAT, because I can't assign static IPs on my Universities network (or I could, but I can't guarantee they won't get taken by someone else since they are assigned with DHCP). I edited my /etc/network/interfaces file to look like this

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

I got the gateway using netstat -nr:

Kernel IP routing table
Destination    Gateway        Genmask        Flags    MSS Window    irtt Iface        UG         0 0            0 eth0  U          0 0            0 eth0

I also tried the default gateway that my laptop is using, but neither have worked. Once I take eth0 down and bring it back up (or restart the VM), I cannot ping google.com or any other websites. I can however ping

What am I doing wrong, and what should I do to get static IPs set on these VMs?

share|improve this question
What do you have set up for your DNS server? It doesn't look like you configured it in the interface. –  CIA Oct 16 '13 at 18:45

1 Answer 1

I tested your config with a CentOS guest in VirtgualBox and it works fine with a statically assigned IP from the internal NAT range just as well as it does using DHCP.

In any case, there is no need to assign a static IP to your virtual guest, running behind NAT, since the DHCP scope it is using is internal to your PC and won't ever show up on the university network.

If it works when you reset the setting back to default, then check what you have in your /etc/resolv.conf, as it could be a DNS issue.

If it is a DNS issue, perhaps try to enable DNS proxy inside VirtualBox.

-- ab1

share|improve this answer
I actually have two VMs and I wanted to setup a heartbeat agent to handle failover. I think (although I'm not completely sure) they need to have static IPs to handle the failover. –  EGr Oct 16 '13 at 19:56

Your Answer


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.