My setup: I have 2 virtual box machines that run CentOS, Server1 and Server2.
Server1 is configured with 2 network interfaces which are enp0s3 and enp0s8. enp0s3 is connected to VM NAT network with network ID 10.0.2.0 and enp0s8 is connected manually to network with id 192.168.1.0.
Server2 has only 1 interface which is enp0s3 and is on the same network as server1's enp0s8 (192.168.1.0). So server one is host 1 and server2 is host 2 (192.168.1.1, 192.168.1.2).
The problem: While on server1, I tried to ping google.com to see if I have network connectivity. It didn't work. Therefore, I took the following step in order to troubleshoot it.
1) I did ping -I enp0s3
(to ping with NAT connected interface), and it didn't work
2) I did ping 8.8.8.8
and it worked! so I thought this is some DNS problems
3) And since I don't know anything about DNS yet, I went in to /etc/resolv.conf
and changed the nameserver to google public DNS server. It worked, so ping google.com works now!
4) I could leave it like that but I wanted to narrow down the source of the problem so I went ahead and reverted the change in /etc/resolv.conf
back to 192.168.1.1
5) I asked myself, why my DNS server is on a private network which is not even connected to the outside world. At that point, I went and checked my host machine's IP address, and it was 192.168.1.1
6) After discovering that my host machine has same network id as my private network in Virtual box I thought that it may cause some conflicts so I went and changed private network id to 192.168.3.0 and that solved everything.
But... The question I still have what exactly causes this problem.