LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 02-26-2007, 01:49 PM   #1
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Rep: Reputation: 0
Configure postfix, please help!


Is it possible to mail another computer on my own network with postfix (ver 2.1.5 on Debian Sarge). When I mail my other computer, all mail is relayed through smarthost (my ISP's mail server. I don't want that Here is what I want:

Send email from alfa to beta and vice versa. If I send to an account on hotmail, it must go through my ISP's email-server (smarthost). I have accounts on my two computers with the same name. Is that a problem? I.e. sending mail from user@alfa to user@beta. I have no problems to send email locally (on the same computer) e.g. from user to root. If a do that user gets the mail as it should since /etc/aliases has a line saying:
root: user

Dont tell me to read the documentation! I've done so for days and days now and tried hundreds of ways without any success! That is so frustrating! Please, could any helpful soul guide me in the right direction.

I have configured my Debian Sarge system only by reading the documents to do http-server ftp-server X-window, streaming media setting up KDE and so on, but configuring an email-server has so far been a far to complex task for me. Why has it to be so hard?

MY computers have static ip's; 192.168.2.101 and 192.168.2.102, connected through a SMC router.
 
Old 02-27-2007, 11:31 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Have you tried 'dpkg-reconfigure postfix' ?




Cheers,
Tink
 
Old 02-27-2007, 11:49 AM   #3
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster
Have you tried 'dpkg-reconfigure postfix' ?




Cheers,
Tink
Yes i Have! It doesnt help me all. I've tried zillions (?) of combinations. Either I can only send mail to my other box on my intranet (192.168.2.x) or send to my ISP's smarthost depending if I comment out the line in /etc/postfix/main.cf:

relayhost = [my.isps.mailserver] #mail to internet

or:

#relayhost = .... # mail only to intranet
 
Old 02-27-2007, 02:34 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And what about these (they should be relevant to your problem)?
Code:
myhostname = 
mydomain = 
myorigin = 
mydestination = 
local_recipient_maps = 
mynetworks = 
relay_domains =
relayhost = 
transport_maps = 
inet_interfaces =


Cheers,
Tink
 
Old 02-27-2007, 03:53 PM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Sounds like you need to configure DNS (BIND) on one of your machines and create MX records for the mail servers so they know where to find each other...
 
Old 02-27-2007, 05:10 PM   #6
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster
And what about these (they should be relevant to your problem)?
Code:
myhostname = 
mydomain = 
myorigin = 
mydestination = 
local_recipient_maps = 
mynetworks = 
relay_domains =
relayhost = 
transport_maps = 
inet_interfaces =


Cheers,
Tink
My /etc/postfix/main.cf looks like this (with some values changed for security reasons):

myhostname = host1.mydom
mydomain = host1.mydom
myorigin =
mydestination = host1 host1.mydom localhost
local_recipient_maps =
mynetworks = 127.0.0.0/8
relay_domains =
relayhost = [my.isp.mailserver]
transport_maps =
inet_interfaces =

As you can see, some values are emty (at their default values).

/snickie
 
Old 02-27-2007, 05:15 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by snickie
My /etc/postfix/main.cf looks like this (with some values changed for security reasons):

myhostname = host1.mydom
mydomain = host1.mydom
myorigin =
mydestination = host1 host1.mydom localhost
local_recipient_maps =
mynetworks = 127.0.0.0/8
relay_domains =
relayhost = [my.isp.mailserver]
transport_maps =
inet_interfaces =

As you can see, some values are emty (at their default values).

/snickie
Have a play with mydestination, add your other hosts there,
make sure they either a) resolve or b) use their IPs.


Cheers,
Tink


P.S.: I'm shuffling this over to the server forum.... I think it's
better off there, not such a newbie topic after all ;}

Last edited by Tinkster; 02-27-2007 at 05:16 PM.
 
Old 02-27-2007, 05:20 PM   #8
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by farslayer
Sounds like you need to configure DNS (BIND) on one of your machines and create MX records for the mail servers so they know where to find each other...
Are you really shure that I need bind? I have my /etc/hosts with values for my network boxes.

/etc/hosts:
192.168.2.101 host2.mydom host2
192.168.2.102 host1.mydom host1

It works because I can refer to my boxes with their names (host1 and host2). Remember, my boxes dont have real names on the internet.
I cant access my mail servers from the internet because my ISP is blocking port 25. I dont need to either i.e I'm using smarthost.

/snickie
 
Old 02-27-2007, 06:24 PM   #9
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
You need to set transport_maps to override relayhost. It's gonna be something like this. In main.cf:
Code:
transport_maps = hash:/etc/postfix/transport
With transport looking like
Code:
host1.mydomain.com   :[192.168.2.102]
host2.mydomain.com   :[192.168.2.101]
Then, run
Code:
postmap /etc/postfix/transport
Thereafter, sending mail to user@host1.mydomain.com should work as expected.

If you don't care about names, you can just send mail to user@[192.168.2.101] without setting transports.

Last edited by Berhanie; 02-27-2007 at 06:30 PM.
 
Old 02-28-2007, 07:12 AM   #10
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Berhanie
You need to set transport_maps to override relayhost. It's gonna be something like this. In main.cf:
Code:
transport_maps = hash:/etc/postfix/transport
With transport looking like
Code:
host1.mydomain.com   :[192.168.2.102]
host2.mydomain.com   :[192.168.2.101]
Then, run
Code:
postmap /etc/postfix/transport
Thereafter, sending mail to user@host1.mydomain.com should work as expected.

If you don't care about names, you can just send mail to user@[192.168.2.101] without setting transports.

Thanks for your reply!
The transport file took care of sending email to my other box or my ISP's smarthost. But email to my other box isn't showing because it is relaying it to smarthost! I think I know why but I don't know how to fix it! It's kind of catch 22;

In order to send email out on the net (e.g. hotmail) I put a fake name in /etc/postfix/canonical:
usr1 fake@hotmail.com
othervise my ISP's mail server will reject the mail. So far so good. But when sending mail on my intranet the other box will relay it to smarthost (ISP's mail server).

I've been playing with the files canonical and aliases with more variants I can remember but still no luck. I'm using mutt as MUA and the problem is I can't change the From: field depending if I want to send mail out on the internet or just locally on my intranet. Both my boxes has a user with the same name (usr1), but since the hostname is different it should't be a problem.

/snickie
 
Old 02-28-2007, 10:59 AM   #11
snickie
LQ Newbie
 
Registered: Feb 2004
Location: Sweden
Distribution: Ubuntu
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by snickie
Thanks for your reply!
The transport file took care of sending email to my other box or my ISP's smarthost. But email to my other box isn't showing because it is relaying it to smarthost! I think I know why but I don't know how to fix it! It's kind of catch 22;

In order to send email out on the net (e.g. hotmail) I put a fake name in /etc/postfix/canonical:
usr1 fake@hotmail.com
othervise my ISP's mail server will reject the mail. So far so good. But when sending mail on my intranet the other box will relay it to smarthost (ISP's mail server).

I've been playing with the files canonical and aliases with more variants I can remember but still no luck. I'm using mutt as MUA and the problem is I can't change the From: field depending if I want to send mail out on the internet or just locally on my intranet. Both my boxes has a user with the same name (usr1), but since the hostname is different it should't be a problem.

/snickie
I finally got it!
I added sender_canonical_maps (SEN) and recipient_canonical_maps (REC). In SEN I put:
usr1 fake@hotmail.com

In REC i put:
fake2@hotmail.com usr2

That made postfix deliver to my account in my other box without relaying it to smarthost.

Btw, changing fields in mutt didn't help. I think they only change the from field in the mail not the envelope which I think postfix is working with. Can anyone confirm this!

Thanks for all help,
/snickie
 
  


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
how to configure postfix to reject spams xlh3110 Linux - Server 18 12-19-2006 08:08 AM
unable to configure postfix syl20 Linux - Networking 5 11-17-2004 03:03 AM
how to configure postfix with webmin? eozdoganci Linux - Newbie 0 06-07-2004 04:58 AM
Configure Postfix as MX Backup dune Linux - Newbie 2 06-01-2004 07:28 AM
configure avmailgate + postfix rafalek Linux - Networking 0 10-13-2003 05:54 AM

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

All times are GMT -5. The time now is 01:58 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