2

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.

user9517
  • 115,471
  • 20
  • 215
  • 297
antony.trupe
  • 131
  • 6
  • 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

5 Answers5

4

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.

Alex
  • 6,603
  • 1
  • 24
  • 32
1

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.

Kjetil Joergensen
  • 5,994
  • 1
  • 27
  • 20
1

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.

churnd
  • 4,077
  • 5
  • 34
  • 42
1

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
antony.trupe
  • 131
  • 6
0

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.

Sven
  • 98,649
  • 14
  • 180
  • 226