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.
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</port>
Afterwards, run the following command to install ZNC:
sudo dnf install znc
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
Alternate nick [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.
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.
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 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.
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.
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
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:
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!