Ubuntu – Setup static Ip in virtual box


I have as issue i am Ubuntu desktop and i have installed virtual-box(4.1)
Ubuntu 11.10 desktop is my host operating system and on Virtual-box i installed Ubuntu server selecting bridge adapter as my first adapter by default my network interfaces file get ip address by dhcp server but i want to setup an static ip.

by changing network interface file to static and gave some static ips my internet stop working on guest operating system(virtual-box -> Ubuntu server).

Can any one help me how can i setup static on virtual-box so that my internet will work too on my guest operating system.

thanks in advance.

Best Answer

It would help to post the following:

#ifconfig eth0

Validate that the Static IP Address is in fact assigned to your virtual machine.

It's quie possible that due to a typo or error the static IP address never binded properly to your Ubuntu Instance. You did mention that upon initial install DHCP was able to acquire an IP Address, so we know the network is working.

Just as a quick test try doing the following:


#sudo ifconfig eth0 down
#sudo ifconfig eth0
#sudo ifconfig eth0 up

First set of octets is going to be your client IPADDRESS

Second set is the netmask

Third set is the gateway

That should temporarily set up eth0 with a static IP. Does that happen to work?

In the meantime please post the output of the following commands in a pastebin.ubuntu.com link

#ifconfig eth0

#cat /etc/default/interfaces

Related Question