[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: anyone using postfix in a home LAN setup?



On Fri, Oct 05, 2001 at 12:13:02AM -0500 or thereabouts, Matthew Garman wrote:
> 
> Does anyone out there have a home LAN setup using non-routable IP
> addresses (e.g. 192.168.x.x)?  And if so, do you have postfix running as
> the MTA on more than one machine in the LAN?
> 
Yes.

> Have you been able to get postfix to send mail to different machines on
> the LAN (completely internal, no external DNS routing)?
> 
Yes.  I have 4 computers all sitting behind a cable modem.  One of the
computers is running woody and is the firewall/gateway/router and does
NAT for the other computers.  One of the computers behind the firewall
computer is a mail server using postfix.  I have all of my other
computers route mail through it to go to the internet (and they all
use postfix as the mta).  I am not a postfix expert, but this definitely
works.  Here is the important part for the mail server:

in main.cf, I added:
myhostname = smtp.fake.cxm
mydomain = fake.cxm
myorigin = /etc/mailname
# this is who we accept mail for
mydestination = $myhostname $mydomain localhost.$myhostname localhost.$mydomain
disable_dns_lookups = yes
# set to your ISP to send mail to the internet
relayhost = smtp-server.your-isp.com
# we do this instead of dns on our LAN
transport_maps = hash:/etc/postfix/transport

contents of /etc/postfix/transport:
# run 'postmap /etc/postfix/transport' and restart postfix to change
fake.cxm          	smtp:
.fake.cxm		smtp:
smtp.fake.cxm 		local:
localhost.fake.cxm      local:

Using the transport maps (along with disable_dns_lookups) allows all
this to work, even with a fake domain name and ip addresses.

You can also add to main.cf:
# run 'postmap /etc/postfix/sender-canonical' and restart postfix to change
sender_canonical_maps = hash:/etc/postfix/sender-canonical

If sending mail to the internet, the sender_canonical maps comes in
handy because you can rewrite addresses coming through this machine so
that they come from a valid email.  My isp requires this, so I just
have all mail rewritten so the From field is from my email address
through my isp.  Eg, /etc/postfix/sender-canonical:

@smtp.fake.cxm username@your-isp.com
@workstation1.fake.cxm username@your-isp.com
@localhost.fake.cxm username@your-isp.com


Ok, the other computers on the network can have the following
'satellite' configuration:
myhostname = workstation1.fake.cxm
mydomain = fake.cxm
myorigin = /etc/mailname
relayhost = smtp.fake.cxm


Keep in mind, the parts I gave are just what I modified, everything
else is default.  I also run bind, so 'smtp.fake.cxm' actually
resolves to an ip on my network (eg 192.168.1.4).  You should be able
to accomplish the same with /etc/hosts.  Also note that this works
because anything that postfix doesn't know where to send on
workstation1, it just sends to its relayhost (smtp.fake.cxm).  It also
will receive mail for itself.  smtp.fake.cxm will get this mail, and
will either deliver to a local user if the destination is for
smtp.fake.cxm, send it on to another computer on the network if it is
destined for that computer (because of the transport map), or send it
to the its relayhost (the isp smtp server) if it doesn't know what to 
do with it.  Works very well for me.

-- 
GPG/PGP Info
Email:        jstrand1@rochester.rr.com
ID:           26384A3A
Fingerprint:  D9FF DF4A 2D46 A353 A289  E8F5 AA75 DCBE 2638 4A3A
--



Reply to: