Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olemd/918fbf52020b60fadb064f3cbdc087c0 to your computer and use it in GitHub Desktop.
Save olemd/918fbf52020b60fadb064f3cbdc087c0 to your computer and use it in GitHub Desktop.
How to disable IPv6-based SMTP delivery with exim on Debian

IPv6 is great, but sometimes it's troublesome. SMTP over IPv6 is particularly troublesome if you're talking to Google (and probably others as well)

If you for some reason don't have a correct PTR record, you'll end up with a lots of refused mail and logs pointing you to https://support.google.com/mail/answer/81126?p=ipv6_authentication_error&rd=1#authentication

One way to fix this is to fall back to IPv4 only for outgoing SMTP. Given a Debian installation with split-config exim, the simplest way to do this seems to be as follows:

  • copy /etc/exim4/conf.d/router/200_exim4-config_primary to 200_exim4-config_primary.rul
  • The second "dnslookup:" router is used for remote smtp-delivery, adding 0::0/0 to the ignore_target_hosts will make sure that no AAAA-records are used for later transport

change :

ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\
                  172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :\
                  255.255.255.255

to :

ignore_target_hosts = 0.0.0.0 ; 127.0.0.0/8 ; 192.168.0.0/16 ;\
                  172.16.0.0/12 ; 10.0.0.0/8 ; 169.254.0.0/16 ;\
                  255.255.255.255 ; 0::0/0
@SvenRoederer
Copy link

ignore_target_hosts = <

What's the "<" for?

@olemd
Copy link
Author

olemd commented Jan 18, 2021

That very much looks like a copy-pasta typo on my behalf.

@SvenRoederer
Copy link

I guessed so ... and thanks for this gist.

@daviessm
Copy link

You need the <; at the beginning of the option so that Exim understands the change of separator from : to ;.

ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; 192.168.0.0/16 ;\
                  172.16.0.0/12 ; 10.0.0.0/8 ; 169.254.0.0/16 ;\
                  255.255.255.255 ; 0::0/0

@olemd
Copy link
Author

olemd commented Sep 13, 2021

Ah, yes. That makes sense. Well, for some values of sense at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment