Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My physical PC is running 2 VMs on virtualbox. Both of the VM's are linux 64 bit.

I am going through this tutorial:

http://www.cyberciti.biz/faq/rhel-centos-fedoracore-linux-network-card-configuration/

in order to expose both of their IP's so that they can speak to each other.

Mike Schwager November 25, 2009 at 10:55 pm Whoops! In section 3, you forgot about editing /etc/hosts. I believe RedHat comes complete with the system’s host ip address set up in /etc/hosts. Don’t forget to give it a look.

I agree with Mike because after I looked into the /etc/hosts files, it has just default localhost stuff in it.

How should I reconfigure the hosts file?

share|improve this question

closed as off topic by Zoredache, Ward, John Gardeniers, Brent Pabst, mdpc Dec 11 '12 at 17:21

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is this in a professional setting? If yes, then update your DNS server to reflect the correct settings. The hosts file should almost never be touched in a network of any size. –  Zoredache Dec 10 '12 at 23:34
    
In small cluster settings or local storage networking, we still manage the /etc/hosts file. –  ewwhite Dec 10 '12 at 23:36

2 Answers 2

up vote 2 down vote accepted

This is not mentioned in your question (and the link assumes your OS is not in a VM), but perhaps you haven't configured VirtualBox to handle the network card properly.

This can be done by shutting down the VMs, then right-clicking each and choose Settings. Go down to Network and finally go to the Adapter 1 tab.

By default, VirtualBox sets the network adapter to use NAT, which (in layman's terms) means it gets a private IP and shares the host's network connection, but it doesn't have any information beyond that. You are probably looking to either use Bridge Adapter or Internal Network.

Using Bridged Adapter means it will reach outside to your router and act as a separate device on the network, as if it were a different physical box on your LAN. It will be able to get an IP address from your router/DHCP server.

Internal Network creates a virtual, internal network just for VirtualBox (based on the Name field). This configuration is a bit more secure, but it can be harder to configure because you won't have access outside of VirtualBox to the internet or your LAN. You also won't have a DHCP server set up, so you'll need to assign IPs manually. (It's outside the scope of this answer, but you can set up a 3rd VM with PF Sense as a router and give it BOTH a Bridged Adapter interface and an Internal Network, and it will act as a private router for your VMs. This is the most secure option.)

In either case, as long as you use the same method for both VMs, you will have IPs for them and they will be able to connect to each other.

share|improve this answer

Assuming you have server1 and server2 and domain, abc.com, your /etc/hosts file should look like the examples given here:
Setting the hostname: FQDN or short name?

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.1.1.3               server1.abc.com server1
10.1.1.4               server2.abc.com server2

The short hostname of the system should also exist in /etc/sysconfig/network, as per this question.

share|improve this answer
    
thanks so much! this is just a small cluster test env for cloudera. what would my servers be? can i just make up a name server1.domain.com ?? –  Yuck Dec 10 '12 at 23:38

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