This feature allows to route messages to additional domains
according to the Map defined. Here Postfix accepts the message and
rather than consulting the DNS for MX record it routes the mail by
checking the transport map. In sendmail this feature is called
mailertable
Transport Map
The map format is as follows
Setting up the Transport Mechanism to Route the messages:
Check the derivative that supports transport map
Create the transport map file
Note: “While using the transport table, when mails subjected to route, to disable the MX lookup by postfix for the destination domains we have to add the recieving domains inside the square bracket (“[]“). This will tell Postfix to “not perform” the MX lookup of the destined domains.
Enable the transport map feature in the postfix
Testing the configuration
Make sure that the MX record for all the domains that needs to route the mail to another server points to the Mail Routing Server. Now try sending mails destined to domains sales.domain.com, tax.domain.com, finance.domain.com. According to the map defined the Mail Routing server will route the mails to respective host. It is understood that the receiving host has configured to accept the mails from the Mail Router.
Example log ()sending server{where transport_maps is defined}
=========
Jun 10 20:26:03 server1 postfix/pickup[1780]: 227ED9F8EA: uid=0 from=<root>
Jun 10 20:26:03 server1 postfix/cleanup[1798]: 227ED9F8EA: message-id=<20140610144103.GA1793@server1.laptop.internal>
Jun 10 20:26:03 server1 postfix/qmgr[1781]: 227ED9F8EA: from=<root@laptop.internal>, size=476, nrcpt=1 (queue active)
Jun 10 20:26:03 server1 postfix/smtp[1791]: 227ED9F8EA: to=<root@spider.cbt>, relay=192.168.213.12[192.168.213.12]:25, delay=0.12, delays=0.07/0/0.01/0.04, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EA65520091)
Jun 10 20:26:03 server1 postfix/qmgr[1781]: 227ED9F8EA: removed
example log (AT the receiving end)
= = = = = = = = =
Jun 10 20:25:49 mail postfix/smtpd[1380]: connect from server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/smtpd[1380]: EA65520091: client=server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/cleanup[1383]: EA65520091: message-id=<20140610144103.GA1793@server1.laptop.internal>
Jun 10 20:25:49 mail postfix/qmgr[1191]: EA65520091: from=<root@laptop.internal>, size=680, nrcpt=1 (queue active)
Jun 10 20:25:49 mail postfix/smtpd[1380]: disconnect from server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/local[1384]: EA65520091: to=<root@spider.cbt>, relay=local, delay=0.04, delays=0.04/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jun 10 20:25:49 mail postfix/qmgr[1191]: EA65520091: removed
Transport Map
The map format is as follows
Left Handside Right Hand Side
user@domain.com transport:nexthop
domain.com transport:nexthop
host1.domain.com transport:nexthop
In the above format the Right Hand side defines the list of the
domains that Postfix accepts the messages and routes. In Left Hand Side
defines the transport mechanism that used and the destination of the
mails.user@domain.com transport:nexthop
domain.com transport:nexthop
host1.domain.com transport:nexthop
Setting up the Transport Mechanism to Route the messages:
Check the derivative that supports transport map
# postconf | grep transport_maps
transport_maps is the derivative that enables the transport map.
By default the derivative will be undefined. The types of transport that
supported by the Postfix can be determined by examining the
“/etc/postfix/master.cf” file. smtp, local, error etc are the types of the transport defined.Create the transport map file
# vim /etc/postfix/transport
sales.domain.com smtp:[internalhost1.domain.com]
tax.domain.com smtp:[internalhost2.domain.com]
finance.domain.com smtp:newdomain.com
The Left hand side we have mentioned the “mails coming from domains” which has to be routed (sales.domain.com)
and in the Right hand side we have mentioned the transported which has
to be use (smtp) and the destination machine (internalhost1.domain.com).sales.domain.com smtp:[internalhost1.domain.com]
tax.domain.com smtp:[internalhost2.domain.com]
finance.domain.com smtp:newdomain.com
Note: “While using the transport table, when mails subjected to route, to disable the MX lookup by postfix for the destination domains we have to add the recieving domains inside the square bracket (“[]“). This will tell Postfix to “not perform” the MX lookup of the destined domains.
# postmap /etc/postfix/transport
Now we have generated the transport map file named transport.dbEnable the transport map feature in the postfix
# vim /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport
# postfix reload
Now we have integrated the transport map with the postfix.transport_maps = hash:/etc/postfix/transport
# postfix reload
Testing the configuration
# postconf |grep transport_maps
Check the maps are defined correctly.Make sure that the MX record for all the domains that needs to route the mail to another server points to the Mail Routing Server. Now try sending mails destined to domains sales.domain.com, tax.domain.com, finance.domain.com. According to the map defined the Mail Routing server will route the mails to respective host. It is understood that the receiving host has configured to accept the mails from the Mail Router.
Example log ()sending server{where transport_maps is defined}
=========
Jun 10 20:26:03 server1 postfix/pickup[1780]: 227ED9F8EA: uid=0 from=<root>
Jun 10 20:26:03 server1 postfix/cleanup[1798]: 227ED9F8EA: message-id=<20140610144103.GA1793@server1.laptop.internal>
Jun 10 20:26:03 server1 postfix/qmgr[1781]: 227ED9F8EA: from=<root@laptop.internal>, size=476, nrcpt=1 (queue active)
Jun 10 20:26:03 server1 postfix/smtp[1791]: 227ED9F8EA: to=<root@spider.cbt>, relay=192.168.213.12[192.168.213.12]:25, delay=0.12, delays=0.07/0/0.01/0.04, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EA65520091)
Jun 10 20:26:03 server1 postfix/qmgr[1781]: 227ED9F8EA: removed
example log (AT the receiving end)
= = = = = = = = =
Jun 10 20:25:49 mail postfix/smtpd[1380]: connect from server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/smtpd[1380]: EA65520091: client=server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/cleanup[1383]: EA65520091: message-id=<20140610144103.GA1793@server1.laptop.internal>
Jun 10 20:25:49 mail postfix/qmgr[1191]: EA65520091: from=<root@laptop.internal>, size=680, nrcpt=1 (queue active)
Jun 10 20:25:49 mail postfix/smtpd[1380]: disconnect from server1.laptop.internal[192.168.213.10]
Jun 10 20:25:49 mail postfix/local[1384]: EA65520091: to=<root@spider.cbt>, relay=local, delay=0.04, delays=0.04/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jun 10 20:25:49 mail postfix/qmgr[1191]: EA65520091: removed

No comments:
Post a Comment