version=pmwiki-2.2.130 ordered=1 urlencoded=1 agent=Mozilla/5.0 (X11; OpenBSD amd64; rv:82.0) Gecko/20100101 Firefox/82.0 author=jrmu charset=UTF-8 csum= ctime=1597223083 host=125.224.19.86 name=Openbsd.Netcat rev=6 targets=Openbsd.Mailopenproxy text=(:title Troubleshooting with netcat:)%0a%0anetcat 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.%0a%0a!! Debugging IRC%0a%0aTo test if you are able to establish an IRC connection, you can use netcat:%0a%0a[@%0a$ nc irc.ircnow.org 6667%0aNICK newnick%0aUSER newuser * * :newuser%0aPING: 12345%0aPONG: 12345%0a@]%0a%0a'''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.%0a%0aIf you successfully see the message of the day (MOTD) and other replies from the IRC server, then the IRC connection has succeeded.%0a%0aYou can specifically use netcat to test if an IPv6 address is working:%0a%0a[@%0a$ nc -s 2001:0db8:: ipv6.ircnow.org 6667%0aNICK newnick%0aUSER newuser * * :newuser%0aPING :12345%0aPONG :12345%0a@]%0a%0aThis 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.%0a%0aYou should see something like the following from the server's reply:%0a%0a[@%0a:irc.example.ircnow.org 396 newnick 2001:0db8:20:b4:f117:2f18:11eb:3a85 :is your displayed h%0aostname now%0a:newnick!newnick@2001:0db8:20:b4:f117:2f18:11eb:3a85 MODE newnick :+iC%0a@]%0a%0aIn 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:%0a%0a[@%0a:irc.example.ircnow.org 396 newnick newnick.example.ircnow.org :is your displayed hostname now%0a:newnick!newnick@newnick.example.ircnow.org MODE newnick :+iC%0a@]%0a%0aTo check your vhost, type @@WHOIS newnick@@:%0a%0a[@%0aWHOIS newnick%0a:irc.example.ircnow.org 311 newnick newnick newnick 2001:0db8:: * :newuser%0a:irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org%0a:irc.example.ircnow.org 378 newnick newnick :is connecting from *@2001:0db8::%0a:irc.example.ircnow.org 379 newnick newnick :is using modes +iC%0a:irc.example.ircnow.org 317 newnick newnick 15 1597224116 :seconds idle, signon time%0a:irc.example.ircnow.org 318 newnick newnick :End of WHOIS list%0a@]%0a%0aIn this above example, the vhost is not showing up properly. If it shows up properly, you should see something like this:%0a%0a[@%0a:irc.example.ircnow.org 311 newnick newnick newnick newnick.example.ircnow.org * :newnick%0a:irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org%0a:irc.example.ircnow.org 378 newnick newnick :is connecting from *@newnick.example.ircnow.org 2001:0db8:20:b4:f8fb:b8fa:9812:2562%0a:irc.example.ircnow.org 379 newnick newnick :is using modes +iC%0a:irc.example.ircnow.org 317 newnick newnick 86 1597224404 :seconds idle, signon time%0a:irc.example.ircnow.org 318 newnick newnick :End of WHOIS list%0a@]%0a%0aTo join a channel:%0a%0a[@%0aJOIN #ircnow%0a@]%0a%0aTo part a channel:%0a%0a[@%0aPART #ircnow%0a@]%0a%0aTo send a message to a channel or user:%0a%0a[@%0aPRIVMSG #ircnow :Hello, world!%0aPRIVMSG Mom :Look ma, no client!%0a@]%0a%0aTo identify with NickServ:%0a%0a[@%0aPRIVMSG Nickserv :identify PASSWORD%0a@]%0a%0aTo quit, just type CTRL+C.%0a%0a!! Debugging SMTP%0a%0aYou can use netcat to test for SMTP errors such as [[openbsd/mailopenproxy|open mail relays]].%0a%0aHere's how to send a simple letter:%0a%0a[@%0a$ nc ircnow.org 25 %0a220 ircnow.org ESMTP OpenSMTPD%0a@]%0a%0aNext, we type HELO followed by our sending domain:%0a%0a[@%0aHELO example.com%0a250 ircnow.org Hello example.com [38.81.163.143], pleased to meet you%0a@]%0a%0aAfterwards, we type our sending mail address:%0a%0a[@%0aMAIL FROM: %3ctest@example.com>%0a250 2.0.0 Ok%0a@]%0a%0aAnd the destination mail address:%0a%0a[@%0aRCPT TO: %3cjrmu@ircnow.org>%0a250 2.1.5 Destination address valid: Recipient ok%0a@]%0a%0aThen we type DATA followed by our email:%0a%0a[@%0aDATA%0a354 Enter mail, end with "." on a line by itself%0aSubject: Alpha Bravo Charlie Delta%0a%0aEcho Foxtrot Golf Hotel%0a@]%0a%0aWe then type . to end the email, then QUIT:%0a%0a[@%0a.%0a250 2.0.0 e57f9a36 Message accepted for delivery%0aQUIT%0a221 2.0.0 Bye%0a@]%0a%0aHere's the complete process:%0a%0a[@%0a$ nc ircnow.org 25 %0a220 ircnow.org ESMTP OpenSMTPD%0aHELO example.com%0a250 ircnow.org Hello example.com [38.81.163.143], pleased to meet you%0aMAIL FROM: %3ctest@example.com>%0a250 2.0.0 Ok%0aRCPT TO: %3cjrmu@ircnow.org>%0a250 2.1.5 Destination address valid: Recipient ok%0aDATA%0a354 Enter mail, end with "." on a line by itself%0aSubject: Alpha Bravo Charlie Delta%0a%0aEcho Foxtrot Golf Hotel%0a.%0a250 2.0.0 e57f9a36 Message accepted for delivery%0aQUIT%0a221 2.0.0 Bye%0a@]%0a%0a%0a!! Debugging Web Servers time=1610202009 title=Troubleshooting with netcat author:1610202009=jrmu diff:1610202009:1602944792:=99,170d98%0a%3c %0a%3c You can use netcat to test for SMTP errors such as [[openbsd/mailopenproxy|open mail relays]].%0a%3c %0a%3c Here's how to send a simple letter:%0a%3c %0a%3c [@%0a%3c $ nc ircnow.org 25 %0a%3c 220 ircnow.org ESMTP OpenSMTPD%0a%3c @]%0a%3c %0a%3c Next, we type HELO followed by our sending domain:%0a%3c %0a%3c [@%0a%3c HELO example.com%0a%3c 250 ircnow.org Hello example.com [38.81.163.143], pleased to meet you%0a%3c @]%0a%3c %0a%3c Afterwards, we type our sending mail address:%0a%3c %0a%3c [@%0a%3c MAIL FROM: %3ctest@example.com>%0a%3c 250 2.0.0 Ok%0a%3c @]%0a%3c %0a%3c And the destination mail address:%0a%3c %0a%3c [@%0a%3c RCPT TO: %3cjrmu@ircnow.org>%0a%3c 250 2.1.5 Destination address valid: Recipient ok%0a%3c @]%0a%3c %0a%3c Then we type DATA followed by our email:%0a%3c %0a%3c [@%0a%3c DATA%0a%3c 354 Enter mail, end with "." on a line by itself%0a%3c Subject: Alpha Bravo Charlie Delta%0a%3c %0a%3c Echo Foxtrot Golf Hotel%0a%3c @]%0a%3c %0a%3c We then type . to end the email, then QUIT:%0a%3c %0a%3c [@%0a%3c .%0a%3c 250 2.0.0 e57f9a36 Message accepted for delivery%0a%3c QUIT%0a%3c 221 2.0.0 Bye%0a%3c @]%0a%3c %0a%3c Here's the complete process:%0a%3c %0a%3c [@%0a%3c $ nc ircnow.org 25 %0a%3c 220 ircnow.org ESMTP OpenSMTPD%0a%3c HELO example.com%0a%3c 250 ircnow.org Hello example.com [38.81.163.143], pleased to meet you%0a%3c MAIL FROM: %3ctest@example.com>%0a%3c 250 2.0.0 Ok%0a%3c RCPT TO: %3cjrmu@ircnow.org>%0a%3c 250 2.1.5 Destination address valid: Recipient ok%0a%3c DATA%0a%3c 354 Enter mail, end with "." on a line by itself%0a%3c Subject: Alpha Bravo Charlie Delta%0a%3c %0a%3c Echo Foxtrot Golf Hotel%0a%3c .%0a%3c 250 2.0.0 e57f9a36 Message accepted for delivery%0a%3c QUIT%0a%3c 221 2.0.0 Bye%0a%3c @]%0a%3c %0a host:1610202009=125.224.19.86 author:1602944792=jrmu diff:1602944792:1602944781:=17c17%0a%3c '''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.%0a---%0a> '''WARNING''': Do not ever connect 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.%0a host:1602944792=125.231.17.204 author:1602944781=jrmu diff:1602944781:1597224616:=16,17d15%0a%3c %0a%3c '''WARNING''': Do not ever connect 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.%0a host:1602944781=125.231.17.204 author:1597224616=jrmu diff:1597224616:1597223421:=5,8c5,8%0a%3c !! Debugging IRC%0a%3c %0a%3c To test if you are able to establish an IRC connection, you can use netcat:%0a%3c %0a---%0a> !! Testing Networking%0a> %0a> To test if an IPv6 address is working, you can use netcat to connect to an IRC network that supports IPv6:%0a> %0a10,14c10,14%0a%3c $ nc irc.ircnow.org 6667%0a%3c NICK newnick%0a%3c USER newuser * * :newuser%0a%3c PING: 12345%0a%3c PONG: 12345%0a---%0a> $ nc -s 2001:0db8:: ipv6.ircnow.org 6667%0a> nick newnick%0a> user newuser * * :newuser%0a> PING :12345%0a> PONG :12345%0a17,98c17,21%0a%3c If you successfully see the message of the day (MOTD) and other replies from the IRC server, then the IRC connection has succeeded.%0a%3c %0a%3c You can specifically use netcat to test if an IPv6 address is working:%0a%3c %0a%3c [@%0a%3c $ nc -s 2001:0db8:: ipv6.ircnow.org 6667%0a%3c NICK newnick%0a%3c USER newuser * * :newuser%0a%3c PING :12345%0a%3c PONG :12345%0a%3c @]%0a%3c %0a%3c 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.%0a%3c %0a%3c You should see something like the following from the server's reply:%0a%3c %0a%3c [@%0a%3c :irc.example.ircnow.org 396 newnick 2001:0db8:20:b4:f117:2f18:11eb:3a85 :is your displayed h%0a%3c ostname now%0a%3c :newnick!newnick@2001:0db8:20:b4:f117:2f18:11eb:3a85 MODE newnick :+iC%0a%3c @]%0a%3c %0a%3c 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:%0a%3c %0a%3c [@%0a%3c :irc.example.ircnow.org 396 newnick newnick.example.ircnow.org :is your displayed hostname now%0a%3c :newnick!newnick@newnick.example.ircnow.org MODE newnick :+iC%0a%3c @]%0a%3c %0a%3c To check your vhost, type @@WHOIS newnick@@:%0a%3c %0a%3c [@%0a%3c WHOIS newnick%0a%3c :irc.example.ircnow.org 311 newnick newnick newnick 2001:0db8:: * :newuser%0a%3c :irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org%0a%3c :irc.example.ircnow.org 378 newnick newnick :is connecting from *@2001:0db8::%0a%3c :irc.example.ircnow.org 379 newnick newnick :is using modes +iC%0a%3c :irc.example.ircnow.org 317 newnick newnick 15 1597224116 :seconds idle, signon time%0a%3c :irc.example.ircnow.org 318 newnick newnick :End of WHOIS list%0a%3c @]%0a%3c %0a%3c In this above example, the vhost is not showing up properly. If it shows up properly, you should see something like this:%0a%3c %0a%3c [@%0a%3c :irc.example.ircnow.org 311 newnick newnick newnick newnick.example.ircnow.org * :newnick%0a%3c :irc.example.ircnow.org 312 newnick newnick irc.example.ircnow.org :irc.example.ircnow.org%0a%3c :irc.example.ircnow.org 378 newnick newnick :is connecting from *@newnick.example.ircnow.org 2001:0db8:20:b4:f8fb:b8fa:9812:2562%0a%3c :irc.example.ircnow.org 379 newnick newnick :is using modes +iC%0a%3c :irc.example.ircnow.org 317 newnick newnick 86 1597224404 :seconds idle, signon time%0a%3c :irc.example.ircnow.org 318 newnick newnick :End of WHOIS list%0a%3c @]%0a%3c %0a%3c To join a channel:%0a%3c %0a%3c [@%0a%3c JOIN #ircnow%0a%3c @]%0a%3c %0a%3c To part a channel:%0a%3c %0a%3c [@%0a%3c PART #ircnow%0a%3c @]%0a%3c %0a%3c To send a message to a channel or user:%0a%3c %0a%3c [@%0a%3c PRIVMSG #ircnow :Hello, world!%0a%3c PRIVMSG Mom :Look ma, no client!%0a%3c @]%0a%3c %0a%3c To identify with NickServ:%0a%3c %0a%3c [@%0a%3c PRIVMSG Nickserv :identify PASSWORD%0a%3c @]%0a%3c %0a%3c To quit, just type CTRL+C.%0a%3c %0a%3c !! Debugging SMTP%0a%3c %0a%3c !! Debugging Web Servers%0a\ No newline at end of file%0a---%0a> If that loads a message, then you configured the IPv6 address 2001:0db8:: correctly.%0a> %0a> !! Debugging Code%0a> %0a> !! Debugging Applications%0a\ No newline at end of file%0a host:1597224616=38.81.163.143 author:1597223421=jrmu diff:1597223421:1597223083:=1,6c1%0a%3c (:title Troubleshooting with netcat:)%0a%3c %0a%3c 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.%0a%3c %0a%3c !! Testing Networking%0a%3c %0a---%0a> %0a9c4%0a%3c [@%0a---%0a> %3ccode>%0a15,21c10,12%0a%3c @]%0a%3c %0a%3c If that loads a message, then you configured the IPv6 address 2001:0db8:: correctly.%0a%3c %0a%3c !! Debugging Code%0a%3c %0a%3c !! Debugging Applications%0a\ No newline at end of file%0a---%0a> %3c/code>%0a> %0a> If that loads a message, then you configured the IPv6 address 2001:0db8:: correctly.%0a\ No newline at end of file%0a host:1597223421=38.81.163.143 author:1597223083=jrmu diff:1597223083:1597223083:=1,12d0%0a%3c %0a%3c To test if an IPv6 address is working, you can use netcat to connect to an IRC network that supports IPv6:%0a%3c %0a%3c %3ccode>%0a%3c $ nc -s 2001:0db8:: ipv6.ircnow.org 6667%0a%3c nick newnick%0a%3c user newuser * * :newuser%0a%3c PING :12345%0a%3c PONG :12345%0a%3c %3c/code>%0a%3c %0a%3c If that loads a message, then you configured the IPv6 address 2001:0db8:: correctly.%0a\ No newline at end of file%0a host:1597223083=38.81.163.143