[SOLVED - (3) below] I'm running Ubuntu 18.04.1 LTS in a VirtualBox VM instance. I am building an internal network in accordance with an article on setting up a non-internet accessible, isolated virtual network environment for the purpose of analyzing malware. I require internet on this VM instance to download programs to it for use with my setup. NAT mode is enabled for the VM instance in question, and I was expecting DHCP internet access upon boot up of the instance but no website is reachable.
I defined interfaces in /etc/network/interfaces for the local host and the network gateway(this VM instance). I've also defined a dhcp interface for use with NAT networking: (I've commented out the static enp0s3 interface because it was defined for use with the internal network.)
auto lo iface lo inet loopback #Internal Network #auto enp0s3 #iface enp0s3 inet static #address 10.0.0.1 #netmask 255.255.255.0 auto eth0 iface eth0 inet dhcp
I defined eth0 as a dhcp interface for use with NAT. This is assuming I needed to do this. I then entered command
sudo ifup eth0 in bash as I did when I defined static interface enp0s3 for use with the internal network, but I received an error stating that interface eth0 cannot be found.
I then checked the connection that was enabled under Network Settings. The connection is defined with a routable IPv4 address: 10.x.x.x. It has DNS resolvers set to Google DNS. The Hardware address is filled out. And 'Connect Automatically' is checked. MAC address is defined as enp0s8(I haven't defined this in the interfaces file). DHCP is also set to automatic under the IPv4 settings of the network connection.
I ran command
sudo service network-manager restart, after
sudo service networking restart was giving me an error, but I still can't reach the internet.
UPDATES : (1) I used
ifconfig in bash to check interfaces recognized by the system and eth0 was not among them even though I've defined it in the network configuration file. enp0s8 was however recognized.
(2) After checking the network interfaces recognized by the system using
ip link, I have changed the defined interface name to enp0s8. Brought enp0s8 down with
sudo ifdown enp0s8 and brought it back up with
sudo ifup enp0s8. I noticed the end line of the multi-line output I received:
grep: /etc/resolv.conf: No such file or directory. I checked the enp0s8 interface with
ip link and it read as status UP. I then restarted the network service with
sudo service networking restart and also
sudo service network-manager restart. There is no network connection defined as there was in the Network Settings prior to update(2). Only VPN option.
grep: /etc/resolv.conf: No such file or directory meant that this was a dead symlink and so I removed resolv.conf and defined the name server to be used by the enp0s8 dhcp interface as Google DNS with
echo "nameserver 184.108.40.206" > /etc/resolv.conf, creating the resolv.conf file with the associated Google DNS information. The internet is now reachable. The file resolv.conf can be wiped by the Network Manager when it is restarted however. Set aside the Network Manager not showing an active internet connection tray icon in the taskbar as well as not being able to Connect through the Network Manager as a confirmation that you can't reach the internet. Once the proper interface is defined in the network configuration file and you've defined a corresponding name resolver in resolv.conf, try reaching websites. It just might work.