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 address 10.0.2.20 netmask 18.104.22.168 broadcast 10.0.2.225 gateway 10.0.2.2
I got the gateway using
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0 10.0.2.0 0.0.0.0 255.255.255.0 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 10.0.2.2.
What am I doing wrong, and what should I do to get static IPs set on these VMs?