Hack 15. Control Your Computer from Your Palm

Have you ever wanted to do something on your computer from across the room? How about from the other side of the world?

It can be useful to be able to access your desktop machine remotely. You could check server logs, restart failed services, or even post to your weblog. If you have a home network, you can set up all of your computers so that they are accessible remotely.

Virtual Network Computing (VNC) is an open source application that is designed to allow one machine to control another machine over a network. It was originally developed at Bell Labs. VNC is also useful for collaboration. Multiple viewers (clients) can connect to the same server. Each viewer has its own cursor. You can use these cursors to point to content on the remote machine. The viewers display the cursors for all of the other viewers as well. Each cursor is displayed differently from the others so you can tell them apart.

The server side comes in Windows, Mac, and Linux flavors. You can download these versions and get more information from the main VNC web site (http://www.realvnc.com). There are other versions of VNC available as well. For Windows and Linux machines, there is TightVNC (http://www.tightvnc.com). For Windows, there is also UltraVNC (http://www.ultravnc.com), which supports server-side scaling. For Macs, you will need OSXvnc (http://www.redstonesoftware.com/vnc.html). The built-in VNC on Macs doesn't work with PalmVNC.

You will also need an application to access the server. In typical computer-speak, this application would be called the client, but VNC uses the term viewer instead. The Palm viewer is called PalmVNC (http://palmvnc2.free.fr). You can also download UltraVNC for Windows with PalmVNC.

For a different kind of remote control experience, check out the Pebbles Project (http://www.pebbles.hcii.cmu.edu/), which makes a variety of remote control products for Palm devices. For example, their SlideShow Commander is a specialized application for remotely controlling PowerPoint Presentations. If you're on a Mac, check out Salling Clicker [Hack #8], a general-purpose remote control package that can be extended with a little bit of AppleScript programming.

 

1.16.1. Set up VNC on Your Desktop

To access your desktop remotely, you need to know its external IP address. If you have a single computer that is directly connected to the Internet and has a static IP address, that's easy. All you have to do is look up your IP address in the appropriate place and write it down for use in setting up PalmVNC.

If you have a dynamic IP address (e.g., your home computer is sitting behind a router), the situation is a little more complicated. You need to consider using an IP publishing service (see the "IP Addresses" sidebar). An IP publishing service will typically let you choose a hostname within their domain. You end up with a name like hostname.domainname.com. Keep this symbolic address handy for setting up PalmVNC.

IP Addresses

All computers on the Internet have an Internet Protocol (IP) address. An IP address uniquely identifies any computer on the Internet. It is used for routing sessions to the appropriate machines.

An IP address is a four-part number. Each part is a number in the range 0255. The numbers are separated by decimal points. Thus, an IP address can look like 192.168.0.1 (a typical home network address) or 127.0.0.1 (a reference to the local machine). IP addresses can be static, which means that the addresses don't change. Internet Service Providers (ISPs) usually charge a bit more for static addresses. Most people (at least at home) have dynamic addresses. A dynamic address is assigned by the ISP on a periodic basis. Thus, a dynamic address won't necessarily be the same from day to day. To connect to a computer over the Internet, you either need to know its IP address, or you need to have a name for it (e.g., www.google.com). The name is then mapped via a Domain Name System (DNS) server into the actual IP address.

If you have a dynamic IP address, you can hook up with a free service to publish the address. The service acts as a DNS server for a name you select (a hostname within their top-level domain) and maps that name to your computer's current dynamic IP address. You download a small program that runs on your PC and that updates the IP address for your computer in the service's DNS. You get to choose a hostname for your computer within the domain names offered by your service. Then you can refer to your computer via hostname.domainname.com. Some service providers are No-IP.com (http://www.no-ip.com), Dynu (http://www.dynu.com), and DynDNS.org (http://www.dyndns.org).

Download and install the appropriate version of VNC on your desktop machine. After VNC has finished installing, run the configuration part of it. You will be able to choose a password for VNC, as shown in Figure 1-39.

Choose a good password (at least eight characters and a mixture of upper and lowercase characters, numbers, and punctuation). This password is all that is needed to access your machine over the Internet, so choose carefully. Either write it down or remember it; you will need the password when configuring PalmVNC.

Figure 1-39. VNC server configuration under Windows

 

1.16.1.1. Setting up OSXvnc on a Mac.

When you run OSXvnc, you will see a screen similar to Figure 1-40. Select a display number (usually 1) and port (usually 5901). Set a password; this is the password you will use when you log in from PalmVNC.

Figure 1-40. OSXvnc general setup screen

When your Mac is set up, then you can proceed to setting up PalmVNC. When everything is working and you are connected, you should see a screen on your Palm device that looks like Figure 1-41.

Figure 1-41. Viewing a Mac desktop with PalmVNC

 

1.16.1.2. Securing the connection.

You will need to open some ports in your firewall for VNC, and VNC itself needs access to ports 5900-5902 on your computer. By default, VNC sends information (including passwords) as plaintext. You can use SSH (a secure protocol that can encapsulate other types of connections such as VNC; see http://www.openssh.org for more information) instead for more security. You will need to open port 22 in your firewall for SSH, if you have not already done so.

Some of the servers (notably TightVNC) have SSH set up by default. For other VNC servers, the process is fairly simple. From the client side of a desktop machine, you want to run something similar to the following:

ssh L 5902:localhost:5901 remotehost l username

PalmVNC comes with a plug-in that does RSA-40 encryption. If you want more security than that, you can tunnel your VNC connection through a VPN.

Whenever VNC is running, it will look for incoming connections. If you have a personal firewall (e.g., Norton Internet Security, ZoneAlarm), you'll need to set the firewall to allow VNC to access the Internet. If you have a port-based firewall, you'll need to allow access to the ports that VNC uses. By default, VNC uses ports 5900 and 5800 (port 5800 is only used for a Java-based viewer), but you can change those ports under the Connections tab.

1.16.1.3. Setting up VPN.

There is a Palm VPN client called Mergic VPN (http://www.mergic.com). To set up a VPN, you need to have an externally visible IP address for your desktop machine. Enter that IP address into Mergic VPN in the area titled VPN Server Name or Address, as shown in Figure 1-42.

Figure 1-42. Setting up Mergic VPN

You can create multiple VPN accounts for connecting to different machines. Set the account name in the Account edit box. Note that this name is only used to distinguish between different setups in Mergic. The actual username for logging into VNC goes into the User Name field. You can also choose to have Mergic VPN autoconnect to the server when specific applications are run.

You can run PalmVNC using the VPN from Mergic. You can see Mergic VPN being set to run automatically whenever PalmVNC runs in Figure 1-43.

Figure 1-43. Setting up MergicVPN to autoconnect whenever PalmVNC is run

You also need to configure a VPN service on your desktop machine.

1.16.1.4. Setting up VPN on Windows XP.

Windows XP comes with VPN available by default. Start by creating a new network connection (from the Network Connections section of the Control Panel). Select an Advanced Connection, as shown in Figure 1-44.

Figure 1-44. Selecting an advanced connection to set up VPN in Windows XP

The next dialog box lets you select the advanced connection options. Select Accept incoming connections, as shown in Figure 1-45. Next, choose the device that you want to allow VPN connections from.

Figure 1-45. Selecting Accept incoming connections from the Advanced Connection Options dialog box

Then, you will need to allow VPN connections in the dialog box shown in Figure 1-46.

After that, select the users that you want to allow to use VPN. You will need one of these usernames (and the corresponding password) when you set up Mergic VPN. The final steps are to allow access to different types of services (at a minimum you need TCP/IP; others are at your choice) and to set up the IP address for your computer.

Figure 1-46. Allowing incoming VPN connections in Windows XP

 

1.16.2. Set up PalmVNC

Download PalmVNC from http://palmvnc2.free.fr. Unzip it and install palmvnc.prc onto your Palm device.

Connect your Palm device to the Internet and run PalmVNC. Set up a new connection to your desktop machine, as shown in Figure 1-47. Enter the IP address for your desktop machine and the password you used when setting up the VNC server, and then tap OK and Connect from the next form. If everything is working, you should now see your desktop on your Palm device.

Figure 1-47. Setting up a PalmVNC connection

You can move around the desktop by using the narrow scrollbars on the right and bottom of the screen. If you set up server-side scaling when you were configuring the server, then you can take advantage of scaling by selecting from PalmVNC's menus or the Advanced dialog box, as shown in Figure 1-48. At 1:2 scaling, you can view a 640 x 640 desktop on a 320 x 320 Palm device or even up to a 640 x 960 desktop on a 320 x 480 Palm device. That's large enough to see (and do) a decent amount.

Figure 1-48. Advanced connection properties in PalmVNC

No matter which operating system your desktop is running, you can still control it with PalmVNC and an appropriate server. Make sure that you use an appropriate level of security for the environment you are in (running over a local network or running over the Internet).

Scott McHaffie

Категории