VMware Communities
kaolson
Contributor
Contributor

tcpip between guests and host to guest when host is not connected to a network?

I think this is a routing or name-resolution issue: cant seem to get the host and two guests to talk on tcp ip reliably.

First off, apologies if I've missed an existing thread on this. Couldnt figure out how to search only Fusion forum for networking questions so essentially I just rummaged around. I have read the doc (I think) but my expected solution doesnt seem to do it.

Here's the setup...

From my host, running any common browser, I need to connect to an apache server running on one of the guests that provides the main user interface to those guests' applications.

On each guest runs an application that needs to talk to the other guest via tcp over a standard port. There is no need for the guests to get out beyond the host.

And, since its all on a notebook, I'd like this to work with minimal config changes whether or not the host happens to be connected to a network. Pretty much covered by a) on my own router or b) not connected (waiting at an airport gate or maybe at a client's site).

Running 2 guest w2k3 standard servers on os x 10.4.9 host (mbp core 2 duo) running fusion Version 1.0 (51348).

Ideally I'd like host names to work. Ie, the two guests' applications can reach each other with a gethostbyname, and the host can reach the guests by typing a name:port string into the browser's url field. Fixed ip addrs ok if it comes to that. I've distributed a hosts file among them. Also, on my personal network the router's configured to always asign the same addrs to requests from the guests' MACs (and host too, come to think of it).

1) Set the vm's to use bridged networking and fixed ip addrs. Everything worked great while the host was connected to my router's network. Guests' apps linking to each other fine and host Safari able to connect to guests' apache servers by just typing the name into the url field.

But when disconnected host from the network, the guests could still connect via tcp ip but the host could not connect to the guest's apache server using name or ip addr.

2) Set the vm's to use host-only

When the guests have fixed ip addrs they can connect to each other but the host cannot connect to the apache server. Regardless of whether the host is on/off a network.

When the guests use dhcp, nothing works.

I have not tried Fusion's NAT option since the description mentions dial-up and besides I'm shooting for using host name lookup (hosts files, gethostbyname).

Any insights much appreciated!

Thanks,

-K

0 Kudos
6 Replies
kaolson
Contributor
Contributor

Hmmm... Ok, it dawned on me to try putting in the hosts files the ip addrs assigned by the host when the guests are host-only & dhcp. Seems to work. Not sure why I didnt think of this before -- unsure whether these addrs will always be the same for each guest... ?

How does the host make up the address?

Thanks,

-K

0 Kudos
victory
Contributor
Contributor

Hi,

I'm trying to do something similar -- I wanted the ability to connect to a VM guest (OpenBSD) even if the host (Mac) wasn't attached to a routable network on any of its physical interfaces. In my case I'm using the VM to run a dedicated Postgresql server for Rails development on a MBP and want to be able to work even when disconnected from the rest of the world.

While I don't have a complete answer for you, I can tell you what seems to be working for me so far:

- Use host-only networking mode.

- From the host (Mac) side, open a shell/Terminal and use 'ifconfig -a' to see what subnet the virtual 'vmnet1' interface has assigned to it. (For example, on my machine it's 172.16.86.1)

- Use this info to configure:

-- guest's IP to an address on the same subnet within the .3 - .127 range (e.g. 172.16.86.10)

-- guest's gateway/router address to the address of the vmnet1 interface on the host Mac side (e.g. 172.16.86.1)

-- optionally, add IP/names to name-mapping files both in the VM and out on the host (e.g. /etc/hosts or LMHOSTS depending on the OS)

With this setup, I'm able to access the VM from the Mac side and vice-versa, even when the MBP is completely disconnected from any physical networks.

A few comments:

- Before using this method, I'd tried messing with Fusion's virtual dhcp server as well as OpenBSD's considerable dhcp client options, without success. At one point while still trying to use a dhcp-assigned address, I'd even considered using zeroconf/rendezvous/bonjour/howl/avahi running within the guest to see if I could get it to advertise itself back out to the host.

- Another method I'd considered (and abandoned) was running the VM in bridged mode and constructing a (physical) Ethernet loopback connector or even toting a portable network switch around, just to activate the host Mac's media layer. Perhaps this would have worked, but it struck me as a far too klugey solution for something that should be doable entirely in software.

- I'm not sure exactly how/when Fusion chooses the network addresses for vmnet1/8. (i.e. I don't know if it's when Fusion is first installed, if it's every time the vmnet-* daemons are relaunched, if it's only when

/Library/Application Support/VMware Fusion/vmware-config-net.pl

is run or when the vmnet1 interface is brought up with ifconfig). In short, the 172.16.x.x addresses may be prone to change between host reboots. (See Dave Parson's guide below for more info)

- Just a reminder that host-only mode means that the VM can't see beyond the host, nor can anything outside the host access the VM. However since my intention was to use this setup even when I wasn't connected to an external net, this didn't matter to me.

- According to the Workstation 6 (see below) manual, addresses on the vmnet1 and vmnet8 interfaces within the x.x.x.3 to x.x.x.127 are supposed to be for statically-assigned ones. I'm taking this to mean the user can choose one of these without conflicting with ones handed out by the Fusion dhcp server.

- You may not actually need to specify a gateway/router address within the VM since it's just working within a local subnet. However some OSs get snarky if you don't give one.

- If you don't want to rely on editing /etc/hosts or LMHOSTS, I suppose one could take things further and run a nameserver within the VM or on the host instead.

Helpful resources:

- The Workstation 6 manual (pdf). While Workstation and Fusion are obviously not identical products, they share much of the same functionality and this document provides quite a bit of insight into their design. (The networking chapter is extremely helpful)

- Dave Parson's Fusion Networking Guide . In particular, it tells how to reconfigure Fusion's dhcp server to a different network range. While this was an extremely useful guide, I tend to prefer modifications that don't involve edits to global application settings. (e.g. I usually try to get things working the way I want by making changes within the VM itself or its .vmx)

Hope some of this helps.

kaolson
Contributor
Contributor

Thanks. Seems to be ok with host only and dhcp. Thanks for those links, had a look and they seem very useful.

-K

0 Kudos
Matt_Atom
Contributor
Contributor

I'm really surprised not to find more posts about this. Seems like it would be a pretty common request, and something that should be easy to do, but I'm not having much luck. I'm working on a macbook pro, running ubuntu server 7.04 and windows xp as guests. Whenever I switch to host-only in both, I'm getting an error message:

<blockquote>

"Interface vmnet1 is not marked "UP".

This should be done at boot time; pleae check your installation and try again after you have corrected this.

Failed to connect virtual device Ethernet0."

<blockquote>

Anyone know why this is happening or how can I get these two to use host-only?

0 Kudos
victory
Contributor
Contributor

I'm not sure if this suggestion is helping you or causing you more trouble, but you might try do just as the error message indicates -- activating the vmnet1 interface.

If you want to go for it, open a terminal/shell window (on the Mac) and type:

to bring up that interface and see if that helps anything. (you'll need to enter your password as this is a prvileged operation)

0 Kudos
Matt_Atom
Contributor
Contributor

Thanks for the reply. Just 'up'ing fixed it. I'm not sure why it isn't configing right. It resets to down every time I reboot, so in boot.sh,

under line: 584, after ifconfig vmnet1 inet "$hostaddr" netmask "$netmask" I added the following, and that seems to work:

ifconfig vmnet1 up

Thanks again!

0 Kudos