Saturday, December 15, 2012

Success Through a Failed Attempt to Set up an Xserver Environment

When you rsh into a raspberry Pi, the splash screen includes the following line:

   Type 'startx' to launch a graphical session

I've logged into headless machines before and set up the DISPLAY variable so that I could start an Xserver and have all of the graphical output directed to a machine with a real display device.  This is pretty vanilla Unix stuff, but it led to some other mildly interesting discoveries about my particular VM-based environment.

When I did an ifconfig, it revealed that my IP address was 192.168.91.143.  I was on a different subnet than the rest of my network.  I could ping my Ubuntu guest in at this IP address from my Windows 7 base environment, but the response times were very sluggish - ranging from 500 MS to well over a second.  Nothing actually timed out, but it wasn't optimal.  I could also ping my PIs from Windows 7, and things there seemed pretty normal.

For some reason though, I couldn't reach my Ubuntu guest from the PIs.  This means that I wouldn't be able to use this guess as an X client, and have it receive graphical sessions from the PIs.  Why I could go the other direction from Ubuntu to the PIs is beyond me.  There are network details here that I don't understand, and don't really plan to find out.

It then occurred to me that these behaviors are probably the result of the default network connection that VMware and most other give you - Network Address Translation (NAT).  This maps the IP address of the guest system to the underlying IP address of the host machine so that they share an IP address as far as the external network sees them.  Presumably this means that somewhere in the stack, my 192.168.91.143 address that Ubuntu sees, gets mapped to the 192.168.1.102 address of my Windows 7 environment.  All of this address translation is probably why performance suffers when I Ping Ubuntu from Windows.

I tried switching to a bridged configuration to see what would happen.  I've had bad experiences with this in the past under KVM and VirtualBox - both of which not only didn't work properly, but they left my guest system flopping around like a fish out of water.

This time however, everything worked as I had expected.  My IP address changed to 192.168.1.118, so I was on the same subnet as everyone else.  I could reach my Guest system from the PIs, and the apparent performance issues I had between Windows and Ubuntu vanished.  VMware was solid here, and life is good - almost.

I exported my DISPLAY variable from one of the PIs to my new Ubuntu IP address, and attempted to start an Xserver via startx.  It still didn't work.  At this point, I've decided to put this effort on the shelf.  It isn't strictly needed for what I want to do right now.  This exercise was a fruitful one though, because I'm not running a bridged connection that I think will give me more of what I want in terms of performance and configuration.

I'll be back to this later though.

No comments:

Post a Comment