VirtualBox: Additional network interfaces configured in /etc/network/interfaces, but can't connect to internet


Anton

Following this link , I used VirtualBox to configure 2 network interfaces for Debian 9 Guest.

  1. A host-only adapter without DHCP that gives the VM a static IP address.

    In a /etc/network/interfacesconfiguration like this:

    auto enp0s3 
    iface enp0s3 inet static
    address: 192.168.57.5
    network: 192.168.57.0
    netmask: 255.255.255.0
    gateway: 192.168.57.1
    

    I can SSH into the VM from the host using that IP address. The interface seems to work as expected.

  2. NAT adapter

    In a /etc/network/interfacesconfiguration like this:

    auto enp0s8
    iface enp0s8 inet dhcp
    

    I want to be able to access the internet from the host using that interface. It doesn't work.

this is the outputip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:64:4a:3b brd ff:ff:ff:ff:ff:ff
    inet 192.168.57.5/24 brd 192.168.57.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe64:4a3b/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:41:71:e2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.15/24 brd 10.0.3.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe41:71e2/64 scope link 
       valid_lft forever preferred_lft forever
Yakim

You have a problem with two gateways. Remove gateway from enp0s3

Related


Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

VirtualBox: Ubuntu guest can't connect to internet

albert I have configured the Ubuntu server (guest) with a NAT adapter and configured it in / etc/network/interfaces like this: auto enp0s3 iface enp0s3 inet dhcp But not connected to the internet: ping www.google.com ping: unknown host www.google.com The hos

Can't connect to internet in VirtualBox VM - Ubuntu

Milad Na I have installed Ubuntu on a VM in VirtualBox and created 2 clones from it. Everything was fine, but after a while the internet connection failed for all VMs in VirtualBox. Here are the network settings: bridge adapter allow all (I also checked allow

Lost settings and network, can't connect to the internet

spooky Had to type this on my phone, it sucks lately, so I apologize for any typos/autocorrect issues I missed while proofreading. I've checked all hardware (ethernet ports, cables, etc.). A few days ago, my desktop suddenly had no internet ( running 18.04.1 L

Why can't VirtualBox's guests connect to the network?

Nan Xiao I have it installed CentOS 7and the virtualboxnetwork is set to NAT. Guests cannot connect to the network: systemctl -l status networkThe output is this: ip addrThe output is this: Can someone comment on this question? Nan Xiao After investigation, th

Why can't VirtualBox's guests connect to the network?

Nan Xiao I have it installed CentOS 7and the virtualboxnetwork is set to NAT. Guests cannot connect to the network: systemctl -l status networkThe output is this: ip addrThe output is this: Can someone comment on this question? Nan Xiao After investigation, th

Can't connect to internet using Debian WIFI network

help I installed debian 9 and everything worked fine - I was able to discover the surrounding networks and connect to the internet. The problem arose when I decided to try by changing this file, trying to go from automatically assigning an IP address via DHCP

Can't connect to internet using Debian WIFI network

help I installed debian 9 and everything worked fine - I was able to discover the surrounding networks and connect to the internet. The problem arose when I decided to try by changing this file, trying to go from automatically assigning an IP address via DHCP

Can't connect to internet using Debian WIFI network

help I installed debian 9 and everything worked fine - I was able to discover the surrounding networks and connect to the internet. The problem arose when I decided to try by changing this file, trying to go from automatically assigning an IP address via DHCP

AVD can't connect to internet?

Syam Sundar K. I try to run an application that gets JSON data from internet via HTTP Request object and it shows java.net.UnknownHostException: Unable to resolve host “api.github.com”: No address associated with hostname as an exception to each trial. Later,

AVD can't connect to internet?

Syam Sundar K. I try to run an application that gets JSON data from internet via HTTP Request object and it shows java.net.UnknownHostException: Unable to resolve host “api.github.com”: No address associated with hostname as an exception to each trial. Later,

Can't connect to internet on Ubuntu

lead I have dual boot on my PC. I can access the Internet through Windows, but not through Ubuntu. I was not able to connect to the internet on either OS until a few days ago when my brother reset my router (or modem, I don't know) to factory settings and the

Chrome can't connect to the internet

Robev I am getting error code in Google Chrome: DNS_PROBE_FINISHED_NO_INTERNET. The problem is, my internet connection is fine. I am using Internet Explorer to post this message over that connection. Only Chrome can do this. What happened was that my laptop re

Android can't connect to internet

Pablo Arnau González I'm developing an android app, this is my first app and my first time using a web app. In java my code works fine and in android i have included in the uses permission networkmanifest and it still doesn't work and i don't know why. my code

AVD can't connect to internet?

Syam Sundar K. I try to run an application that gets JSON data from internet via HTTP Request object and it shows java.net.UnknownHostException: Unable to resolve host “api.github.com”: No address associated with hostname as an exception to each trial. Later,

Can't connect to internet on Ubuntu

lead I have dual boot on my PC. I can access the Internet through Windows, but not through Ubuntu. I was not able to connect to the internet on either OS until a few days ago when my brother reset my router (or modem, I don't know) to factory settings and the

Chrome can't connect to the internet

Robev I am getting error code in Google Chrome: DNS_PROBE_FINISHED_NO_INTERNET. The problem is, my internet connection is fine. I am using Internet Explorer to post this message over that connection. Only Chrome can do this. What happened was that my laptop re

Android can't connect to internet

Pablo Arnau González I'm developing an android app, this is my first app and my first time using a web app. In java my code works fine and in android i have included in the uses permission networkmanifest and it still doesn't work, i don't know why. my code in