VMware Communities
florin65
Contributor
Contributor
Jump to solution

DISPLAY env var for linux guest

Hi,

I got a linux guest on an XP host using VMWare Player with tools. The host is connected to a network that has linux machines attached.

I can succesfully telnet from within the guest to other linux machines on the network. What I cannot do is run a graphical application on one of these remote machines. It basically boils down to being unable to set the DISPLAY environment variable on the remote machine to something that will allow the remote machine to display things on my linux guest.

Is it possible to do what I am trying to do?

Thanks, Florin

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Use ssh with X11 forwarding...

ssh -l

View solution in original post

0 Kudos
15 Replies
oreeh
Immortal
Immortal
Jump to solution

Basically you need:

X11 running on your guest

allow X11 sessions from the other systems (see the xhost man page)

after logging in to another system set the display variable before starting the app (set DISPLAY=..... ; export DISPLAY)

0 Kudos
florin65
Contributor
Contributor
Jump to solution

Hi,

My problem is at the third step: what value should I set the DISPLAY variable?

If I would be logged on a machine named foo and I would remote login on a machine named bar then within a telnet session on bar I would set DISPLAY to foo:0.0

If I would be logged on a VNC session on machine foo (lets say foo:5) and then telnet to bar then I would set the DISPLAY to foo:5.0

But I am inside a vmplayer session. What is my display?

Thanks, Florin

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

The DISPLAY variable consists of the hostname (or IP), the displaynumber and the screennumber.

The last two are usually zero, so it should look like

set DISPLAY=192.168.1.1:0.0

The same applies to a VMware Player session. You only have to make sure you have X11 installed and running.

On Windows you can use Cygwin.

Message was edited by: oreeh

0 Kudos
florin65
Contributor
Contributor
Jump to solution

Hi,

I used the ifconfig utility to extract what I think is the IP address (I picked the inet addr value). That value doesn't work. From the remote machine I cannot even ping that address (but it's clear that networking works because I am able to telnet to that remote machine).

Is there some other IP address that I should be using? Or let's rephrase the problem:

From within the guest I can ping machines on the network. What IP address should I be using so I can ping my guest from the other machines?

Thanks, Florin

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

That most likely is an issue with the selected VMnet.

I assume you use NAT but in your case you should use bridged.

florin65
Contributor
Contributor
Jump to solution

Hi,

You are right, I used NAT. I switched to bridged and rebooted the guest machine. Unfortunately, now I don't have any network access. The internet and the other local machines that were previously reachable are now unreachable.

1. Do I have to do something extra to get the network running under bridged?

2. Should I understand that using NAT is not possible for other machines in the network to login on my guest?

Thanks, Florin

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

1. Do I have to do something extra to get the network running under bridged?

Configure the VM to use the correct IP address, subnet mask, DNS and gateway in the network.

If unsure your network admin should be able to give you the required data.

2. Should I understand that using NAT is not possible for other machines in the network to login on my guest?

Exactly. Using NAT your VM can connect to other hosts but other hosts can't connect to your VM.

florin65
Contributor
Contributor
Jump to solution

Hi,

Thanks for the reply.

1. Should I configure the VM to use the IP address of the host? The host is an XP machine and I can run ipconfig to get the data.

2. How do I configure the VM for networking? Messing with vmplayer or the guest OS options?

Thanks, Florin

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

1. Should I configure the VM to use the IP address of the host?

No! Every system in a network has to use a unique IP!

2. How do I configure the VM for networking? Messing with vmplayer or the guest OS options?

Guest OS options.

0 Kudos
florin65
Contributor
Contributor
Jump to solution

Thanks,

Let's see if I understand this problem. Under bridged networking my guest OS is like another machine in the network (so my computer is seen as two computers although it has a single network card). Therefore, the guest OS is making a request to the domain server (and not to my host computer) for an IP address. So for this to work I need to tell the guest OS where to go to request an IP address and then to make sure that the domain server will accept my guest client to connect by giving it an IP address.

Under NAT networking the guest OS makes request only to the host who translates for it. Therefore network access is easy but other computers on the network cannot distinguish between my guest and my host with all the problems associated.

Is that a reasonably correct explanation of what needs to happen?

Thanks, Florin

0 Kudos
oreeh
Immortal
Immortal
Jump to solution

Yes that explains it very well.

If you are using DHCP you only need to make sure that the DHCP server assigns an IP to the VM (and of course configure the VM to use DHCP).

0 Kudos
admin
Immortal
Immortal
Jump to solution

Use ssh with X11 forwarding...

ssh -l

0 Kudos
florin65
Contributor
Contributor
Jump to solution

Hi,

I don't want to sound ungrateful but to what question is this the answer?

Thanks, Florin

0 Kudos
admin
Immortal
Immortal
Jump to solution

That was an answer to your initial question.

If you use ssh instead of telnet, you get the X forwarding for free and then you can run a graphical X client on a remote machine and have the contents presented on your local X server. This can happen without any sort of monkeying around with network setup, so long as your VM running the X server can ssh to the machine you want to run the X client on.

0 Kudos
florin65
Contributor
Contributor
Jump to solution

Wow, that really worked. Thanks, Florin

0 Kudos