LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-19-2009, 12:36 AM   #1
h00chman
LQ Newbie
 
Registered: Mar 2004
Location: Spokane, WA
Distribution: Mandrake 9.1, 9.2, RH9, OpenBSD
Posts: 13

Rep: Reputation: 0
Postfix - how to set the IP address used to send mail on a multi-IP server.


I have having mail rDNS issues with certain servers e.g. Craigslist, b/c my postfix server sends the mail through a different IP address than the one associated with $mydomain.

I use my server as a virtual web/mail server for 5 or so domains, which are associated with an ip address. i.e. 10.0.0.3 on eth0:1

The network card also has the main ip address on eth0:0 i.e. 10.0.0.1.

This is the address that has the rdns set up, as well as the subdomains for the server dns1.domain.tld, mail.domain.tld.

$mydomain is set as domain.tld
$myhostname is set to mail.domain.tld.

interfaces = all;

Virtual domains are done through a mysql server.

But, when I send a mail from me@domain.tld, it sends through otherdomain.tld on 10.0.0.3 instead of mail.mydomain.tld at 10.0.0.1

How do I force postfix to send through my default ip and domain? Is there a setting min master.cf?
 
Old 04-19-2009, 12:45 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Your routing table determines that. Are you just wanting to change the IP used for postfix, or everything?

If you want to change everything, change your routing table.

If only for postfix, look into smtp_bind_address in main.cf

Last edited by billymayday; 04-19-2009 at 01:29 AM.
 
Old 04-20-2009, 11:04 AM   #3
h00chman
LQ Newbie
 
Registered: Mar 2004
Location: Spokane, WA
Distribution: Mandrake 9.1, 9.2, RH9, OpenBSD
Posts: 13

Original Poster
Rep: Reputation: 0
Routing problems??

Thanks for the reply.

I tried the smtp_bind_address, and postfix would not send out any of my test messages. I could ping the address using the ip, and using the host name from another computer, so the adapter and networking were active. Postfix, just wouldn't send.

My network is set up with 5 static IPs, and then some internal network IPs as follows.

Internet > DSL router > Server eth0 - Internal eth0 10.0.0.1
- External eth1 65.xxx.xxx.1
- External eth1: 65.xxx.xxx.2

Hosts:
127.0.0.1 localhost
10.0.0.1 internal.mydomain.com
65.xxx.xxx.1 mail.mydomain.com
65.xxx.xxx.1 ns.mydomain.com
65.xxx.xxx.2 virtualdomain1.com
65.xxx.xxx.2 virtualdomain2.commm

In main.cf
myhostname = mail.mydomain.com
mydomain = mydomain.com (I actually list this line even though postfix should default to it by stripping the subdomain)
inet_interfaces = all

But, when I send mail to an external account, the mail is received from 65.xxx.xxx.2 virtualdomain1.com.

I can't figure out why. I tried to change inet_interfaces = 65.xxx.xxx.1, 127.0.0.1 but postfix could not successfully send mail.

route >
65.xxx.xxx.0 * 255.255.255.248 U 0 0 0 eth1
10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
default mail.mydomain.com 0.0.0.0 UG 100 0 0 eth1
default mail.mydomain.com 0.0.0.0 UG 100 0 0 eth1
default home 0.0.0.0 UG 100 0 0 eth0


Any recommendation to change my network setup and/or routing table that might make this work?

Thanks.
 
Old 04-20-2009, 03:56 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If you change something like smtp_bind_address and it doesn't work, we really can't help if you don't at least show a log of the attempt (no logging is information as well). Would you be able to try again and see what pops up?
 
Old 04-20-2009, 04:17 PM   #5
h00chman
LQ Newbie
 
Registered: Mar 2004
Location: Spokane, WA
Distribution: Mandrake 9.1, 9.2, RH9, OpenBSD
Posts: 13

Original Poster
Rep: Reputation: 0
log error

Apr 20 14:13:42 office amavis[23449]: (23449-03) (!)DENIED ACCESS from IP 65.101.xxx.xxx, policy bank ''

mailq =
5E6D74EC076 479 Mon Apr 20 14:13:42 me@mydomain.com
(lost connection with 127.0.0.1[127.0.0.1] while receiving the initial server greeting)
me@sendtoaddress.com

Last edited by h00chman; 04-20-2009 at 04:19 PM.
 
Old 04-20-2009, 04:33 PM   #6
h00chman
LQ Newbie
 
Registered: Mar 2004
Location: Spokane, WA
Distribution: Mandrake 9.1, 9.2, RH9, OpenBSD
Posts: 13

Original Poster
Rep: Reputation: 0
Routing problems

I think you nailed it with the routing table problem.

I changed my ipconfig for the network adapter, and checked my bind files. But now, instead of sending from the aliased IP on the NIC, it appears to send from the gateway IP.

contents of interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary NS/MX internet network interface
auto eth1
iface eth1 inet static
address 65.101.xxx.1
netmask 255.255.255.248
network 66.101.xxx.0
broadcast 65.101.xxx.7
gateway 65.101.xxx.6

# The aliased IP for virtual hosts on NIC 1 - external interface
auto eth1:1
iface eth1:1 inet static
address 65.101.xxx.2
netmask 255.255.255.248
network 66.101.xxx.0
broadcast 65.101.xxx.7
gateway 65.101.xxx.6

# Optional aliased IP on NIC 1 - external interface
#auto eth1:2
#iface eth1:2 inet static
# address 65.101.xxx.3
# netmask 255.255.255.248
# network 66.101.xxx.0
# broadcast 65.101.xxx.7
# gateway 65.101.xxx.6


#Local (onboard) interface
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
address 65.101.xxx.2
gateway 192.168.0.1

route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
65.101.xxx.0 0.0.0.0 255.255.255.248 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 100 0 0 eth0
0.0.0.0 65.101.xxx.6 0.0.0.0 UG 100 0 0 eth1
0.0.0.0 65.101.xxx.6 0.0.0.0 UG 100 0 0 eth1

When I send mail now, it appears to come from 65.101.xxx.6 the gateway address, and not 65.101.xxx.1, the MX address.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 6 09-23-2019 10:09 PM
how to restrict a user to send mails only to 3 email IDs in postfix mail server sharath41 Linux - Server 1 07-04-2008 03:40 PM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM
Postfix mail server set up nakayiza Linux - Server 1 10-12-2006 05:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration