LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-18-2003, 01:47 PM   #1
BaDaBooM
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Rep: Reputation: 0
Question Relay email for specific domains to an external address on a non-standard port


My goal - I have a Red Hat 7.1 box with a single NIC. I want to it to accept any email for only a couple of specific domains on port 25 from anyone and then relay/forward that email to another computer (preferrably by FQDN) on a different port.

I have had a few suggestions of what to use. I can:

A) use some sort of relay or smart host

or

B) use a port redirector

I would prefer to use option A. We loaded postfix on it but I'm not sure that it can do this or how to configure it to. Also if I do option A, can the domain name of the Linux box be the same as one of the domains it is forwarding for?

If I have to do option B, we also have IPtables loaded on it, but again not sure if it can or how to do it.

Thanks for any help!
 
Old 03-18-2003, 02:40 PM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
I would suggest using the 'vitual user' system and a port redirector.

Make some redirects, eg
mail4user1@my.domain redirects to mail4user1@host2.my.domain
You can redirect an entire domain with
@my.domain redirects to @host2.my.domain
Each is a fqdn with a valid dns MX record for each smtp server.
The last server can have any host name so long as it resolves.
The redirect will wrap another address header around the mail which keeps the original address intact.
No local copy is held on the first server.

Then add an iptables rule,
iptables -t nat -I PREROUTING -p tcp --dport 25 -d host2.ip.address -j DNAT --to-destination host2.ip.address:port#
to redirect to the other smtp server.

You'll have to check your RELAYing rules to allow this.

I've done this with Sendmail 'aliases' and 'virtusers' but I don't use Postfix, so the actual commands and files you will need to find for this.

Last edited by peter_robb; 03-18-2003 at 02:44 PM.
 
Old 03-18-2003, 10:40 PM   #3
BaDaBooM
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Original Poster
Rep: Reputation: 0
I keep getting errors with my iptables that look like this:

Try `iptables -h' or 'iptables --help' for more information.
[root@host /root]# iptables -t nat -I PREROUTING -p tcp --dport 25 -d host2.domain.com -j DNAT --to-destination host2.domain.com:2500
/lib/modules/2.4.2-2/kernel/net/ipv4/netfilter/ip_tables.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
/lib/modules/2.4.2-2/kernel/net/ipv4/netfilter/ip_tables.o: insmod /lib/modules/2.4.2-2/kernel/net/ipv4/netfilter/ip_tables.o failed/lib/modules/2.4.2-2/kernel/net/ipv4/netfilter/ip_tables.o: insmod ip_tables failed iptables v1.2.4: can't initialize iptables table `nat': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Blocking mails from specific email addresses/domains in postfix jomy Linux - Networking 1 07-15-2008 08:32 PM
Sendmail Relay-Domains From External Server littlenicker Linux - Networking 3 05-25-2005 11:45 AM
Exim cannot receive email from external address davidas Linux - Software 1 04-23-2004 03:17 AM
Postfix upgrade from 1.x to 2.0.19 can't relay to external domains issinflight Linux - Software 0 04-19-2004 10:42 PM
How to allow mail relay of specific IP address Stev Linux - Networking 2 02-13-2004 06:40 AM


All times are GMT -5. The time now is 08:05 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration