Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Good evening,

I have to configure different Virtualbox guest systems (ubuntu) via Host-Only Network Adapter. The host network is configured with IP "".

The clients are configured like this (/etc/network/interfaces):

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static

        up ip addr add dev eth0
        down ip addr del dev eth0

IP forwarding is activated, port forwarding is done via

iptables -t nat -I PREROUTING -d -j DNAT --to
iptables -t nat -I POSTROUTING -s -j SNAT --to

With this configuration, I'm able to ping the guest from a foreign IP and to ping the foreign IP even using DNS.

The problem is the following: I want to connect the guest systems to each other. This works great, if the local IPs are used (,, ...). But if I want to use a DNS system which reports the global IP address (, connection is not possible. If I use "ping" on Guest with local IP "", I get the correct IP "" but then I get a timeout. If I ping "" (the local IP) however, everything works great. All foreign IPs (e.g. can be pinged without problems.

So my question is: how is it possible to connect the Guest systems to each other without using the local IPs but the IPs given by DNS?

Thanks a lot!


share|improve this question

migrated from Nov 7 '10 at 23:22

This question came from our site for professional and enthusiast programmers.

"connect the Guest systems to each other without using the local IPs but the IPs given by DNS"

Then it would not be "Host Only" mode, but "Bridged" instead. Also, DNS does not hand out IPs, but DHCP will.

share|improve this answer
Yes, that is correct. Unfortunately, I'm not allowed to use Bridged Network configuration because the network card would have different mac addresses. This is explicitly forbidden. Therefore I have to use the Host-Only method with port forwarding. – Mathias Bank Nov 8 '10 at 7:40
In that case, the answer to your question is that it is not possible. You can set up an internal DNS amongst the virtual machines or setup host files on each system with the respective 192.168.7.x addresses. – user48838 Nov 8 '10 at 7:58
Ok, I have thought of that. But that is a lot of work for different and changing domains. Is there a possibility to still use DNS and rewrite the IP address if the DNS answer is an IP of a local server? For example if I get the IP by DNS to rewrite it on the fly to A hook or something like this. – Mathias Bank Nov 8 '10 at 10:58
You can enter the 192.168.7.x systems into your "regular" DNS, if the those IP assignments are not used elsewhere across your environment. Lookups against those hostnames will then result in those IP addresses, which will not respond on the "regular" network, but will be "valid" for the "Host Only" network lookups. – user48838 Nov 8 '10 at 12:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.