View Single Post
Old 27th November 2008
satimis satimis is offline
Port Guard
 
Join Date: May 2008
Posts: 27
Default

Quote:
Originally Posted by deemon View Post
The transport must have smtp: prefix if you wanto to forward the email to another smtp server. Check my example in previous post.


Yes
Hi deemon,


Your advice works here. Steps performed as follows;

All 3 mail servers are running on the same Xen box as guests.


One external IP with all ports forwarded to 192.168.0.207


Server-1
Local IP - 192.168.0.207
for routing

Server-2
Local IP - 192.168.0.208
domain - satimis.changip.net

Server-3
Local IP -192.168.0.209
domain - satimis.dnsalias.com


On Server-1


# grep transport_maps /etc/postfix/main.cf
Code:
# transport_maps = mysql:/etc/postfix/mysql_transport.cf
# nano /etc/postfix/main.cf
uncomment above line and change it as;
Code:
transport_maps = mysql:/etc/postfix/mysql_transport_maps.cf

# mysql -p maildb

mysql> SHOW tables;
Code:
+------------------+
| Tables_in_maildb |
+------------------+
| aliases          |
| domains          |
| users            |
+------------------+
3 rows in set (0.00 sec)

Code:
mysql> CREATE TABLE `transport`
    -> `pkid` smallint(6) NOT NULL auto_increment,
    -> `domain` varchar(128) NOT NULL default '',
    -> `hostname` varchar(128) NOT NULL default '',
    -> `transport` varchar(128) NOT NULL default ':[]',
    -> `enabled` smallint(6) NOT NULL default '1',
    -> PRIMARY KEY (`pkid`),
    -> UNIQUE KEY `domain` (`domain`)
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> SHOW tables;
Code:
+------------------+
| Tables_in_maildb |
+------------------+
| aliases          |
| domains          |
| transport        |
| users            |
+------------------+
4 rows in set (0.00 sec)

mysql> DESCRIBE transport;
Code:
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| pkid      | smallint(6)  | NO   | PRI | NULL    | auto_increment |
| domain    | varchar(128) | NO   | UNI |         |                |
| hostname  | varchar(128) | NO   |     |         |                |
| transport | varchar(128) | NO   |     | :[]     |                |
| enabled   | smallint(6)  | NO   |     | 1       |                |
+-----------+--------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)

Code:
mysql> INSERT INTO transport (domain,hostname) VALUES
    -> ('satimis.dnsalias.com','smtp:192.168.0.209');
Query OK, 1 row affected (0.00 sec)

Code:
mysql> INSERT INTO transport (domain,hostname) VALUES
     -> ('satimis.changeip.net','smtp:192.168.0.208'); 
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * from transport;
Code:
+------+----------------------+--------------------+-----------+---------+
| pkid | domain               | hostname           | transport | enabled |
+------+----------------------+--------------------+-----------+---------+
|    1 | satimis.dnsalias.com | smtp:192.168.0.209 | :[]       |       1 |
|    2 | satimis.changeip.net | smtp:192.168.0.208 | :[]       |       1 |
+------+----------------------+--------------------+-----------+---------+
2 rows in set (0.00 sec)
mysql> exit
Bye


# nano /etc/postfix/mysql_relay_domains.cf
Code:
user=mail
password=apassword
dbname=maildb
table='t'
select_field=domains
where_field=domains
hosts=127.0.0.1
additional_conditions = and enabled = 1

Remark: What is 't' here for ?


# /etc/init.d/mysql reload
Code:
Reloading MySQL database server: mysqld.
# tail /var/log/mysql.log
# tail /var/log/mysql.err
both without complaint


# postfix reload
Code:
postfix/postfix-script: refreshing the Postfix mail system
# postfix check
No complaint

# tail /var/log/mail.log
Code:
Nov 27 13:09:36 xen07 spamd[2704]: spamd: server successfully spawned child process, pid 2735
Nov 27 13:09:36 xen07 spamd[2704]: spamd: server successfully spawned child process, pid 2736
Nov 27 13:09:36 xen07 spamd[2704]: prefork: child states: IS
Nov 27 13:09:36 xen07 spamd[2704]: prefork: child states: II
Nov 27 13:09:37 xen07 authdaemond: modules="authmysql", daemons=5
Nov 27 13:09:37 xen07 authdaemond: Installing libauthmysql
Nov 27 13:09:37 xen07 authdaemond: Installation complete: authmysql
Nov 27 13:09:38 xen07 postfix/master[2923]: daemon started -- version 2.3.8, configuration /etc/postfix
Nov 27 13:39:48 xen07 postfix/postfix-script: refreshing the Postfix mail system
Nov 27 13:39:48 xen07 postfix/master[2923]: reload configuration /etc/postfix
No complaint/error


Mails sent to satimis@satimis.changeip.net were delivered to Server-2. Mails sent to satimis@satimis.dnsalias.net were deliverd to Server-3


Lot of thanks for your advice.


There is one drawback here. First I started Server-1 followed by Server-2 and finally Server-3. Keystokes on Server-3 were slow to response. I have to sit back and wait for keystroke to respond. If only running either Server-2 or Server-3 there was no such problem. I have 4G RAM on board. Have you had any idea where to check the cause? TIA


B.R.
satimis

Last edited by satimis; 27th November 2008 at 02:44 PM.
Reply With Quote