NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Issues related to configuring your network
Post Reply
ranjithcr2
Posts: 4
Joined: 2017/11/21 16:04:23

NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by ranjithcr2 » 2017/11/21 16:41:57

Hi Friends,
This is my 1st post in this forum...i conveny my thanks in advance.

I have installed centos7 in virtual box with "NAT network" option to configure it. I did a minimal installation of centos OS.

When i tried to ping 8.8.8.8, its says destination host unreachable.
even i cannot ping to the default gateway.
I hope all the settings that i have dine is correct as showed below:

#/etc/sysconfig/network-scrips/ifcfg-enp0s3

Device = ethernet
DEVICE=enp0s3
HWADDR=AD:AF:3E:43:AD:AE
BOOTPROTO=none
DEFROUTE=yes
IPADDR=10.0.2.7
NETMASK=255.255.255.0
GATEWAY=10.0.2.2
DNS1=8.8.8.8
NM_CONTROLLED=yes.


But when i changed the network configuration to bridged mode, its started to ping.
Please let me know what wrong happens on my system settings.

Thanks for your valuable Replay and advice..

ranjithcr2
Posts: 4
Joined: 2017/11/21 16:04:23

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by ranjithcr2 » 2017/11/21 17:25:17

hai friends,
Please help me to resolve thos problem..

I am adding here one more point:

system Ip=10.0.2.7 and Gateway =10.0.2.2

But when i ping 8.8.8.8

its says as below:

from 10.0.2.7 icmp_seq=220 destination host is unreachable

so my concern is here, why its pinging from ip address instead of gateway???

do i have any mistake in my route table?

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by jlehtone » 2017/11/21 17:54:15

I don't know VirtualBox, but it's website writes:
The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox.
DHCP.

Why on earth do you have a static configuration in the guest if DHCP is available?

ranjithcr2
Posts: 4
Joined: 2017/11/21 16:04:23

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by ranjithcr2 » 2017/11/22 10:50:34

hi @jlehtone, Thanks for your reply...
Yes it will get the DHCP configuration...But as a learner, I have to configure this all manually to understand how things are working inside.

I thought , i will found a answer quickly from this forum as its a official one. But the sad part ,no one is really care about the query even after 30 views.

northpoint
Posts: 107
Joined: 2016/05/23 11:57:12

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by northpoint » 2017/11/22 11:25:37

Normally I will configure the guest OS in VB with a bridged network connection.

I have a separate firewall box that acts as DHCPD also. My VB guest gets its ip from the firewall box in bridged mode.

Is there some reason you do not want to use bridged mode for your guest os?
Ryzen x1800 * Asus x370 Pro * CentOS 7.4 64bit / Icewarp /

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by jlehtone » 2017/11/22 13:34:51

ranjithcr2 wrote:Yes it will get the DHCP configuration...But as a learner, I have to configure this all manually to understand how things are working inside.
Learning is good, but I'd start with the DHCP. That is the default in CentOS 7 too. I would let the system get config from VB DHCP and study what settings does that give.

For example, does the VB really use address 10.0.2.2?

Furthermore, with NetworkManager one is not supposed to touch any config files. One is supposed to use nmcli, nmtui, or a GUI applet.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by TrevorH » 2017/11/22 13:53:16

Furthermore, with NetworkManager one is not supposed to touch any config files. One is supposed to use nmcli, nmtui, or a GUI applet.
One of the advertised updates to NM in el7 was that you can now edit config files manually and NM will no longer immediately put them into effect until you run (iirc) nmcli load /etc/sysconfig/network-scripts/ifcfg-whatever. I take it to mean that if they let you do that then updating the files manually is ok.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

ranjithcr2
Posts: 4
Joined: 2017/11/21 16:04:23

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by ranjithcr2 » 2017/11/22 14:27:49

@ jlehtone......yes 10.0.2.2 willl work with NAT network..

@TrevorH

You know what, i have created the same configuration in my office laptop, but its not working with my personal laptop.

I will explain what i have to do exactly..

i want to create a network in 192.168.0.x , and another one 10.0.2.x . so that this both network is isolated.
and i have to create a router in between this with the centos os. through this router i can talk with that two different network .

Please help me to create this lab environment in vm box. as i said i did it once in my office laptop. but in my personal laptop having the problem when i try to ping 8.8.8.8 by nat network configuration.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: NAT Network did not allowing to connect internet in Virtual Box while using Centos7

Post by jlehtone » 2017/11/23 13:05:57

ranjithcr2 wrote:NAT Network did not allowing to connect internet
ranjithcr2 wrote:yes 10.0.2.2 willl work with NAT network.
Those statements are conflicting. Either VirtualBox network functions, or does not.
ranjithcr2 wrote:want to create a network in 192.168.0.x , and another one 10.0.2.x . so that this both network is isolated.
You want to create with VirtualBox two (virtual) isolated subnets. This is a VB task.
Note: Isolation means "no access to internet".
ranjithcr2 wrote:i have to create a router in between this with the centos os.
Assuming that you have two VB subnets, you attach a VM to both. This is a VB task.
VM will have a CentOS configured to route between the two subnets.

In order to "lab test" the routing you do need two more VM's, one on each subnet.

Post Reply