How to install and use ZNC to stay connected on IRC

Using internet relay chat on multiple devices can be challenging. Here's how ZNC can be used to stay connected to IRC networks on multiple devices.

Though Slack has been growing in popularity for in-group communication since it launched in August 2013, internet relay chat (IRC) remains a popular resource in many technical circles. Given the decentralized nature of IRC networks, the ubiquity of IRC clients on modern computers, and continued client support for legacy or minority platforms such as OS/2, IRC continues to remain relevant while centralized services like AOL Instant Messenger have fallen by the wayside.

SEE: Software usage policy template (Tech Pro Research)

However, in the age of smartphones and cloud computing, staying connected to IRC and managing connections on a single network can be a challenge. Maintaining a persistent connection to an IRC network on a smartphone during your daily commute can be challenging, particularly in metropolitan areas where signals in facilities such as train stations can be weak. Additionally, switching between multiple devices is troublesome, as conversation history does not migrate with the current connection. With a bounced network connection (BNC) managing your IRC connections, the rough edges of IRC can be smoothed over.

What is a BNC?

Think of a BNC as a stateful proxy. While simple proxy servers do not maintain connections or sessions after the client disconnects, a BNC maintains your connection on IRC even when your IRC client disconnects. To do so, BNC software must be running on a server, which your IRC client will connect to. Any computer with a constant connection to the internet can act as a BNC server. Generally, a cloud server with a static IP address from providers such as DigitalOcean, Vultr, or Scaleway are sufficient. A Raspberry Pi is also capable, as long as it is connected to a reliable network.

Because a BNC server acts as an intermediary, the IP address of the device acting as the server is visible to the network, rather than the IP address of the device running the IRC client. The persistent connection of BNC servers allow users to share a single IRC nickname on multiple devices, as well as maintain a buffer of chat messages which can be sent to clients when they reconnect. ZNC, a popular BNC for IRC, supports these and other features through a module system.

Installing ZNC

As with any program—and particularly for servers—using the latest available version is highly recommended to prevent security issues. While the latest versions of Debian, Ubuntu, Fedora, and CentOS (via EPEL) have properly updated versions of ZNC, older versions of Debian (wheezy, jessie) and Ubuntu (Trusty 14.04) should not be used.

For this article, ZNC is being installed on Ubuntu 17.10 (Artful Aardvark). Other distributions should be able to install the package "znc" using their native package manager.

As any non-root user, type:

sudo apt-get install znc znc-dev znc-perl znc-python znc-tcl

After installing ZNC and the necessary dependencies, you can initialize ZNC using

znc --makeconf

From here, the configuration script will prompt for initial setup values. Generally, the default values will work in most situations. For port assignments, anything from 1025 to 65534 is acceptable. For this example, 7077 is used, as nothing is typically known to use that port.

Next, you'll set up your username and default network configuration—if you are new to IRC, the default suggestion of Freenode works well. (You should join ##linux as well.)

SEE: Digital Transformation: A CXO's Guide (ZDNet)

After initial setup, you can use the web management interface by pointing your browser to the IP address of the server running ZNC, and the port number specified during setup. From here, you can manage additional networks and channels to connect to, or add additional users to your ZNC server. Configuration of modules can also be done in the web interface. Among others, modules exist to log the entire IRC session, detach from a server when flooded, grant shell access via IRC to administrators in ZNC, create an autoreply when you are away, and enable a control panel for administering ZNC from inside your IRC client.

Naturally, if for any reason your server reboots (or loses network connectivity), ZNC will lose network connectivity. To automatically start ZNC on boot, use the following command:

sudo systemctl enable znc.service

Also see

      Image: iStockphoto/Rawpixel

      About James Sanders

      James Sanders is a Java programmer specializing in software as a service and thin client design, and virtualizing legacy programs for modern hardware.

      Editor's Picks

      Free Newsletters, In your Inbox