On 9/20/15, Peter <pe...@pajamian.dhs.org> wrote: > On 09/20/2015 08:40 PM, John Massai wrote: >> I have a Postfix instance that listens on one of many >> interfaces/addresses available on a machine. >> >> There is one special smptd service in master.cf that I'd like to have >> listen on several addresses (but not all, so I can't use "all"). >> >> I have found that I can define the service once for every address and >> it works great, but am not having luck trying to combine them into one >> by specifying inet_interfaces (possibly because it conflicts with the >> service definition itself? >> >> I.e., >> >> main.cf >> inet_interfaces = a.b.c.d >> >> master.cf >> 20025 inet n - n - - smtpd >> -o inet_interfaces=a.b.c.d,e.f.g.h,i.j.k.l >> >> The service only binds to the address from main.cf, a.b.c.d in this >> example. Is it possible (without defining the service many times over) >> to have it bind to more than one interface? > > It is with a particular trick using /etc/hosts, but I don't know how > well it's supported, it may only work in Linux: > > In master.cf: > foo:20025 inet n - n - - smtpd > > In /etc/host.conf: > multi on > > In /etc/hosts: > 192.168.1.1 foo > 192.168.1.2 foo > ... etc > > > Postfix should then bind the above service to every IP listed for foo in > /etc/hosts on the 20025 port.
Clever. Thanks much. > You may be simply swapping multiple service definitions in master.cf for > multiple lines in /etc/hosts, but if you already have lines in > /etc/hosts for those IPs then you simply need to add "foo" as an alias > to each one you want. > > In theory this should work for any result returned by the resolver, so > if you run local dns you could that instead, or anything else you can > set on the hosts: line in /etc/nsswitch.conf. > > > Peter >