This has been copied from http://area51archives.com/index.php?title=Using_ZNC_with_Tor&action=edit
Follow the instructions at the tor installation guide.
The installation page gives you an easy walkthrough on compiling and install ZNC for your distribution of choice. This page will have the most up to date version listed quicker than the PPA listed below. For novices, the PPA should serve to be easier to maintain, but comes with a potential lapse of updates. It's your choice.
For Ubuntu-based distros, please refer to the Ubuntu section in the installation guide to install ZNC.
After you have compiled and/or installed znc, you need to configure znc before continuing by running:
At the end of the makeconf screen when it asks if you would like to launch ZNC, select "no."
Tor ships with a SOCKS proxy which is used to tunnel traffic through the Tor network. ZNC doesn't have the option to use SOCKS proxies, that's where ProxyChains comes in. ProxyChains allows you to force an application to use a SOCKS proxy. Luckily, ProxyChains is configured to work with Tor out of the box! You may already have ProxyChains installed. If not, it's a simple run of this command to get it:
sudo apt-get install proxychains
If you are not able to get it via apt, or are not using Ubuntu, you can acquire the source from the ProxyChains website.
At this point, you can simply run proxychains znc from the command line. This will start up znc and tunnel its connections via Tor. However, it will not work if you attempt to connect to .onion addresses. If you run znc as a system service, then you'll need to edit that config file to launch znc via proxychains. What we will have to do instead, is map an IP address in the Tor configuration to resolve to the .onion address. This is annoying, but it's really your only shot of making this work. You will want to use an IP range that you will not use, and never plan on using. Let's say you want to connect to 2600net. The .onion address is awwqg2ishrohngue.onion. You would need to open the /etc/tor/torrc file and add at the end of the file:
mapaddress 10.99.99.90 awwqg2ishrohngue.onion
If you were to try to connect to freenode's hidden service (via tor-sasl), you would instead add at the end of the /etc/tor/torrc file:
mapaddress 10.99.99.90 freenodeok2gncmy.onion
Save the file, and restart Tor using:
sudo /etc/init.d/tor restart
...and now you will be able to connect to that .onion address in ZNC by using the server address of 10.99.99.90. For each .onion address you would like to resolve, just add another mapaddress line.