I am using Centos 7 running in Oracle VM VirtualBox Manager. I wanted my windows (host) to be able to ping Centos 7 (guest) so I changed the network settings in VM to use host-only network adapter which worked fine as my windows can ping vm machine ip but VM machine has not network connection. It seems to be an issue with default gateway, how do set the default gateway? what is the correct value of default gateway? so that there is network connection available to vm machine.Network screenshot which does not have default route and DNS[root@hostname sysconfig]# ifconfig -adocker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0        inet6 fe80::42:48ff:fe73:32ae  prefixlen 64  scopeid 0x20<link>        ether 02:42:48:73:32:ae  txqueuelen 0  (Ethernet)        RX packets 1086312  bytes 190220822 (181.4 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 2244812  bytes 1153561488 (1.0 GiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255        inet6 fe80::a00:27ff:fe57:e658  prefixlen 64  scopeid 0x20<link>        ether 08:00:27:57:e6:58  txqueuelen 1000  (Ethernet)        RX packets 1083  bytes 112900 (110.2 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 166  bytes 24915 (24.3 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10<host>        loop  txqueuelen 0  (Local Loopback)        RX packets 70229  bytes 8733878 (8.3 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 70229  bytes 8733878 (8.3 MiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth0022793: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::541a:3bff:fefe:40fc  prefixlen 64  scopeid 0x20<link>        ether 56:1a:3b:fe:40:fc  txqueuelen 0  (Ethernet)        RX packets 206  bytes 15300 (14.9 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 5850  bytes 272760 (266.3 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth0333914: flags=4098<BROADCAST,MULTICAST>  mtu 1500        ether 16:78:ed:04:52:5e  txqueuelen 0  (Ethernet)        RX packets 68480  bytes 84562622 (80.6 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 90298  bytes 14502209 (13.8 MiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth06f16da: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::4aa:47ff:fe36:c394  prefixlen 64  scopeid 0x20<link>        ether 06:aa:47:36:c3:94  txqueuelen 0  (Ethernet)        RX packets 51  bytes 4678 (4.5 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 5823  bytes 267358 (261.0 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth16e581d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::2cb7:66ff:fe1a:a627  prefixlen 64  scopeid 0x20<link>        ether 2e:b7:66:1a:a6:27  txqueuelen 0  (Ethernet)        RX packets 8  bytes 648 (648.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 5769  bytes 262582 (256.4 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth1ecf198: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::2022:c4ff:fe1c:9ab5  prefixlen 64  scopeid 0x20<link>        ether 22:22:c4:1c:9a:b5  txqueuelen 0  (Ethernet)        RX packets 8  bytes 648 (648.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 5773  bytes 262882 (256.7 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0veth8536f91: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::ac21:2fff:fe0e:87e6  prefixlen 64  scopeid 0x20<link>        ether ae:21:2f:0e:87:e6  txqueuelen 0  (Ethernet)        RX packets 841994  bytes 71927871 (68.5 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 1841996  bytes 992110236 (946.1 MiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0vethda88d72: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet6 fe80::f44c:52ff:fe6c:b856  prefixlen 64  scopeid 0x20<link>        ether f6:4c:52:6c:b8:56  txqueuelen 0  (Ethernet)        RX packets 8  bytes 648 (648.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 5759  bytes 261746 (255.6 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255        ether 52:54:00:ce:19:b8  txqueuelen 0  (Ethernet)        RX packets 0  bytes 0 (0.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 0  bytes 0 (0.0 B)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500        ether 52:54:00:ce:19:b8  txqueuelen 500  (Ethernet)        RX packets 0  bytes 0 (0.0 B)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 0  bytes 0 (0.0 B)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0[root@hostname network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 TYPE=EthernetBOOTPROTO=dhcpDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=enp0s3UUID=dc80dadc-3072-428f-888f-25dc8dcd8ca9DEVICE=enp0s3ONBOOT=no[root@hostname network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-loDEVICE=loIPADDR=127.0.0.1NETMASK=255.0.0.0NETWORK=127.0.0.0[root@hostname network-scripts]# cat /etc/resolv.conf # Generated by NetworkManager# No nameservers found; try putting DNS servers into your# ifcfg files in /etc/sysconfig/network-scripts like so:## DNS1=xxx.xxx.xxx.xxx# DNS2=xxx.xxx.xxx.xxx# DOMAIN=lab.foo.com bar.foo.com[root@hostname sysconfig]# ip route show172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.0.1 192.168.56.0/24 dev enp0s3  proto kernel  scope link  src 192.168.56.101  metric 100 192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 [root@hostname sysconfig]# routeKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0192.168.56.0    0.0.0.0         255.255.255.0   U     100    0        0 enp0s3192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0[root@hostname sysconfig]# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0192.168.56.0    0.0.0.0         255.255.255.0   U     100    0        0 enp0s3192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0[root@hostname sysconfig]# ifconfig enp0s3enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255        inet6 fe80::a00:27ff:fe57:e658  prefixlen 64  scopeid 0x20<link>        ether 08:00:27:57:e6:58  txqueuelen 1000  (Ethernet)        RX packets 1070  bytes 110928 (108.3 KiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 164  bytes 24513 (23.9 KiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0[root@hostname sysconfig]# netstat -nrKernel IP routing tableDestination     Gateway         Genmask         Flags   MSS Window  irtt Iface172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0192.168.56.0    0.0.0.0         255.255.255.0   U         0 0          0 enp0s3192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0[root@hostname sysconfig]# ip route list172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.0.1 192.168.56.0/24 dev enp0s3  proto kernel  scope link  src 192.168.56.101  metric 100 192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 [root@hostname sysconfig]# ping google.comping: unknown host google.com[root@hostname sysconfig]# nslookup google.com;; connection timed out; trying next origin;; connection timed out; no servers could be reached
Centos 7 running on VM how to set default gateway - ping google.com fails
linux;networking;virtualbox;ping;gateway