Update Internet Interface in Ubuntu

Sometimes, it can not connect to internet from a virtual machine.

check the internet interface by

   ifconfig -a

it should shows something like eth0 or eth1, this is the interface name

go to /etc/network/interfaces

to set dhcp simply put in

   iface eth0 inet dhcp

   if it is eth1, then iface eth1 inet dhcp

to set static ip, put in

   iface eth0 inet static

   address 192.168.0.2

   netmask 255.255.255.0

   gateway 192.168.0.1

   dns-nameservers 166.111.8.28 166.111.8.29