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.

I believe the correct networking option is to use bridged so that the guest OS gets its own IP address, but I'm still only able to ssh by ip address.

share|improve this question
    
I do not want to add an entry to the host file on the host os because I want the guest OS to be able to get a dynamic address when I move between work and home networks. –  antony.trupe Jun 30 '09 at 17:25
add comment

5 Answers

If /etc/hosts is out of the question, you have to put them in the respective DNS zones for your home and work networks.

Alternatively, if you don't need to access the VM from outside the host machine, you could use a private host-only network which has the same network addresses regardless of where you are, or you could even use port forwarding, depending on what you plan to do with the VM.

share|improve this answer
add comment

In order to get to it by name, that name has to be registered in DNS or the name has to be in your hosts file. If the address is being dynamically assigned by DHCP, then DHCP can be configured to do the registration. If you don't have control of DNS or DHCP, then a hosts file is the only option.

share|improve this answer
add comment

You could try to run Avahi on the CentOS 5 guest and have it respond to mDNS queries, and hopefully your host os will query .local via mDNS/ZeroConf. I haven't tested this, but it's worth a shot if you don't have control over DNS/dhcp.

It's important that you refer to the host with the .local domain, otherwise this will likely not end up with mDNS but rather have search-domain appended to it and the query sent to the configured nameserver(s). I.e. ssh box would fail, where ssh box.local would work.

share|improve this answer
add comment

I just put it in my hosts file, then make sure the VM has a static IP assigned by the hypervisor, such as http://www.stereoplex.com/two-voices/vmware-fusion-guests-with-a-static-ip

Oh, you're bridged. DNS should work assuming it works with other "real" machines on your LAN. Make sure RHEL is configured to use whatever provides DNS on your LAN. At work, I would assume this to be easier. At home, you'll need a DNS server. Some SOHO routers can do this.

share|improve this answer
add comment
up vote 1 down vote accepted

edited /etc/dhclient-eth0.conf to have the line

send host-name "atrupewebdev";

edited /etc/sysconfig/network-scripts/ifcfg-eth0 to have the line

DHCP_HOSTNAME=atrupewebdev

edited /etc/sysconfig/network to have the line

HOSTNAME=atrupewebdev

edited /etc/hosts to have the line

127.0.0.1 atrupewebdev ...

then executed

service network restart
share|improve this answer
add comment

Your Answer

 
discard

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.