## How linking works

You link to another server by adding its link block to your `unrealircd.conf`, and it adds yours. Both sides need the other's block, hub or leaf.

The [server list](/servers) has every server's block, and [/servers/link-blocks.conf](/servers/link-blocks.conf) has all active ones as one file. Add `?type=Hub` for hubs only. The blocks there use `class hubs` for hubs and `class servers` for everything else, so your config needs both classes.

## Classes for a leaf

A leaf should hold one hub connection at a time. Limit the `hubs` class to one:

```
class hubs {
    pingfreq 60;
    connfreq 60;
    maxclients 1;
    sendq 20M;
}

class servers {
    pingfreq 60;
    connfreq 15;
    maxclients 10;
    sendq 20M;
}
```

Hubs use a higher `maxclients` in both classes.

## Autoconnect

At least one link block needs `autoconnect` or your server never connects:

```
link hub.example.org {
    incoming {
        mask *;
    }
    outgoing {
        hostname hub.example.org;
        port 6900;
        options { tls; autoconnect; }
    }
    password "base64-spki-fingerprint" { spkifp; }
    class hubs;
}
```

- Set autoconnect on the two or three closest hubs. With `maxclients 1` in `hubs`, only one of them connects at a time and the others are the fallback.
- Keep a few more hubs in your config without autoconnect, so an oper can reroute you by hand when your link drops.
- Only set autoconnect on a block once the other side has added yours. Autoconnecting to servers that don't know you is spam.

## Network settings

Every server needs the same network name, cloak module and cloak keys, or cloaked hosts differ from server to server.

Pissnet uses the older `cloak_md5` module. In `unrealircd.conf`, replace `loadmodule "cloak_sha256";` with:

```
loadmodule "cloak_md5";
```

Then set the network name and cloak keys:

```
set {
    network-name "pissnet";
    cloak-keys {
        "d86PVocPMhCm8YcLs46Yb8FiCF1wC50x1VvutFBviIAitqb0g034M";
        "Qh3262E4uJOM2Aj210EC2gawF5llEA65mRK3cSctNOv4p610AJhX067KY5Xg";
        "240TUBv13ce2ANwm2cki1Rj80p8OAdqR64HWeDh8h38kTQkEWRXJ7";
    }
}
```

## Host changes

UnrealIRCd doesn't tell clients without `CHGHOST` support when someone's host changes. This makes it send them a part and join instead, which some clients and bots need:

```
set {
    allow-userhost-change force-rejoin;
}
```

## Ban blocks

Don't add `ban server` blocks. Unless every server has exactly the same ones, the network ends up in an `SQUIT` loop when someone links a banned name. The one exception everyone has:

```
ban server {
    mask eris.berkeley.edu;
    reason "Get out of here.";
}
```
