ping 8.8.8.8 connect: Network is unreachable?

18,457

It seems from your 192.168.56.* address that you are running in a VirtualBox image, and that you are wondering why the image has no connectivity when presumably your host does.

You have probably set the first eth0 interface to "NAT" or "bridged", and attached it to your host's ethernet interface. If you are online via wifi but your bridge/NAT is configured to use the ethernet card, you won't have network connectivity; the reverse is also true.

Change the network interface of the VM to use the correct host interface.

Share:
18,457

Related videos on Youtube

RandyDandy
Author by

RandyDandy

Updated on September 18, 2022

Comments

  • RandyDandy
    RandyDandy over 1 year

    When i ping 8.8.8.8 it says: connect: Network is unreachable

    $vi /etc/resolv/.conf
    
    nameserver 8.8.8.8
    nameserver 192.168.0.5
    
    $vi /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth1
    iface eth1 inet dhcp
    
    auth eth1
    iface eth1 inet static
    address 192.168.56.101
    netmask 255.255.255.o
    
    $ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
        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: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 08:00:27:ac:81:49 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
        link/ether 08:00:27:63:e1:93 brd ff:ff:ff:ff:ff:ff
        inet 192.168.56.101/24 brd 192.168.56.255 scope global eth1
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe63:e193/64 scope link
           valid_lft forever preferred_lft forever
    
    • taifwa
      taifwa about 7 years
      You should tell us why you expect the network should be reachable... checked all connections, etc
    • chili555
      chili555 about 7 years
      How can eth1 be both static and dhcp???