Bind to local IP -- IPv6 address

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
serglogin
New user
New user
Posts: 2
Joined: 2019-06-06 15:02
Location: Finland

Bind to local IP -- IPv6 address

Post by serglogin » 2019-06-06 15:26

Hello everyone,

Is there possible to have both IPv4 and IPv6 binding for Settings - Protocols - SMTP - Advanced - Bind to local IP address ?

It would be great if Hmailserver could send outgoing emails via IPv6 if destination MX server resolves to IPv6

Thanks in advance

User avatar
Dravion
Senior user
Senior user
Posts: 1435
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Bind to local IP -- IPv6 address

Post by Dravion » 2019-06-06 17:53

In theory this sounds reasonable but in reality this can cause a lot of Problems.

First, you need to find out if the Destination server supports IPv6 or not.
On SMTP Protocol level, you only can check this if the Email comes back as undelivered. Problem is, the bounced Email will not show up immediately after sending because a typical MTA like hMailServer is trying to deliver multiple times before it gives up. Meanwhile countless other Email was handled (thats why you need to think always asynchronously). Now you need to parse and analyze the bounced Email for the Error code and you need to make sure it was really an IPv6 Problem and if it was,
you need to try a new attempt with IPv4.

I can assure you, no existing SMTP-Server can handle such situations out of the box.

But there are other nasty Problems you have to overcome to make your IPv6 SMTP-Server Ready to fly.
First you need to have a public and static IPv4 and a IPv6 address. Both IP addresses needs to be visible and on the public Internet (there is no way to run an SMTP-Server with such requirements behind a NAT-Router or a Dynamic IP). The best way to get an Windows Webserver with its own IPv4 and IPv6 Addresses is to invest in a decent Windows vServer Hosting plan (i believe Dreamhosting offers such VPS and Cloud-servers or Amazon). Second you need to have access to an IPv4 and IPv6 DNS-Server Interface or Zone files to configure your DNS-Zone for IPv4 and IPv6 DNS-Resolution (AAAA Records for IPv6). If your Hosting Provider doesn't Support a DNS-Server Interface with IPv6 Entry support you can run you own DNS-Server but if you a newbie, better change the Hosting Provider. If you are committed to the Mission, you can run your own authoritative DNS-Servers but you need to have the permissions in your Hostingpackage or your Domain Reseller Webinterface to point your own DNS-Servers (you need to DNS-Servers by International Standards, which means you need to run at least two VPS-Server Packages with two DNS-Servers like BIND in a Master/Slave Sync replication Setup for failover security (its mandatory, and will be enforced by your Domain Reseller or Hosting package Provider before DNS-Zone control will be transferred).


In the past, i have done such a task with BIND9 on Linux (CentOS7) and Postfix as MTA but it was a very complicated setup to even make the basics work. Problem was, the Dual-stack thing where you delegate Email to IPv4 or IPv6 supporting Mailservers needs to be created on top of such a setup. This is a lot of work and scripting. Yes, it should be a lot easier but now its not.

User avatar
mattg
Moderator
Moderator
Posts: 20132
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Bind to local IP -- IPv6 address

Post by mattg » 2019-06-07 01:33

If you have an IPv6 set of addresses allocated to you by your ISP, then windows will automatically PREFER the use of IPv6 over IPv4, where the recipient server accepts IPv6 addressed mail. Very few do, but gmail does.

Send a message to a gmail reciepient then check your logs.
If it doesn't go to an IPv6 address, then you don't have IPv6 enabled in all of your Operating system, LAN, WAN and DNS
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
Dravion
Senior user
Senior user
Posts: 1435
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Bind to local IP -- IPv6 address

Post by Dravion » 2019-06-07 07:43

@Mattg

Yes, this is true and its the same on Linux.
But the Problems doesnt stop at the Windows Operatingsystem Level. Your Windows box (or VM}
needs to have access to an IPv6 Standard Gateway and and you need to allow ICMP Packets by Firewall (required by IPv6 for Router advertisement messages or your IPv6 address doesnt work).

On top of this you need an IPv6 Ready DNS-Server
to setup IPv6 A Records (AAAA Records) to point
to your IPv6 MX Record and at last a IPv6 Reverse zone (if you need rDNS and PTR DNS Entries).

That are the bare minimum requirements to run hMailServer on top of IPv6 and DNSv6.

As you mentioned yourself, under such a setup all
Emails will be sent IPv6 first and in most cases fail because most Mailservers doesnt speak IPv6 so
you get a lot of "undeliverd mails" back into the Senders inbox.

Post Reply