Hi,
My goal: for both VMs and host to communicate and VMs to have NAT-ed internet access through host
My setup:
- host os: macOS
- the DHCP inside Host-only Network configuration inside VirtualBox is disabled (I'm using static IP on every VM to access them from host OS via SSH/Apache later)
- Host-only Network: 10.0.2.0/255.255.255.0
- vm1:
-- OS: Slackware 13.2 or Slackware 14.2
-- NIC1: NAT (IP: returned by DHCP; always 10.0.2.15)
-- NIC2: Host-only Network (IP: static inside VM; always 10.0.2.4)
- vm2:
-- OS: Centos 7.6
-- NIC1: NAT (IP: returned by DHCP; always 10.0.2.15)
-- NIC2: Host-only Network (IP: static inside VM; always 10.0.2.6)
Here is what happens:
The vm1 (Slackware) works perfectly:
- eth0 interface uses NIC1 (NAT)
- eth1 interface uses NIC2 (Host-only Network)
- the VM can: use internet
- the VM can: connect back to host via 10.0.2.1 IP (ping returns: "64 bytes from 10.0.2.1: icmp_req=1 ttl=64 time=0.139 ms")
- the host OS can: connect to VM via 10.0.2.4 IP address
The vm1 (Slackware) works partially and very unusual:
- enp0s3 interface uses NIC1 (NAT)
- enp0s8 interface uses NIC2 (Host-only Network)
- the VM can: use internet
- the VM can't connect back to host via 10.0.2.1 IP (ping returns: "From 10.0.2.15 icmp_seq=1 Destination Host Unreachable")
- the host OS can't: connect to VM via 10.0.2.4 IP address
- if I attempt to ssh to 10.0.2.4 IP address, then I end up connecting to host (which isn't accessible by 10.0.2.1)
I'm not sure why it happened, but I've never faced such an issue with Slackware OS.
So here is again what I consider odd/non-working in CentOS 7.6 VM:
1. inability to access other VMs
2. inability to access host os
3. when pinging host OS I'm getting responses from NAT IP: 10.0.2.15
This does sound like a network configuration error on CentOS, but I have no idea where.
Thanks.
[Resolved] CentOS 7 VM can't communicate to host
[Resolved] CentOS 7 VM can't communicate to host
Last edited by socratis on 16. Sep 2019, 19:52, edited 2 times in total.
Reason: Marked as [Resolved].
Reason: Marked as [Resolved].
-
- Volunteer
- Posts: 2560
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: CentOS 7 VM can't communicate to host
You cannot use the same IP subnet for two different network interfaces.
Re: CentOS 7 VM can't communicate to host
I'm using "Attached to: NAT", where you can't specify subnet. I have no idea, why ".15" IP from subnet of "Host-only Network" subnet is being used. As I've said before it worked perfectly for other OSes, but not CentOS.
You can specify subnet for "Attached: NAT Network" only. To experiment I've tried to use "NAT Network" as well, but for unknown reasons "NAT Network" + "Host-only Network" result in 10.0.2.4 IP being used on both interfaces via DHCP.
You can specify subnet for "Attached: NAT Network" only. To experiment I've tried to use "NAT Network" as well, but for unknown reasons "NAT Network" + "Host-only Network" result in 10.0.2.4 IP being used on both interfaces via DHCP.
-
- Volunteer
- Posts: 2560
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: CentOS 7 VM can't communicate to host
You need to use another subnet for the host-only network, for example 10.0.3.x instead of the 10.0.2.x of the NAT network.
Also make sure that your host-only network adapters use a /24 = 255.255.255.0 netmask.
Also make sure that your host-only network adapters use a /24 = 255.255.255.0 netmask.
Re: CentOS 7 VM can't communicate to host
Ah, so that NAT network is using 10.0.2.0/255.255.255.0 all the time and I was unlucky to pick same subnet for my Host-only Network as well?
I'll try changing Host-only Network from 10.0.2.0/255.255.255.0 to 10.0.3.0/255.255.255.0 later today and see how it goes.
I'll try changing Host-only Network from 10.0.2.0/255.255.255.0 to 10.0.3.0/255.255.255.0 later today and see how it goes.
-
- Volunteer
- Posts: 5668
- Joined: 14. Feb 2019, 03:06
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Linux, Windows 10, ...
- Location: Germany
Re: CentOS 7 VM can't communicate to host
Yes, you were unlucky (or not reading the User Manual ).aik099 wrote:Ah, so that NAT network is using 10.0.2.0/255.255.255.0 all the time and I was unlucky to pick same subnet for my Host-only Network as well?
Note that the NAT networking may automatically use 10.0.2.0/255.255.255.0 up to 10.0.9.0/255.255.255.0 (for up to 8 NAT networks). So as not to be unlucky again in the future, I would choose yet another network like 10.1.2.0/255.255.255.0.
Re: CentOS 7 VM can't communicate to host
Totally missed that part from the docs (Chapter 6. Virtual Networking). After you've told me I was able to find a link to "9.10.1. Configuring the Address of a NAT Network Interface", where that all was explained.
Thank you.
---
Note for VirtualBox developers:
When creating "Host-only Network" please inform user, that chosen submit will conflict with NAT subnet (both default ones in 10.0.x.0 and user defined in any of VMs already created).
Thank you.
---
Note for VirtualBox developers:
When creating "Host-only Network" please inform user, that chosen submit will conflict with NAT subnet (both default ones in 10.0.x.0 and user defined in any of VMs already created).
Re: CentOS 7 VM can't communicate to host
It worked perfectly. Thank you once again.
If I would have known, that I could post on these forums before I've spent 2 days on solving this problem myself
If I would have known, that I could post on these forums before I've spent 2 days on solving this problem myself
-
- Site Moderator
- Posts: 27330
- Joined: 22. Oct 2010, 11:03
- Primary OS: Mac OS X other
- VBox Version: PUEL
- Guest OSses: Win(*>98), Linux*, OSX>10.5
- Location: Greece
Re: CentOS 7 VM can't communicate to host
Or read the User Manual!aik099 wrote:If I would have known, that I could post on these forums before I've spent 2 days on solving this problem myself
You should have a searchable PDF included with your installation. If not, there's the on-line manual in PDF format, again searchable. Take advantage of that fact, and use it to search the PDF for the terms that interest you.
Marking as [Resolved].aik099 wrote:It worked perfectly.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.