Setting up a IRCD Server

Tue, Jun 16, 2009

Linux

Preparing the server

  1. To compile unrealircd you need to install some software. First off resynchronize the package index files
    sudo apt-get update

    Then we need to install compiling tools

    sudo apt-get install build-essential

    If you want SSL your going to need to install openssl

    sudo apt-get install openssl libssl-dev

  2. It is not recommended to run a IRCd as root for this reason we will be creating a ircd user
    adduser ircd

    switch to ircd

    su ircd

  3. wget the latest unrealircd package from http://www.unrealircd.com/downloads.php
    wget http://unrealircd.icedslash.com/Unreal3.2.8.1.tar.gz"

  4. Extract the source and rename its folder
    tar xzvf Unreal3.2.8.1.tar.gz
    mv Unreal3.2  unreal

Compiling Unrealircd

  1. Switch into the ircds directory
    cd /home/ircd/unreal

    Start The Compile by running Config

    ./Config

    You shall now be asked some questions usually the default answers will do

    Do you want to enable the server anti-spoof protection?
    [No] -

    This is not necessary needed its only advantage is it will protect against HTTP post proxies(Don't confuse them with HTTP Connect Proxies) I Personally use the default answer of no

    What directory are all the server configuration files in?
    [/home/ircd/unreal] -

    By default the path for the configuration files is the same as the path to the installation source so again the default would be fine unless you want your configuration files in a seperate directory

    What is the path to the ircd binary including the name of the binary?
    [/home/ircd/Unreal/src/ircd] - 

    By default the path to the ircd binary is in the installation source folder which is fine so again use default values here unless you want to store the binary elsewhere

    Would you like to compile as a hub or as a leaf? Type Hub to select hub and Leaf to select leaf. [Hub] -

    This option is totally up to yourself i personally always use hub

    What is the hostname of the server running your IRCd?
    [localhost.localdomain] -

    Set this as your domain that you wish to run the ircd server from

    What should the default permissions for your configuration files be? (Set this to 0 to disable)
    It is strongly recommended that you use 0600 to prevent unwanted reading of the file
    [0600] -

    I see no issue with the configuration files being 0600(read/write only to user ircd) so again i leave this option at default

    Do you want to support SSL (Secure Sockets Layer) connections?
    [No] -

    If you would like to enable SSL on your servers then use yes personally i always select yes incase in the future the network desies to support SSL you won't have to recompile the ircd

    If you know the path to OpenSSL on your system, enter it here. If not
    leave this blank
    [] -

    If you don't know the path to openssl just leave this blank

    Do you want to enable IPv6 support?
    [No] -

    Personally I never enable this as most of the services don't support ipv6 and not many clients use ipv6

    Do you want to enable ziplinks support?
    [No] -

    This will make the data sent between linked services and the hub be compressed. I personally always select yes for this

    If you know the path to zlib on your system, enter it here. If not
    leave this blank
    [] -

    If you don't know the path to zlib then just leave this blank and move on

    Do you want to enable remote includes?
    [No] -

    Remote includes allows you to remotally include config files e.g include "http://server.com/file.conf"; Personally I don't think this is secure so i select no if you are interested about enabling it you will need to compile cURL for unrealircd for more information about it please see http://forums.unrealircd.com/viewtopic.php?f=3&t=353

    Do you want to enable prefixes for chanadmin and chanowner?
    This will give +a the & prefix and ~ for +q (just like +o is @)
    Supported by the major clients (mIRC, xchat, epic, eggdrop, Klient,
    PJIRC, irssi, CGI:IRC, etc.)
    This feature should be enabled/disabled network-wide.
    [Yes] -

    This enables prefixes for modes +a(SOP) and +q(Owner) Personally i tend to enable this feature as it is easier to tell who has what status in a room

    What listen() backlog value do you wish to use? Some older servers
    have problems with more than 5, others work fine with many more.
    [5] -

    It should be safe to leave this at 5 so just press enter and move on

    How far back do you want to keep the nickname history?
    [2000] -

    This is for /whowas i like to set this figure to 10000 as it will allow me to keep a better track of users

    What is the maximum sendq length you wish to have?
    [3000000] -

    The Default value is fine here

    How many buffer pools would you like?
    This number will be multiplied by MAXSENDQLENGTH.
    [18] -

    Again the default value is fine here

    How many file descriptors (or sockets) can the IRCd use?
    [1024] -

    This is the hardcoded max about of users the ircd server can take some ircd shell providors require you to change this otherwise you can leave it as default

    Would you like any more parameters to configure?
    Write them here:
    []-

    Just press enter and move on

  2. Run make to start compiling the ircd
  3. When that is finished run make install
  4. Your ircd is now compiled all that needs to be done is your unrealircd.conf

The Configuration

  1. First we need to make some files and folders
    go into your unreal directory
    cd /home/ircd/unreal

    create ircd.motd and ircd.rules they will hold your /motd and /rules

    touch ircd.motd
    touch ircd.rules

    make the folder data

    mkdir data
  2. To get started Open unrealircd.conf
    nano unrealircd.conf

    All the unrealircd will be doing is including other config files copy and paste be code below into it

    ## Modules ##
    loadmodule "src/modules/commands.so";
    loadmodule "src/modules/cloak.so";
    
    ## Include Unrealircd Files ##
    
    include "help.conf";
    include "badwords.channel.conf";
    include "badwords.message.conf";
    include "badwords.quit.conf";
    include "spamfilter.conf";
    include "aliases/anope.conf";
    
    ## Include The Configuration Files ##
    
    include "data/server.conf";
    include "data/ports.conf";
    include "data/domain.network";
    include "data/olines.conf";
    include "data/log.conf";
    include "data/links.conf";
    include "data/local.conf";
    
    ## Mibbit Config Uncomment this if your network has been mibbit enabled please see http://wiki.mibbit.com/index.php/Enable_Mibbit_on_Your_IRC_Server for more information about this
    #include "data/mibbit.conf";

    move into the data folder we made earlyer

    cd data

    We will be starting with server.conf I'll try to explain each block with a commented line above it

    /*
     * class (class name)
     * {
     *     pingfreq (how often to ping a user/server in seconds);
     *     maxclients (how many connections for this class);
     *     sendq (maximum send queue from a connection);
     *     recvq (maximum receive queue from a connection [flood control]);
     *  };
     */
    
     class  clients
    {
            pingfreq 90;
            maxclients 1240;
            sendq 100000;
            recvq 8000;
    };
    
    class  servers
    {
           pingfreq 90;
           maxclients 10;
           sendq 1000000;
           connfreq 100;
    };
    
    /*
     * allow {
     *    ip (ip mask to allow);
     *    hostname (host mask);
     *    class (class to send them to [see class {}]);
     *    password "(password)"; (optional)
     *    maxperip (how many connections per ip); (optional)
     * };
     * Below we allow for 10 clients per ip
     */
    
     allow
     {
           ip             *@*;
           hostname       *@*;
           class           clients;
           maxperip 10;
     };
    
    /* U-lines give servers more power/commands, this should ONLY be set services/stats servers */
    
    ulines
    {
    	services.domain.com;
    	stats.domain.com;
    };
    
    /* Below defines the passwords to restart or die the server */
    drpass {
    	restart "some-strong-pass-here";
    	die "another-strong-pass-here";
    };
    
    /* Below sets the motd and rule files */
    tld
    {
        mask *@*.*;
        rules "ircd.rules";
        motd "ircd.motd";
    };
    
    /* Certian options set there name pretty much defines what they do */
    set {
           kline-address "some-email@yourdomain.com";
           modes-on-connect "+ixw";
           modes-on-oper    "+gs";
           modes-on-join    "+nt";
           oper-auto-join "#Lobby,#Help,#Opers,#Services";
           options {
              hide-ulines;
              show-connect-info;
           };
    
           maxchannelsperuser 120;
           anti-spam-quit-message-time 10s;
           oper-only-stats "okfGsMRUEelLCXzdD";
    
           throttle {
              connections 5;
              period 60s;
           };
    
           anti-flood {
           nick-flood 3:60;
           };
    };

    Now ports.conf this defines the ip and ports to bind the ircd to

    /* This binds the ircd to the default ircd ports 6660 to 6669
     listen  YOUR-IP-HERE:6660-6669
    {
       options
       {
          clientsonly;
    	  java;
       };
    };
    
    /* This is a listen block for linking servers */
    listen          YOUR-IP-HERE:8067
    {
       options
       {
              serversonly;
        };
    };
    
    /* This is the listen block for ssl connections */
    listen          YOUR-IP-HERE:6697
    {
        options
       {
    	clientsonly;
    	ssl;
       };
    };

    Ok Next up is domain.network this just sets a few settings such as offical channels, modes on join etc

    /* Sets offical channels for /stats j */
    official-channels {
    	"#Help" { topic "Official help channel for DefconIRC"; };
    	"#Lobby" { topic "Official general chat channel for DefconIRC"; };
    };
    
    /* Sets a few options for your ircd server the name pretty much explains what they do */
    set {
    	network-name "Domain";
    	default-server "hub.domain.com";
    	services-server "services.domain.com";
    	stats-server "stats.domain.com";
    	help-channel "#Help";
    	hiddenhost-prefix "privatehost";
    	prefix-quit "Quit:";
    
    	/* These are just 3 random generated keys for cloakhost */
        cloak-keys {
             "a2JO6fh3Q6w4oN3s7";
             "a2Jsgdgsd6w4oN3s7";
             "asdgsdgsdgw4oN3s7";
    			   };
    
         hosts {
              local "Local.domain.com";
              global "IRCop.domain.com";
              coadmin "Co-Admin.domain.com";
              admin "Admin.domain.com";
              servicesadmin "ServicesAdmin.domain.com";
              netadmin "NetAdmin.domain.com";
              host-on-oper-up "yes";
    			};
    };

    Ok now for olines.conf this is the file where you setup your operators flags

        /* Admin Info */
    admin {
           "Your full name.";
           "email@domain.com";
           "http://www.domain.com";
    };
    
    /* Oper Blocks
    * It is more secure if you encrypt the oper up passwords
    * To do so type /mkpasswd encrytion_method password on a active opered up connect to the server
    * e.g /mkpasswd sha1 my-really-strong-password
    * To use a encrypted password simply replace
    * password "PASSWORD-HERE"; With password "PASSWORD-HASH" { encrytion_method; };
    */
    
    /* This block is for network administrators */
    
        oper NETADMIN-NAME {
           class           clients;
           from {
              userhost *@*;
           };
           password "PASSWORD-HERE";
           flags
           {
              netadmin;
              can_setq;
              coadmin;
              locop;
              admin;
              can_zline;
              can_gzline;
              can_gkline;
              global;
              services-admin;
              can_rehash;
              can_die;
              can_restart;
              can_wallops;
              helpop;
              can_globops;
              can_localroute;
              can_globalroute;
              can_localkill;
              can_globalkill;
              can_kline;
              can_unkline;
              can_localnotice;
              can_globalnotice;
              can_zline;
              can_gkline;
              can_gzline;
              get_umodew;
              get_host;
              can_override;
              can_setq;
              can_addline;
              can_dccdeny;
    
           };
           snomask kcfFjveGnNqSso;
    };
    
    /* This block is for server administrators */
    
        oper SERVERADMIN-NAME {
           class           clients;
           from {
              userhost *@*;
           };
           password "PASSWORD-HERE";
           flags
           {
              admin;
              local;
              can_override;
              can_zline;
              can_gzline;
              can_gkline;
              global;
              can_wallops;
              helpop;
              can_globops;
              can_localroute;
              can_globalroute;
              can_localkill;
              can_globalkill;
              can_kline;
              get_host;
              can_unkline;
              can_localnotice;
              can_globalnotice;
    
           };
           snomask kcfFjveGnNqSso;
    };
    
    /* this block is for IRC Operators */
    
        oper IRCOPERATOR-NAME {
           class           clients;
           from {
              userhost *@*;
           };
           password "PASSWORD-HERE";
           flags
           {
              local;
              can_zline;
              can_gzline;
              can_gkline;
              global;
              can_wallops;
              helpop;
              can_globops;
              can_localroute;
              can_globalroute;
              can_localkill;
              can_globalkill;
              can_kline;
              get_host;
              can_unkline;
              can_localnotice;
              can_globalnotice;
              can_override;
    
           };
           snomask kcfFjveGnNqSso;
    };

    Next is log.conf this sets the log file name and the flags to log

    log "ircd.log" {
            /* Delete the log file and start a new one when it reaches 2MB, leave this out to always use the same log */
            maxsize 2097152;
            flags {
                    oper;
                    kline;
                    connects;
                    server-connects;
                    kills;
                    errors;
                    sadmin-commands;
                    chg-commands;
                    oper-override;
                    spamfilter;
            };
    };

    Next is links.conf which will be used when you try to link services or other unrealircd servers below is two link block examples

    link            services.domain.com
        {
           username   *;
           hostname   *;
           bind-ip    *;
           port       8067;
           hub             *;
           password-connect "PASSWORD";
           password-receive "PASSWORD";
           class           servers;
              options {
              };
        };
    
        link            leaf.domain.com
        {
           username   *;
           hostname   *;
           bind-ip    *;
           port       8067;
           hub             *;
           password-connect "PASSWORD";
           password-receive "PASSWORD";
           class           servers;
              options {
              };
        };

    And finally local.conf this sets up local info for the server e.g name and description

        me
    {
           name "hub.domain.com";
           info "Check out our website http://domain.com";
           numeric 1;
    };
    

    If you have mibbit enabled on your network then simple just change YOUR-PASSWORD in mibbit.conf

    except throttle {
          mask 64.62.228.82;
    };
    
    except throttle {
          mask 207.192.75.252;
    };
    
    allow {
           ip *@*;
           hostname *@mibbit.com;
           class clients;
           maxperip 1000;
    };
    
    // For the main client:
    cgiirc {
           type webirc;
           hostname 64.62.228.82;
    password	PASSWORD-HERE;
    };
    
    // For the main widget:
    cgiirc {
           type webirc;
           hostname 207.192.75.252;
    	password PASSWORD-HERE;
    };

Starting The Server

  1. To start the server simple cd into the unrealircd dir
    cd /home/ircd/unreal

    and then run

    ./unreal start

    It should start correctly if you followed everything correctly if you have any issues or questions feel free to join the chat room or leave a comment

, , , , , ,

This post was written by:

Duffy - who has written 48 posts on Tuts4Tech.

I am the owner of this website, please feel free to ask me any questions you have

Contact the author

3 Responses to “Setting up a IRCD Server”

  1. tokyo
    tokyo Says:

    Thanks for the guide. im just having problems connection from the ip. wont work.

    Reply

  2. Elizabet Reay
    Elizabet Reay Says:

    I was roaming Google for some cool music and videos of my favorite artists and I ran across your cool weblog, most from the time when I go to blogs I'm trying to find anything particular and I leave promptly following. But in your circumstance the info you're giving in this post produced me would like to reply and show my appreciated, so I have bookmarked you website as nicely. Maintain posting and thank you! =)

    Reply


Leave a Reply