Here is are some quick and dirty instructions on setting (fixing) the IP address of Ubuntu within a Virtual Box VM:
- In the Virtual Box Manager right-click your VM then choose “Settings”
- On the left click “Network”
- Change the adapter to “Bridged Adapter”
- Log into your VM (probably using the VM console)
- Edit the file
sudo nano -w /etc/network/interfaces
- Comment out iface eth0 inet dhcp by putting a
#
in front of the line - Add the following lines replacing the X’s for your network values:
iface eth0 inet static
address x.x.x.x
netmask x.x.x.x
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
dns-nameservers x.x.x.x - Exit nano and save the file ([Control] + [X] then [Y])
- Restart the interface
sudo /etc/init.d/networking restart