Never leave IRC again with ZNC

IRC (Internet Relay Chat) is an online chat protocol that has existed since 1988. IRC is a network of large chat rooms. Each room lets members of a community talk with each other from all corners of the world. Those new to IRC may have used a web chat interface. Many users have an IRC client to connect to their favorite IRC networks and channels. After a while, you may notice some groups of users seem to always be in the channel, each time you connect. Are they really sitting in front of their computers with their IRC clients all day?

The simple answer to that is usually no. Many avid IRC users use an IRC bouncer, a proxy service that remains persistently connected to your preferred IRC networks and channels. Instead of connecting directly to an IRC network such as irc.example.com, you connect to a machine like bouncer.mysite.com which runs the bouncer software. The bouncer, in turn, is connected to the IRC network. When you log into your bouncer, it shows messages in your channels you may have missed while offline, as well as private messages from other users.

What is ZNC?

ZNC is a bouncer application that provides this awesome set of features. ZNC is readily available in the Fedora software repositories for you to install wherever you like. Fortunately, using ZNC is quick and easy. In little time, you too can have your own ZNC bouncer up and running. You’ll never have to leave an IRC channel again!

Installing and Using ZNC

Installation

Before getting started, make sure your server is publicly accessible on the Internet, and that the port you’ll use for your bouncer is open. Usually, this is port 6667 for unencrypted or 6697 for encrypted SSL traffic. If you’re unsure how to configure your firewall, run the following commands to open the desired port on your server:

$ sudo firewall-cmd --add-port=<port number>/tcp
$ sudo firewall-cmd --runtime-to-permanent

Afterwards, run the following command to install ZNC:

$ sudo dnf install znc

Initial configuration at the command line

Once installation finishes, you’re ready to jump into configuration. To do so, run the configuration generator as the znc user. Use the following command:

$ sudo -u znc znc --makeconf

You’ll be prompted through a series of configuration options for ZNC. An example of my configuration is below. Password entries have been omitted, and for some options like Nick, I’ve hit Enter to accept a default.

-- Global settings --
Listen on port (1025 to 65534): 6697
Listen using SSL (yes/no) [no]: yes
Listen using both IPv4 and IPv6 (yes/no) [yes]: # you can default this to yes unless you have a reason to prevent IPv6 traffic
-- Admin user settings --
Username (alphanumeric): jflory7
Enter password:
Confirm password:
Nick [jflory7]:
Alternate nick [jflory7_]:
Ident [jflory7]:
Real name [Got ZNC?]: Justin W. Flory
Bind host (optional):

If you wish to set up a network inside of your terminal, you can. If not, you can do this later on in your web administration portal.

Launch ZNC now? (yes/no) [yes]:
Success, you made it to your ZNC web panel for IRC!

Success, you made it to your ZNC web panel!

Congratulations, your ZNC server is now running! If everything’s set up correctly, you should be able to log into your web panel.

To get to your web panel, open your web browser and enter the location http(s)://<server_ip>:<your_port>. You should now see the ZNC panel. If you opted to use SSL earlier, your browser will likely warn you about insecure SSL certificates. That’s okay for now, since we generated them on our own to use for the server. You can safely ignore the warning.

Finishing configuration in the web panel

Once you log into your web panel, you’re greeted by plenty of different options. Find the user account that you set up in the web panel and edit the user, so you can add a network. For the scope of this article, we’ll add a popular IRC network, freenode.

Your window will look similar to this for adding an IRC network.

Your window will look similar to this for adding an IRC network.

The information for freenode is listed below for you to add to ZNC. If you wish to connect to a different IRC network, please refer to the server information provided by that network.

  • Network Name: freenode
  • Nickname, alt. nickname, ident, and real name can be left blank. They will be inherited from your user’s global settings that we set earlier.
  • Servers of this IRC network: chat.freenode.net +6697
  • Modules:
    • Modules are convenient “extras” that can make your IRC experience more customized or smoother. The full list can be found on the ZNC wiki, but experiment with ones you think you would find useful!
    • Some of my favorites are: crypt, keepnick, kickrejoin, simple_away.

Once you finish, select Save and return.

The last step is to add some channels. You can do this in the network configuration page for the network you just configured. This is the easiest part! Look for the section on the page that mentions channels and select Add. You’ll be greeted by a few different options, but for our purposes, only two are relevant.

Easy as 1,2,3 - add your favorite IRC channels and you're ready to go!

Easy as 1,2,3 – add your favorite channels and you’re ready to go!

Channel Name is the name of a channel you want to join, such as #fedora. The other setting you may find useful is Buffer Count. The buffer count is how many messages will be stored in the history for a particular channel when you log into IRC after being away. For most channels, 50 lines is probably plenty. But if you’re in a particularly chatty channel and don’t want to miss any messages, you can bump this setting to 200 or even 500 lines.

Final Steps

Now that ZNC is fully configured, start the service and make sure it automatically starts itself if the server ever reboots. To do that, run the following commands:

$ sudo systemctl start znc
$ sudo systemctl enable znc

ZNC is now up and running on your server, and you can use your IRC client to connect.

Setting Up Your IRC Client

Now that the hard work is done, you should configure your IRC client to use your ZNC bouncer service. A popular IRC client available in Fedora is the HexChat client. But there are plenty of options for you to find what works best for you.

Change the generic information to the address and password for your ZNC IRC bouncer.

Change the generic information to the address and password for your server.

Instead of adding the settings for an IRC network to your client, you’ll add information for your bouncer. The screenshot shows an example of how this might look for you.

The server password is how you authenticate to your bouncer. Instructions for how to connect are at the top of the ZNC page for your user. They’re generally formatted as username/network_name:password. You can refer to the ZNC wiki for more information about connecting with your IRC client.

Once you’re finished adding the network, you can connect to the network. Now you never have to worry about missing another message in an IRC channel again!

Fedora Contributor Community Fedora Project community For System Administrators Using Software

17 Comments

  1. Bram

    Or you could run a textual IRC client, like irssi, and have it run inside a screen or tmux session, that you can attach to or deattach from at will.

    • @Bram: Actually I do both; the ability of znc to transparently “remember” channels without changing the config file is very helpful for me when using irssi.

  2. Do you plan to do a second post outlining some of the modules? I was confused with the number of options I got when I installed ZNC on my CentOS server. It will ask you to install some modules for admin and some of users.
    My IRC client Konversation highlights my nick. ZNC by default has a buffer size of say 500 lines or

    MaxBufferSize = 500

    . If there’s more than 500 messages between when someone highlight’s your nick and you open your client, then you lose the highlight. If you set the MaxBufferSize to an infinitely large number then you face memory problems. How do you solve the problem of notification such as provided by Slack or IRCCloud?
    If you use log module how would you get them locally on a regular basis? In your case I think znc logs will be in /var/lib/znc/.znc folder user znc:znc user and group.
    If for some reason you can’t run a server there are some free hosted ZNC providers like https://firrre.com/.
    Does Fedora provides ZNC instances for its official contributors if there is such a thing?

    • Hi Sudhir, I hadn’t considered doing a second post for the modules, but it is certainly something I will consider now. On CentOS 6, the version in the repos is slightly older, and it has some additional prompts when installing and setting up ZNC. However, it is mostly the same as with CentOS 7 or a recent version of Fedora. When I was writing my instructions, I tested both with Fedora 22/23 and CentOS 7. As for the logs, you could probably use a script or something similar to sync them to a local directory on your machine for easy offline viewing. As for official Fedora IRC bouncers, there is not such a service, but there are plenty of ZNC providers out there that you can use for free. 🙂

  3. Super useful! Thanks Justin.

  4. Dan Mossor

    the two firewall-cmd commands you use are no longer the “accepted” method of turning on services in firewalld. It should be:

    sudo firewall-cmd –add-port=/tcp
    sudo firewall-cmd –runtime-to-permanent

    This will convert the currently running firewall configuration to the permanent configuration without turning the firewall off to do so (which is what ‘–reload’ does).

    Otherwise, this is the article I’ve been looking for – as of yet, I’ve been unable to get ZNC working – I got stuck on the SASL certs for freenode. Hopefully, I’ll figure that out this time…

    • Thanks for this info, Dan! I just learned something new myself. I updated the article to reflect that info. I’m glad you found the article useful!

  5. Which is the skin that you use for web admin.. i cant seem to find it.

    • In this article, the skin I used was the “Ice” skin. It isn’t the default – in retrospect, I probably should have stuck with the default skin.

  6. Brian Vaughan

    I was glad to see this, for the simple reason that IRC is underrated in the social media environment, despite having hundreds of thousands of users at any given moment.

    One advantage to using ZNC is that you can attach to your ZNC session from different devices and pick right up where you left off.

    • Logan Byrd

      IRC is great as a platform. Of course, since most of those users you mention are actually afk 99% of the time and using bouncers to stay connected, actually having a conversation with them is next to impossible, and speaking in a channel with 50-100 members is likely to net you one response, if any.

  7. he no

    anyone got it working with FiSH-BLOW ? when i add a fish-key it don’t decrypt the chat, it looks like it tries and give me bogus characters !

    i have tried to use ZNC with out ssl also but no luck =/

    any ideas ?

  8. Ryan

    Who invented IRC ?

  9. Sriram Ramkrishna

    I use matrix now to connect to IRC and get some of the benefits of slack while still using IRC.

  10. Jay Aurabind

    +1 for Matrix!

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions

%d bloggers like this: