Troubleshooting with netcat
netcat is the swiss-army knife of networking. It is an extremely valuable tool to help diagnose any networking errors. You can and should use it often when working on sysadmin and writing code.
openssl s_client provides the same functionality but for encrypted connections.
IPv4 Connections
To test if you are able to establish an IRC connection, you can use netcat or openssl for encrypted connections:
openssl
$ openssl s_client -connect irc.ircnow.org:6697
You will be presented with details from the certificate verification before coming to a blank line if the connection was successful. This is your prompt for beginning the Connection Registration step below.
netcat
$ nc irc.ircnow.org 6667
You will be presented with a blank line if the connection was successful. This is your prompt for the Connection Registration step below.
Connection Registration
Once connected, you need to identify yourself by typing the following.
NICK newnick
USER newuser * * :newuser
You may be challenged with a PING, which you must respond to with a PONG followed by the token received in the PING.
PING: 12345
PONG: 12345
WARNING: Do not ever connect to IRC as root. Some networks will gline your entire IP address if you attempt to connect as root because you will appear to be a drone.
If you successfully see the message of the day (MOTD) and other replies from the IRC server, then the IRC connection has succeeded.
IPv6 Connections
openssl
$ openssl s_client -6 -connect irc.ircnow.org:6697
netcat
You can specifically use netcat to test if an IPv6 address is working:
$ nc -s 2001:0db8:: ipv6.ircnow.org 6667
This will cause netcat to bind to the IPv6 address 2001:0db8::. If you configured the IPv6 address 2001:0db8:: correctly, you should be able to see the MOTD.
You should see something like the following from the server's reply:
:irc.example.ircnow.org 396 newnick 2001:0db8:20:b4:f117:2f18:11eb:3a85 :is your displayed hostname now
:newnick!newnick@2001:0db8:20:b4:f117:2f18:11eb:3a85 MODE newnick :+iC
In this case, the vhost is not a nice hostname, which means that either your rDNS or DNS AAAA record is not configured properly. When done properly, you should see something like:
:irc.example.ircnow.org 396 newnick newnick.example.ircnow.org :is your displayed hostname now
:newnick!newnick@newnick.example.ircnow.org MODE newnick :+iC
To check your vhost, type WHOIS newnick
:
WHOIS newnick
:irc.example.ircnow.org 311 newnick newnick newnick 2001:0db8:: * :newuser
:irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org
:irc.example.ircnow.org 378 newnick newnick :is connecting from *@2001:0db8::
:irc.example.ircnow.org 379 newnick newnick :is using modes +iC
:irc.example.ircnow.org 317 newnick newnick 15 1597224116 :seconds idle, signon time
:irc.example.ircnow.org 318 newnick newnick :End of WHOIS list
In this above example, the vhost is not showing up properly. If it shows up properly, you should see something like this:
:irc.example.ircnow.org 311 newnick newnick newnick newnick.example.ircnow.org * :newnick
:irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org
:irc.example.ircnow.org 378 newnick newnick :is connecting from *@newnick.example.ircnow.org 2001:0db8:20:b4:f8fb:b8fa:9812:2562
:irc.example.ircnow.org 379 newnick newnick :is using modes +iC
:irc.example.ircnow.org 317 newnick newnick 86 1597224404 :seconds idle, signon time
:irc.example.ircnow.org 318 newnick newnick :End of WHOIS list
Joining and Parting Channels
To join a channel:
JOIN #ircnow
To part a channel:
PART #ircnow
Sending Messages
To send a message to a channel or user:
PRIVMSG #ircnow :Hello, world!
PRIVMSG Mom :Look ma, no client!
NickServ
To identify with NickServ:
PRIVMSG Nickserv :identify PASSWORD
Quiting
To quit, just type CTRL+C.