How to specify outgoing IPv6 address?

Greetings!

I am using one network interface with single IPv4 and multiple IPv6 addresses. I want to make outgoing IPv6 connections from specified address. I have tried set Local network interface option in Acceptance & Routing settings. But the followed error occurs:

SMTP-OUT: Relay mail: cannot deliver to IPv4 host … using IPv6 local interface …

I also tried custom routing rule:


But default address of interface was used for connections.

So how to specify outgoing IPv6 address?

And second question: how to make using IPv6 preferred for outgoing connections?

Thanks in advance.

Hello,

1/ Using an interface with multiple IP addresses will not allow Axigen to select one of them. This is because, when using a routing rule like “relay through this interface” Axigen will just use the target IP address to identify the network interface from where to initiate the TCP SMTP-OUT session. Thus, if you need to use different IP addresses than the default one for relaying you have to use different network interfaces and not a single one (like in your case).

2/ As explained in our documentation:

beside enabling relaying via IPv6 (using enableIPv6 = yes from smtpOutgoing context) there are no options to prefer IPv6 delivery but to follow the priorities of the MX records for the recipient’s domain.

HTH,
Ioan

I had to write C++ application for Debian Linux which can allow to specify outgoing IPv6 global unicast address:
AxigenBinding.zip (removed by Forum Administrator)
Build requirements: make, clang-21
I tested the application on Debian 12.

Installation & Usage

Unpack the archive

unzip -q ./AxigenBinding.zip -d ./AxigenBinding/

Set current directory

cd ./AxigenBinding/

Build the application

make

Install artifact

sudo make install

Open axigen’s service configuration file

sudo nano /etc/default/axigen

Add two lines:

export AXI_BINDING_GUA=your_gua
export LD_PRELOAD=${LD_PRELOAD}:/usr/lib/AxigenBinding.so

Restart axigen

sudo systemctl restart axigen.service

Thus all binding on [::]:0 will be replaced to specified GUA.

Hello,

We appreciate you sharing your solution for IPv6 binding customization. However, we strongly advise against using the provided code and installation instructions.

Here’s why:

  • Security Risks: The instructions involve using LD_PRELOAD to inject a shared library into the Axigen server process. This poses a severe security risk, as it could allow arbitrary code execution within our server’s context.
  • Untrusted Source: The code originates from an untrusted source. Executing code from unknown origins is extremely dangerous and can compromise the security of your server and data.
  • Root Privileges: The installation requires root privileges, further amplifying the potential damage if the code is malicious.
  • Potential for Malicious Activity: While the stated purpose is IPv6 binding manipulation, the code could perform other, potentially harmful actions, such as data theft, system compromise, or denial-of-service attacks.
  • Lack of Official Support: This solution is not officially supported by Axigen. Using it could lead to unexpected behavior and instability.

We understand the need for IPv6 binding customization. We recommend using officially supported methods for configuring Axigen. Please refer to our official documentation for safe and secure configuration options. If official methods do not provide the needed functionality, please contact our support team, and we will try to provide a solution.

For security reasons and because this platform is not designed for hosting third-party code, the attached archive has been removed from your post.

We recommend hosting your code on dedicated code-sharing platforms (such as GitHub or GitLab) and providing a link to it in a new forum post if you wish to share it further.

We are committed to the security of our users and strongly discourage the use of any code from untrusted sources.

Thank you for your understanding.

BR,
Ioan

1 Like