All posts All posts by this author Paper color Change page color Announcements

How to rotate IPs on opensmtpd

I have been a postmaster for the most part of the last decade, and I have always preferred postfix as my preferred MTA. However, recently I started playing with opensmtpd, the default SMTP server in openBSD. It is available for linux as opensmtpd-portable package, so you can run it on linux as well. Installing the opensmtpd software on your machine is out of scope of this article.

Let's say you have two IPs and on interface eth0 and eth0:0 respectively. You want to send from both IPs, with hostname from and hostname from

You need to edit your smtpd.conf this way:

listen on eth0
listen on eth0:0
table myips {}
table myhostnames {>,>}
accept  for any relay source <myips> hostnames <myhostnames>

This opensmtpd setup will accept any email coming from localhost and relay them via both IPs. It will pick the IPs in roundrobin fashion, and set the heloname matching the IP when making the outgoing SMTP connection to destination MX server.

This doesn't sign your messages with DKIM, so you might want to insert a DKIM signer proxy there.

Software Solutions