Difference between revisions of "IPv6/Cheatsheet"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:IPv6 Cheatsheet}} |
{{DISPLAYTITLE:IPv6 Cheatsheet}} |
||
[[Category:IPv6]] [[Category:Mail]] |
|||
== SMTP == |
== SMTP == |
||
Line 34: | Line 35: | ||
This is a test mail sent using the IPv6 protocol. |
This is a test mail sent using the IPv6 protocol. |
||
Use curl to send the mail. |
|||
curl <span class="highlight">--ipv6</span> \ |
|||
<span class="highlight">--trace-ascii mailtrace.txt</span> \ |
|||
--mail-from <span class="input">"whoever@example.com"</span> \ |
|||
--mail-rcpt <span class="input">"recipient@example.com"</span> \ |
|||
-T mail.txt \ |
|||
'smtp://mx1.big-isp.com:25/' |
|||
To ensure IPv6 is used set the <tt>--ipv6</tt> option. |
|||
While optional the <tt>--trace-ascii</tt> writes every action into a file for debugging. Below is a little excerpt |
|||
== Info: About to connect() to <span class="highlight">mx1.big-isp.com</span> port 25 (#0) |
|||
== Info: Trying <span class="highlight">2001:db8::f00:b4:25...</span> |
|||
== Info: connected |
|||
== Info: Connected to <span class="highlight">mx1.big-isp.com (2001:db8::f00:b4)</span> port 25 (#0) |
|||
== Info: SMTP 0x118f740 state change from STOP to SERVERGREET |
|||
<= Recv header, 43 bytes (0x2b) |
|||
0000: 220 <span class="highlight">mx1.big-isp.com</span> ESMTP Postfix |
|||
=> Send header, 15 bytes (0xf) |
|||
0000: EHLO mail.txt |
|||
[...] |
Latest revision as of 16:35, 14 December 2017
SMTP
Checking if the MTA is IPv6 Ready
There are a lot of SMTP server out there that are actually IPv6 ready but this fact is not reflected in the MX record. This hack lets one test the connectivity of prior to amending the MX records in DNS.
Finding the AAAA record of the MTA
Get the MX record.
$ dig +short mx example.com 10 mail.example.com.
Do a reverse lookup of the IP address
$ dig +short -x $(dig +short mail.example.com) mx1.big-isp.com.
Take the resulting name and see if an AAAA record exists.
$ dig +short aaaa mx1.big-isp.com. 2001:db8::f00:b4
Or for the impatient
$ domain=example.com $ dig +short aaaa $(dig +short -x $(dig +short $(dig +short mx $domain | awk '{print $2}'))) 2001:db8::f00:b4
Sending a test message with curl
With the preliminary checks done the next thing is to send a test message to a recipient over IPv6 using curl.
Create a plain text file with content similar to this one for the purpose of this example the file is called mail.txt
From "IPv6 Mail Test" <whoever@example.com> To: "Recipient" <recipient@example.com> Subject: Test Mail via IPv6 This is a test mail sent using the IPv6 protocol.
Use curl to send the mail.
curl --ipv6 \ --trace-ascii mailtrace.txt \ --mail-from "whoever@example.com" \ --mail-rcpt "recipient@example.com" \ -T mail.txt \ 'smtp://mx1.big-isp.com:25/'
To ensure IPv6 is used set the --ipv6 option.
While optional the --trace-ascii writes every action into a file for debugging. Below is a little excerpt
== Info: About to connect() to mx1.big-isp.com port 25 (#0) == Info: Trying 2001:db8::f00:b4:25... == Info: connected == Info: Connected to mx1.big-isp.com (2001:db8::f00:b4) port 25 (#0) == Info: SMTP 0x118f740 state change from STOP to SERVERGREET <= Recv header, 43 bytes (0x2b) 0000: 220 mx1.big-isp.com ESMTP Postfix => Send header, 15 bytes (0xf) 0000: EHLO mail.txt [...]