LJ Archive

Best of Technical Support

Various

Issue #46, February 1998

Our experts answer your technical questions.

Using Two Monitors in Linux

Is it possible to set up Linux to use two monitors? If so, where can I find out about it? —Greg Bell

It is possible to use multiple monitors but to do so you will need an X Server that supports it. Accelerated X from Xi Graphics and Metro-X from Metro Link both support this feature (known as multi-headed). Based on comments from friends I would go with Accelerated-X for performance and stability reasons. To find more information, visit their web sites :Xi Graphics: http://www.xig.com/Metrolink: http://www.metrolink.com/ —Mario de Mello B. Neto mneto@buriti.com.br

FTP No Longer Works

My machine no longer accepts logins via FTP (anonymous or login). It accepts the connections but no user name is good enough for it. It worked fine until I moved my /usr directories onto their own file system. The next day, people said they couldn't log into my FTP server. —Anonymous

From your description, I can't tell what the problem is for certain, but I suspect it is incorrect /etc/passwd entries. To debug this problem, run strace on the process generating the error, in this case ftpd. You'll find which operation causes the connection refusal by attaching strace to the process before the error occurs, that is, before typing your user name. —Alessandro Rubini alessandro.rubini@pluto.linux.it

Corrupted Terminal

When I cat a binary file (cat xxxx.tgz) to a virtual console (for example tty1) all of the characters are changed on the screen. For example the “a” character become a big rectangle. I can continue to type commands but when I use the mouse to cut and paste in another tty the words are stripped of their vowels. How can I solve this problem without a reboot? —Thierry Neusius Slackware 3.2

The cat program was designed to handle ASCII files. When used on a binary file, it attempts to display it just like any ASCII file. Unfortunately, this usually results in the terminal getting corrupted because cat interprets a lot of the binary file as control sequences. These control sequences almost always result in a lot of unprintable characters and a messed up terminal. Logging out usually solves the problem of a corrupted terminal. —Keith Stevenson ktstev01@homer.louisville.edu

You can run the program reset to switch back to normal characters. (reset is part of the ncurses distribution and should already be on your system.) —Samuel Ockman, VA Research ockman@varesearch.com

Clustering Linux Servers

I run a small web site hosting business and am wondering if there is any efficient way to cluster two or more Linux servers. I want it so that if one server goes down, all the hits will just go to the active server. I have experimented with round-robin DNS, but that doesn't give me the fault tolerance I want. I'd welcome any suggestions. —Tim ArcherRed Hat 4.1

You can use IP aliasing to solve this problem. Each machine should run a script that watches the status of the other. When a machine stops responding, the working machine adds an IP alias for the down machine's IP number. Now the up machine answers for both itself and the down machine. When the original machine comes back on-line, the alias is removed.

What makes this tricky is that you must make sure that you never have both machines responding to the same IP address at the same time. You can do this in several ways. One way is to have a separate communication path between the two machines. Here, again, you can use IP aliasing. First, assign each machine a primary, unique IP number. No other machine will ever use that number. Next, assign an IP alias to each machine to handle the Web traffic. Your round-robin DNS cycles through the aliases, not the primary machine addresses.

Now, the two machines can always talk to each other using the primary addresses regardless of who is responding to the IP aliases. The machines monitor each other on the primary addresses and install or remove the aliases depending on each other's state.

You may lose a few hits during the time it takes the first machine to figure out that the other is down and switch over, but most people generally find the number of missed hits acceptable. —Larry Augustin, VA Research lma@varesearch.com

Playing Internet Games Through A Firewall

With the release of more Internet-capable games like Diablo, Netstorm and Quake, what needs to be done so that the IP packets are routed through a firewall?

We use a Linux firewall to connect to our Internet service provider via PPP with dynamic IP numbers. The other members of the household would like to connect to the various servers available for games. I've looked though the documentation and nothing seems to work. I've tried to add services to the /etc/services file, (following up in /etc/inetd.conf, /etc/hosts.allow, /etc/sockd.conf and a few others). Our firewall works by setting firewall on in the kernel and IP forwarding turned off. —Aaron Hicks Slackware 2.0

You need to allow the packets to be forwarded for Internet hosts to see machines on your local LAN. To keep the firewall protection active in your arrangement, find out the port numbers the various games use.

Suppose you wanted to allow only TELNET connections through your firewall. TELNET uses port 23. Using ipfwadm you can specify forwarding rules to allow packets destined for port 23 to pass through your firewall. For additional protection, you can specify entries only for those machines that should receive these packets.

Read the ipfwadm(8) man page for more information on command-line syntax for this tool. Note that this applies only to standard Linux firewalling systems (using the kernel facilities, rather than external programs). In this case, the kernel handles all firewall functions, and ipfwadm is only used to configure the rules. —Larry Augustin, VA Research lma@varesearch.com

Compatibility Between Linux Distributions

I have been feeling a bit confused lately about the different Linux distributions. Specifically, if they are compatible with one another. The two distributions I use are Slackware and Red Hat. I prefer the way Slackware handles some things and prefer the Red Hat method for certain other things. What I would like to know is if these two distributions (as well as the others) are interchangeable in any way. For example, would it be possible to install pkgtool on a Red Hat system and could an XF86_SVGA server from Red Hat work on a Slackware distribution? Could a Slackware kernel be used to boot a Red Hat system? —Steven M. St. Hilaire

The core of this question centers around Linux itself. As far as binary compatibility goes, that depends on your platform, not your distribution. If you use x86 binaries from all distributions, then yes, they are indeed compatible.

The problems you are likely to run into are conflicts in directory locations and library versions, which can happen in any binary distribution. The kernels from the various distributions will boot properly, but once Linux boots, it needs to perform some work to get the entire system mounted and operating.

Take two examples from your question. The XF86_SVGA server would most likely operate properly, if you had installed the entire Xfree86 installation from the Slackware set. If, on the other hand, you wanted to use only the X server from the Slackware distribution and use the Red Hat distribution to install the rest of the X system, you would likely run into trouble.

The second example is the Red Hat control panel. Yes, it would have difficulty with those items which you installed from Slackware. But you would not have trouble using it to control packages which you installed from the Red Hat distribution.

If you do this, be aware that you could be in for long nights working out the various incompatibilities. Certain things may work without trouble, especially third-party packages (such as some database systems) that come in specific formats for your convenience. Unless you are an experienced administrator, I would not recommend installing system-level facilities using a mixed distribution.

Instead, why not select one distribution and install the remaining items by compiling the source distribution? It will probably take somewhat less time to do because of the headaches you will avoid, and you will gain a much stronger understanding of how the various programs, system libraries and kernel facilities interact. —Chad Robinson, BRT Technologies chadr@brt.com

LJ Archive