1

I have two virtual machines setup in VirtualBox. One is acting as a DNS server, and has two network adapters attached to it:

  • Adapter 1: Internal Network (intnet)
  • Adapter 2: Bridged adapter (wlan0)

The DNS server is setup using Debian and DNSMasq. DNSMasq is configured to act as DHCP server and cache DNS queries. From the DNS server itself, I can ping google.com without a problem.

My second virtual machine is setup using CentOS 6.5, and has the same two adapters, however this time the bridged adapter is currently disabled. The CentOS virtual machine detects the DHCP server fine, and is given an address (192.168.5.121). From CentOS, I can ping the DNS server at 192.168.5.10, and vice-versa, the DNS server can ping the CentOS machine.

However, when I try to ping google.com from the CentOS guest, I receive:

--- google.co.uk ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2523ms

I can however, dig the google.co.uk fine from CentOS:

[developer@centos ~]$ dig google.co.uk

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> google.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31867
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.co.uk.          IN  A

;; ANSWER SECTION:
google.co.uk.       260 IN  A   173.194.41.184
google.co.uk.       260 IN  A   173.194.41.183
google.co.uk.       260 IN  A   173.194.41.191

;; Query time: 3 msec
;; SERVER: 192.168.5.10#53(192.168.5.10)
;; WHEN: Sun Feb  9 14:18:51 2014
;; MSG SIZE  rcvd: 78

My /etc/resolv.conf on CentOS is set to use 192.168.5.10 (the DNS server) as a nameserver.

The DNS server's /etc/network/interfaces file looks like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo eth1 eth0
iface lo inet loopback

# The primary network interface (VM Network)
allow-hotplug eth0
iface eth0 inet static
        address 192.168.5.10
        gateway 192.168.1.254
        dns-nameservers 127.0.0.1 8.8.8.8

# Secondary Interface (Bridged adapter)
iface eth1 inet dhcp

If anybody could offer any advice as to why the CentOS virtual machine fails to connect to google.co.uk, I would be extremely grateful!

Thanks in advance!

1 Answer 1

0

Seems pretty obvious from your setup... the CentOS box has it's bridged-adapter disabled. I would presume that's where the default route would be pointing for all things Internet, and google.co.uk resolves to 173.194.41.X addresses, so if there's no route to a subnet containing those addresses specifically through your internal adapter, then the connection goes through the default route. If that's out the disabled adapter, well it's not going to work of course.

1
  • Hey, thanks for the tip! I removed the bridged adapter and removed its network from the centOS box, but I still can't ping, even though the DNS server can. Do you know if there's something I have to setup in DNSMasq specifically to reach external addresses?
    – BnMcG
    Commented Feb 11, 2014 at 6:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .