プライマリ IP でメールを送信するにはどうすればいいですか?

プライマリ IP でメールを送信するにはどうすればいいですか?

Debianサーバーでは、次の設定で2番目のIPを追加しました。/etc/network/interfaces

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
    address 1.1.1.1
    netmask 255.255.255.255
    gateway 1.1.1.1

auto eth0:1
iface eth0:1 inet static
    address 1.1.1.2
    netmask 255.255.255.255

postfixプライマリ IP ではなく、2 番目の IP を使用して電子メールを送信するようになりました。

で管理しているドメインごとに専用IPを使用していますnginx。各ドメインからそのドメイン専用のIPでメールを送信することは可能ですか?

そうでない場合、プライマリ IP を使用して電子メールを送信するにはどうすればよいですか?

答え1

送信にはそのドメイン専用の IP を使用できます。
送信者依存のトランスポート マップが必要です。
次のようになります:
/etc/postfix/main.cf に追加します:

sender_dependent_default_transport_maps=hash:/etc/postfix/sender_maps

/etc/postfix/sender_maps:

@domain1.com   domain1_transport:
@domain2.com   domain2_transport:

/etc/postfix/master.cf に追加

domain1_transport unix - - - - - smtp -o smtp_bind_address=1.1.1.1 
domain2_transport unix - - - - - smtp -o smtp_bind_address=1.1.1.2 

を実行してpostmap /etc/postfix/sender_maps、postfixをリロードします。
両方のIPでメールを受け入れるには、inet_interfaces = allmain.cfに設定するのがおそらく最善です。

答え2

各ドメインからそのドメイン専用の IP でメールを送信することは可能ですか?

はい、可能です。master.cf 構成ファイルを次のように変更してみてください。

ipaddress1:smtp inet n - n - - smtpd -o myhostname=hostname1
ipaddress2:smtp inet n - n - - smtpd -o myhostname=hostname2

postfixを再起動してメールの送信を確認します。

関連情報