Previous Section  < Day Day Up >  Next Section

Hack 98 Link Two IRC Servers Together

figs/expert.gif figs/hack98.gif

If your IRC server starts getting too busy, the only real solution is to turn it into a network of IRC servers.

Almost all large IRC networks are made up of multiple servers linked together. In order for two servers to link, both need to be configured correctly.

The first step to linking IRC servers into a network is to make sure that both servers can communicate with each other. Different ircds use different protocols. One of the more popular protocols is P10, developed by Undernet and used by ircu, bircd, and several other ircds. It doesn't really matter which protocol you use, as long as both servers are capable of understanding it. If you are unsure of which protocol your server uses, check the official web site for your ircd. One way to be sure that the servers will be able to communicate is by using the same server software for both of the ircds, although this isn't always possible.

15.5.1 Configuring the Servers

In order for the network to run smoothly after the servers have been linked, several settings need to be the same for all servers. The settings vary from ircd to ircd, but most will have the following options somewhere (bircd uses bircd.ini, and asuka uses F:lines in ircd.conf).

The following settings must be identical:

Topic length

The maximum length of the topic

Nick length

The maximum length for a user's nickname

Chan length

The maximum length for a channel name

If these settings are not identical on all servers, problems will arise. For example, if the channel length is different, channels with longer names would be truncated on some servers, but the truncated channel may already exist.

In addition to these settings, any optional modes should be enabled or disabled across all servers. That is, if the server software supports optional modes, they should be disabled on all servers or enabled on all servers. If the valid modes differ between servers, a mode change on one server may not be propagated to all users or servers.

15.5.2 Numerics

Each IRC server on a network is assigned a numeric that uniquely identifies it. No two servers can have the same numeric. In ircu and bircd, the numeric is set in the M:Line in the ircd.conf file. The example given in example.conf has a numeric of 1 (the last number on the line):*:University of London, England:0:1

Servers that use the P10 protocol usually have a two-digit numeric that can be made up of numbers, letters (a-z, A-Z), and the [ and ] characters. Other networks use only pure numbers or other combinations. Before linking servers, make sure that they all have a unique numeric. If there is a collision, the servers will cancel the link attempt.

15.5.3 C:Lines

In order for the servers to link, they need to "know" about each other and to have passwords to use during the link attempt. These are defined in C:Lines in the ircd.conf file. The format for these, as shown in example.conf, is:

C:remote hostname or IP:password:remote server name:port:class

The remote hostname or IP field can contain wildcards; however, at least one server will need to know the full hostname or IP of the other, so that it can initiate the link attempt. The password field specifies the password to be used during the link and should generally be the same for both servers. The remote server name field must exactly match that of the other server's M:Line.

The port is the port number that the server listens on for connections from other servers (usually set via a P:Line with an S as the penultimate parameter). The class field refers to one of the classes defined with Y:Lines. 90 is the default for servers, which gives the connection a low ping frequency and high SendQ and makes automatic connection attempts every 300 seconds.

When you have added C:Lines for both servers and the servers are currently running, you will need to make them reload the config file, usually via the /rehash command or by executing an external program.

15.5.4 Linking the Servers

Now that the servers are configured properly, it's time to make them link. To do this, make sure both servers are running. One of the servers should attempt to automatically connect to the other within 5 minutes (300 seconds). If this doesn't happen or you're too impatient, you can use the /connect command to force a connection attempt. The syntax for the connect command is:

/connect  server name 

The server name parameter must be the server name as specified in the C:Line. When the servers link, you should see some server notices (snotices) saying that they have linked and when they have finished bursting.

15.5.5 Bursting

When two servers connect, they have to tell each other everything about their users and channels so that the two servers have the same information. For larger networks, this can take several minutes and result in decreased performance for the users. Normally, however, it takes only a few seconds. Sometimes when the servers burst, there will be users with the same nickname or channels with the same name and a different set of channel operators. The servers have to decide what to do with these "collisions."

If two users have the same nickname, the servers will generally kill the person who connected to the network last. For example, if Foo connected to server 1 at 2 p.m., and Foo connected to server 2 at 5 p.m. on the same day, Foo on server 2 would be killed when the servers link.

Channel collisions are handled in a similar way. If a channel on server 1 was created before that on server 2, then everyone in server 2 would be de-opped or devoiced, and any modes set on server 1 would override those on server 2. Also, if server 1 had a mode such as +i (invite only) or +k (password required), then some users on server 2 may be kicked because they were not invited or did not join with a password. The particular behavior depends on the type of server you are running.

15.5.6 Commands

There are several standard commands for managing server links. The /connect command has already been discussed, but it is worth noting that most ircds do not feature a /disconnect command. Instead, the /squit command is used (squit is short for "server quit"). This closes the connection with the given server—for example, /squit would close any connections to On some ircds, the /squit command can be used to close links only from the local server (i.e., you cannot tell another server to drop one of its connections).

As with most server features, the commands and configuration options vary between different ircds, so it is always a good idea to consult the documentation for information specific to your software.

Chris Smith

    Previous Section  < Day Day Up >  Next Section