Enabling IPV6 in CentOS (for sending and receiving mail)
Scope: Instructions for implementing IPv6 on CentOS for using Postfix mail. Includes updating MX records, IPv4/IPv6 conversions, network interface configuration, and Postfix configuration files.
You will also need to configure your Outlook email client per "My outgoing server requires authentication". You will need to add each client's NATted IPv4/IPv6 address in the Postfix config file.
For Troubleshooting this process, see TROUBLESHOOTING at the bottom of this document. For URL's used, see SOURCES after Troubleshooting.
IPv6 is "the future", more importantly many mail servers (like Google) won't accept email if your mail server's DNS record doesn't have a AAAA record, IPv6 enabled on your mail server, and your IPv6 addresses in your Postifix config (if your mail is "external" to your client like mine). So, there are a few steps needed.
1. Configuring IPv6 on the mail server.
You will need the IPv6 address of your gateway and your server. You can use https://www.ultratools.com/tools/decimalCalc to convert IPv4 to IPv6. For example, I need the following info:
mail.tpfnd.cat 18.104.22.168 0:0:0:0:0:ffff:ac0d:2f6b IPV6 Compressed: ::ffff:ac0d:e6f (this will be used for the DNS updated zone file) gateway 22.214.171.124 0:0:0:0:0:ffff:ac0d:2f6e
You'll probably need https://www.crucial.com.au/blog/2011/04/15/ipv6-subnet-cheat-sheet-and-ipv6-cheat-sheet-reference/ to get the right subnet. I have a /29 on IPv4, so the corresponding IPv6 is /125. You can also use ultratools to get the IPv6 for for first IP and the last IP, and then use https://www.ultratools.com/tools/rangeToipv6CIDR to get the subnetting
the two files you'll need to work with on your server:
/etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 (might be ifcfg-eth1 or another number for your configuration)
You’ll need to add a default gateway for your IPv6 IP address(es) and enable IPv6, add the following lines (change the IP address with your own IP address) to /etc/sysconfig/network:
IPV6_DEFAULTGW=0:0:0:0:0:ffff:ac0d:2f6e NETWORKING_IPV6=yes IPV6_AUTOCONF=no
Now we are going to assign an IPv6 address to an interface, we’ll edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add these lines (changing the IP to your particular IP):
IPV6INIT="yes" IPV6ADDR="0:0:0:0:0:ffff:ac0d:2f6b/125" IPV6FORWARDING="no" IPV6_AUTOCONF="no"
Then, restart your networking: service network restart
Now ping Google.com to see if it’s working:
Which should give you:
PING ipv6.google.com(2001:4860:b002::68) 56 data bytes 64 bytes from 2001:4860:b002::68: icmp_seq=1 ttl=59 time=93.2 ms ...
2. Add the new IPv6 info into your DNS record:
My DNS already has the following records for the mail server: mail 10800 IN A 126.96.36.199 @ 10800 IN MX 20 mail.tpfnd.cat.
so I need to add: mail 10800 IN AAAA ::ffff:188.8.131.52
the "::ffff:184.108.40.206" is the condensed IPV6, which is also given at https://www.ultratools.com/tools/decimalCalc.
Once you've submitted the DNS record, you will of course have to wait for it to be propagated but your mail should be accepted after that. Once it's propagated, you can check your AAAA at http://mxtoolbox.com/IPv6.aspx
3. Adding IPv6 allowed trusts into Postfix You'll also need to add this IPv6 information into your Postfix config. Using the ultratools.com site, you can get the IPv6 for the start and end of your range, then use the "Range to IPv6 CIDR" to get the correct range. So 0:0:0:0:0:ffff:ac0d:2f68 to 0:0:0:0:0:ffff:ac0d:2f6e is 0:0:0:0:0:ffff:ac0d:2f6c/127, and adding this to mynetworks in /etc/postfix/main.cf (on CentOS). Make sure to wrap the address in  since the : in the address will cause a 'table lookup problem' and/or a 'unsupported dictionary type':
mynetworks = 220.127.116.11/29, [0:0:0:0:0:ffff:ac0d:2f6c]/127
Convert IP to Decimal
Range to IPv6 CIDR
DNS Lookup IPv6
IPv6 Subnet Cheat Sheet and IPv6 Cheat Sheet Reference
Sendmail can not deliver to gmail - IPv6 sending guidelines regarding PTR records not met
Postfix Basic Configuration
IPv6 Postfix info
postfix RCPT TO Temporary lookup failure 451 && mail transport unavailable
Postfix SMTP server: errors