Never leave IRC again with ZNC

Internet Relay Chat, or IRC, is an online chat protocol created in 1988. IRC is a network of large chat rooms called channels. Each channel lets members of a community talk with each other from around 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 users are always in the channel each time you connect. Are they really 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 keeps you connected to your preferred IRC networks and channels even when you are away. Instead of connecting directly to an IRC network such as irc.example.com, you connect to a proxy like bouncer.mysite.com which runs the bouncer software. The bouncer, in turn, connects to the IRC network. When you log into your bouncer, it “replays” messages in your channels you missed while offline, as well as private messages from other users.

What is ZNC?

ZNC is bouncer software that provides this awesome set of features. ZNC is already in Fedora software repositories for you to install. You too can have your own ZNC bouncer up and running and never have to leave an IRC channel again! This article explains how to install ZNC on Fedora and how to configure an IRC client to connect to ZNC.

Install ZNC

First, make sure your server is publicly accessible on the Internet. The port for your IRC bouncer should be open. Usually, this is port 6667 for an unencrypted connection or 6697 for an encrypted TLS connection. Use firewalld to configure your firewall as follows:

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

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 pressed 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]: # default to yes unless you must prevent IPv6 traffic
-- Admin user settings --
Username (alphanumeric): jwf
Enter password:
Confirm password:
Nick [jwf]:
Alternate nick [jwf_]:
Ident [jwf]:
Real name [Got ZNC?]: Justin W. Flory
Bind host (optional):

If you wish to set up an IRC network from the command line, you can. If not, you can do this later from the web interface.

Launch ZNC now? (yes/no) [yes]:

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

Success, you made it to your ZNC web panel!

Finish configuration in web interface

Once you log into the web interface, there are several different options. Find the user account set up earlier and edit the user to add an IRC network. For this article, we’ll add a popular IRC network, freenode.

Your window will look similar to this for adding a 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 connection 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” to customize the IRC experience. The full list is found on the ZNC wiki.
    • Some of my favorites: keepnick, simple_away

Once you finish, select Save and return.

The last step is to add channels. You can do this in the network configuration page for the network you added. Look for the section on the page that mentions channels and select Add. There are a few different options, but for beginners, only two matter.

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-magazine. 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 likely enough. But if you are in an active channel and don’t want to miss any messages, bump this setting to 200 or even 500 messages.

Final steps

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

sudo systemctl enable znc --now

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

Use Ansible to deploy ZNC

Do you want to automate installing ZNC? Check out this Ansible Galaxy role for quick set-up with Ansible for a CentOS 7.x host. See how it works on GitHub.

Set up an IRC client

Now that the hard work is done, it is time to configure an IRC client to use your ZNC bouncer service. A popular IRC client available in Fedora is the HexChat client. However, there are several options to choose from. Use what works best for you.

Instead of configuring an IRC network in the client, add information for your ZNC server. The screenshot shows an example of how this might look for HexChat users:

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

ZNC requires a server password to authenticate. Connection instructions are shown at the top of a ZNC IRC network 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 add 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 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