I have an Ubuntu 14.04 virtual machine. I set the NAT networking option to it.
Without any further changes, I can access to internet from my VM. When I run: cat /etc/network/interfaces I get this:
ubuntu14@ubuntu14:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopbackHow come I get internet connection without any interface defined for my NAT ?
2 Answers
Interfaces are started automatically during the boot process. This is for for example eth0 for the first ethernet
The entries for lo (loopback) are generally required and may also when using the Network Manager can not be removed or other graphical configuration tool.
Generally, /etc/network/interfaces contains network interface configuration
information for the ifup and ifdown commands. This is where you configure how your system is connected to the network.
Unless you manually configured /etc/network/interfaces with
iface <Interface> <Protocoll> <Method>
Your interface gets DHCP and connects you to the network.
These two entries:
auto lo
iface lo inet loopbackare fundamental components of Linux. If these entry's are gone, interfaces can no longer communicate with each other.
Read More about network interface configuration.
Finally, I guess your VM gets a bridge interface from your host. You can list all your interfaces running ifconfig -a and you can see which interface connecting you to the internet.
/etc/network/interfaces is only used for manually configured networking.
Your VM can access the internet because Ubuntu uses network-manager to configure the network. The configuration is stored in the directory /etc/NetworkManager/system-connections/ Try nmcli nm or nmcli d to see the current network status.