Marcel's Linux Walkabout: Ruling the IRC!
Internet Relay Chat, better known as IRC, is a distributed client-server system in which users can communicate with any number of other users in real time. IRC servers host channels that are dedicated to discussion forums on specific topics. These topics aren't fixed other than by convention and the whims of the IRC operators (more on that). If you are old enough to remember CB radio (i.e.: mid-30s and up), you pretty much understand IRCat least in the human sense of the experience.
A number of IRC servers exist around the world, some with hundreds of channels. IRC servers can also peer with other servers. IRC channels cover a plethora of topics, from purely social to politics to business or to high-technology. In the Linux world, there are channels devoted to programming in most of the popular languages, as well as your favorite Linux distribution, office applications, games, and so on. IRC channels are great places to meet and exchange information, ask questions, answer questions, or just plain chat. All this chatting takes place via an IRC client such as Xchat, Ksirc, Kvirc, GAIM, Kopete, and a number of others.
In today's Walkabout, I will show you how to build and run your own IRC server. Think of it...you can be the master or mistress of your own IRC world. Think of the power and the glory. Well, all right. Consider then, that an IRC server is an excellent way to provide a conferencing environment for your business or organization. It provides a centralized chat room in which your associates can exchange information on a real-time, ongoing basis. You can do all of this without expensive licensing fees. In fact, because the software I will show you is distributed under the GPL, it won't cost you anything but a little time.
Historically, getting a server up and going could be a substantial undertaking, but it doesn't have to be that way. Thanks to Alexander Barton's ngIRCd (Next Generation IRC Daemon), you can have an IRC server up and running in minutes. Although ngIRCd is simple to set up and configure, it is nevertheless capable, stable, and feature-rich. It will also link with other classic IRC servers and can run on networks with dynamic IP addresses. You can also password-protect your server so that only those you want connecting will be able to do so.
Building and Configuring ngIRCd
To get started with ngIRCd, visit the website and get yourself the latest source. Building the daemon involved nothing more than the classic extract and build five-step.
tar -xzvf ngircd-0.7.5.tar.gz cd ngircd-0.7.5 ./configure make su -c "make install"
By default, the ngircd binary gets installed in /usr/local/sbin. The configuration file, called nircd.conf, is in /usr/local/etc, in which you will also find another file called ngircd.motd. Let's start with that one and then move on to the actual configuration.
As you might expect from the name, ngircd.motd, this is your message of the day file. When you connect to an IRC server, you will usually see some statistics about the type of server, its release number, the number of channels, users, and so on. That information is generated by the server, but there is pretty much always some kind of a local message as well, and this is the message of the day (or week or month). This is just free text and can be whatever the operator wants to say. Here's the one I created for my test server:
Welcome to the WFTL IRC test server. Nothing here except some good Linux chat. Enjoy!
The other file in /usr/local/etc is ngircd.conf, which is the system configuration file. It is set up in sections defined by labels in square brackets. These sections are [Global], [Operator], [Server], and [Channel]. The configuration file itself is easy to read nicely laid out. You should take a few minutes to read it and familiarize yourself with the various parameters, but I'll cover the most interesting ones here, starting with the [Global] section. The parameters you are most likely interested in at this moment are the following:
Name = irc.walkabout.server Info = Walkabout IRC Server Password = t0ps3cr3t MaxConnections = 60 MaxJoins = 5
The Name parameter needs to have at least one dot in the name. Info is exactly what it sounds like: a free text field with information about the server. The Password field will probably be commented out on most servers (a semicolon before the parameter name indicates a comment). If you set this password, your IRC server will require a password when clients connect. Finally, from the perspective of network abuse and possible DoS attacks, you can limit the number of connections to your IRC server. MaxConnections refers to the total number of IRC members running on your server, whereas MaxJoins refers to the number of channels an individual host may join.
The next section is dedicated to you, the operator of the system, hence the name of the section: [Operator]. There are only two parameters for this section, but there can be multiple [Operator] sections defining multiple operators.
Name = edgar Password = electric
The user name above with the accompanying password would be used in an IRC session to switch to channel operator mode with the IRC command "/oper name password".
A word of warning on something that took me a while (not to mention a look at the source code) to figure out. Keep your password to eight characters or fewer. I started out with a 10-character password and had quite the adventure trying to figure out why I could not switch to operator mode.
Following this, we have the [Server] section. I mentioned that ngIRCd can link or peer with other IRC servers. What does that mean to you? Well, if I run two servers, each with five channels, upon peering, each of my two servers will have 10 channels available to users when they log on. This section is where this magic takes place. There can be multiple [Server] sections, and each has the same format. The parameters you'll want to pay attention to are as follows:
Name = some.other.irc.server Host = servername.domain.dom Port = 6667 MyPassword = beammeupeh! PeerPassword = Peers3cr3t
The Name field is a descriptive name identifying another server you may with to peer with. Host is the server's actual host name. If the port is something other than the default, change it with the Port parameter as above. The two password parameters that follow have to do with who is peering with who. MyPassword is the password that a remote server needs to peer with yours, whereas PeerPassword is the password our server must use to peer with the remote.