I'm using 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.)

Contents of /etc/network/interfaces:

auto lo
iface lo inet loopback

#Internal Network
#auto enp0s3
#iface enp0s3 inet static

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 resolver 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.

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.

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 before. Only VPN option.

  • Hey D. Joe!!! Glad to know that you solved the issue. However, since this a Q&A site, the solutions/answers are expected to be in answer section. I've removed the solution from the question and posted it as community wiki answer. But if you wish to post on your own, ping me using @Kulfy in the comment. I'll delete the answer that I posted. – Kulfy Oct 31 '19 at 9:44

From revision #6 of the question:

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" > /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.

| improve this answer | |

You can't use an interface named eth0 because no such interface exists. The interface that exists will have a different name, according to consistent network device naming principles. Names such as eth0 aren't used by default anymore.

If you aren't sure what the name of your new interface is, you can use ip link to find all of the interfaces which exist in the system. Once you know the correct name, you can use it instead of eth0 in your /etc/network/interfaces configuration.

| improve this answer | |
  • Thank you for this. After updating the interface name to the one listed under ip link, I can no longer connect to an active network connection as there is no longer a network connection defined in Network Settings. I've brought the interface back up after bringing it down, and I restarted network service and I've even rebooted the VM but still no defined network connection. – D. Joe Jan 6 '19 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.