April 21, 2019

Graphical Remote Control Desktops for Linux, part 2

Dynamic DNS setup and Wake-On-LAN (WOL)

  • November 3, 2008
  • By A. Lizard
With the setup as described, you'll have to know the IP address your server is running on to connect. If you have a static IP address, that's where you connect. However, if you have the far more common dynamic DNS service from your broadband provider, your IP address will change from time to time.

The workaround is a dynamic DNS service. This requires an account with a dynamic DNS service and a dynamic DNS application running on the server. The dynamic DNS service gives your server a subdomain from one of its domain names, i.e. yourusername.dynamicdnsservice.com.

The dynamic DNS client application polls a source of current IP information from your router or server to find out what your LAN IP address is and sends that information to the dynamic DNS service, so you can access that server at the yourusername.dynamicdnsservice.com domain-based address.

If you plan to use your remote desktop client from anywhere other than within your home network and you don't have a static IP from your ISP/broadband provider, set up a free account at Dyndns or another service. This way, you can tell nxclient to access your server via a Dyndns second-level domain ... e.g. username.somedyndnsTLD.com instead of via a LAN-internal IP like 192.* or 10.* The clients use the router IP address assigned by the broadband provider or a "what's my IP?" page on the dynamic DNS server to find out what the current server IP is.

You can either set this on the router if your router has an internal IP client, or download and install a dynamic DNS client. Which you choose depends on whether you want "wake-on-LAN" , a service which will turn on your server by feeding a "magic IP packet" to the network card on your server which will wake it from sleep state.

Figure 1 shows the settings page for dynamic DNS on my Airlink AR420W router, with the entries changed to sample entries. Change the username, password, hostname, and choice of dynamic DNS provider entries on the equivalent page inside your router to fit your own configuration. Of course, if your router doesn't support dynamic DNS, you're stuck with a software client. The internal IP address is the one the router client discovers, the address shown here was replaced by an Internet IP from my broadband provider after an automatic update.

Then, do whatever it takes to save the changes, which usually means rebooting the router.

Your computer has to be in a sleep/hibernate state (ACPI G1/S1-S4 or G2/S5) for wake-on-lan to work after configuring it, setting it in the BIOS.

To enable wake-on-lan if it isn't already enabled:
# aptitude install ethtool
# ethtool eth0

Settings for eth0:
. . .
��������Supports Wake-on: g
��������Wake-on: d
��������Link detected: yes
# ethtool ethtool -s eth0 wol g
. . .

Supports Wake-on: ��������Wake-on: g
��������Link detected: yes

Unfortunately, I couldn't get wake-on-lan to work on my system at the time of writing, I have a Biostar Geforce 6100AM2 motherboard. The ethtool utility set the Ethernet adapter, which ignored the "Magic Packet" I sent and showed unset when I manually returned it from suspend. I've seen other reports from people who couldn't get it to work, either. This may be another problem with the nvidia chipset forcedeth driver. But this may work on your motherboard / OS / hibernate-suspend version, and if it does, it's worth doing.

If you don't mind leaving your computer on, or your motherboard BIOS's lack of support for "wake-on-LAN" doesn't give you a choice, download and install the ddclient or inadyns dynamic DNS client. Dyndns provides configuration instructions and even a configurator wizard onsite for each of these clients. The main advantage of a server client is better security; ddclient uses SSH transport of passwords to the DNS server if it supports SSH, as Dyndns does. The router clients typically send password/UID info to the server in clear, so use a unique password.

These software dynamic DNS setups instructions are mainly for the dyndns.com service. Other dynamic DNS services have their own setup instructions.

  1. Windows/OSX Dyndns setup
  2. Linux Dyndns setup:

There are other Dynamic DNC clients such as inadyn and no-ip. You can find out via aptitude search appname which are supported for repository installation on your distribution.

Router Setup

  1. Set up a static IP for your server from the router to your server LAN IP to ensure your NX Server connection finds it.
  2. Set your router to forward whichever port you've set SSH for (the default is 22... reasons to change it and how are later in this document) through to the IP address your server is running on. To allow turning on your computer remotely using the web-based DSLreports Wake my PC remote page which requires no installation on the server, forward port 9/UDP on the router to the server and set up dynamic IP address via dyndns or whichever service supporting this your router supports. Your computer needs to go into suspend/hibernate mode for this to work. How to do this varies a lot between the different Linux distributions, and even their different releases, so I shall leave how to set that up as an exercise for the reader.
  3. The router setting in the image reflects my earlier use of 22 as well as the current SSH port setting, you should use a different port so you can leave that port closed on the firewall.
  4. For router-specific setup information, go to the Portforwarding.com site.
  5. I have SPI firewall set ENABLED, Block Anonymous Internet Requests: DISABLED.

Figure 2 shows how to set up port forwarding on the router.

Most Popular LinuxPlanet Stories