Disable ipv6 in Exim4

Exim4 has an option disable_ipv6=true. As great in many ways as Debian/Ubuntu's split configuration files for Exim4 may be, it makes it difficult sometimes to know where to put configuration options.

Where do I add the line disable_ipv6=true?


Solution 1:

Enter a root shell:

sudo bash

First you need to determine if you are using the split or the non-split configuration. Run the following:

update-exim4.conf -v

Then you have to do one of the following:

  1. If you are using the non-split configuration, edit the single-file config template directly:
vi /etc/exim4/exim4.conf.template # add "disable_ipv6 = true" in the main conf section
  1. If you are using the split configuration, you need to create a new config:
echo 'disable_ipv6 = true' > /etc/exim4/conf.d/main/90_exim4-disable_ipv6

Finally, you need to regenerate the Exim4 config file and restart Exim4:

update-exim4.conf
service exim4 restart # or run "/etc/init.d/exim4 restart"

Solution 2:

I think you can check and find file config /etc/exim4/update-exim4.conf. You can add option disable_ipv6=true and restart exim with command service exim4 restart.

After you added option you can check and netstat listening on port 25 against the IPv6 address as: netstat -tulpn | grep :25. If port 25 have listening in IPv6 maybe you can change dc_local_interfaces='127.0.0.1 ; ::1' --> dc_local_interfaces='127.0.0.1'.

Finally, finally, I noticed that there is a configuration template file/etc/exim4/exim4.conf.template. Curiously, I’ve added disable_ipv6=true directive over there, restarted exim and maybe it started working.

I hope you will find this article useful, and save some time when you run into similar problem with exim.

Solution 3:

If your only need is to get around Google's IPv6 reverse DNS (PTR record) policies, add the following to main/02_exim4-config_options.

dns_ipv4_lookup = *google.com : *gmail.com

This will effectively disable IPv6 (address lookups) to any message going to Gmail without disabling IPv6 entirely.