---
title: Setting up a IRC Bouncer with ZNC
tags: ZNC, Weechat, IRC
---
It's been a while since I've used IRC, but I needed to connect to it today to discuss around [Peewee](https://docs.peewee-orm.com).
The main issue with IRC is that you need to be connected to see the answer, and to get the context of the conversation. Unless... you set up a bouncer.
The bouncer is named [ZNC](https://znc.in), and the IRC client I use is [Weechat](https://weechat.org).
So, that's what I did:
## Installation of ZNC
```bash
apt install znc
sudo -u _znc /usr/bin/znc --datadir=/var/lib/znc --makeconf
sudo systemctl enable znc
```
You can answer the questions asked by `--makeconf`, it will generate you a configuration file like this (stored in `/var/lib/znc/configurations/znc.conf`):
```conf
AnonIPLimit = 10
AuthOnlyViaModule = false
ConfigWriteDelay = 0
ConnectDelay = 5
HideVersion = false
LoadModule = webadmin
MaxBufferSize = 500
ProtectWebSessions = true
SSLCertFile = /var/lib/znc/znc.pem
SSLDHParamFile = /var/lib/znc/znc.pem
SSLKeyFile = /var/lib/znc/znc.pem
ServerThrottle = 30
Version = 1.8.2
AllowIRC = true
AllowWeb = true
IPv4 = true
IPv6 = true
Port = 6697
SSL = true
URIPrefix = /
Admin = true
Allow = *
AltNick = alexis_
AppendTimestamp = false
AuthOnlyViaModule = false
AutoClearChanBuffer = true
AutoClearQueryBuffer = true
BindHost = skate.notmyidea.org
ChanBufferSize = 50
DenyLoadMod = false
DenySetBindHost = false
Ident = alexis
JoinTries = 10
LoadModule = chansaver
LoadModule = controlpanel
MaxJoins = 0
MaxNetworks = 1
MaxQueryBuffers = 50
MultiClients = true
Nick = alexis
NoTrafficTimeout = 180
PrependTimestamp = true
QueryBufferSize = 50
QuitMsg = See you :)
RealName = N/A
StatusPrefix = *
TimestampFormat = [%H:%M:%S]
FloodBurst = 9
FloodRate = 2.00
IRCConnectEnabled = true
JoinDelay = 0
LoadModule = simple_away
RealName = N/A
Server = irc.libera.chat +6697
TrustAllCerts = false
TrustPKI = true
Hash = REDACTED
Method = SHA256
Salt = REDACTED
```
You can access a web interface on the exposed port. I had to make a change in my Firefox configuration, in `about:config`, set `network.security.ports.banned.override` to `6697`, otherwise, Firefox prevents you from connecting to these ports (which might actually be a good idea).
## Weechat configuration
Now, to use this in weechat, here are some useful commands. First, get the fingerprint of the SSL certificate generated on your server:
```bash
cat /var/log/znc/znc.pem | openssl x509 -sha512 -fingerprint -noout | tr -d ':' | tr 'A-Z' 'a-z' | cut -d = -f 2
```
Then, in weechat :
```weechat
/server add znc host/6697 -tls -username= -password= -autoconnect
/set irc.server.znc.tls_fingerprint
/connect znc
```
And you should be all set!
Resources : [The ZNC Wiki on Weechat](https://wiki.znc.in/Weechat) and the [Debian page on ZNC](https://wiki.debian.org/ZNC)