LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-04-2006, 08:45 AM   #1
mrcoffee11
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Rep: Reputation: 0
Interesting: How to setup ROUTER and/or FIREWALL that uses DNS


Hello,

I got my dsl line to the internet. On my LAN I got my mail and webserver. Port 25 and 80 are connected via NAT (dsl router) to my mail- and webserver.

What I want to do is that my DSL router sends the port 25 traffic to a linux router. Then the linux router decides on DNS information (my DNS server on the LAN) where to send the traffic to.

So if my primairy email server with MX 10 record is down then my relay server with MX 20 record will be used automatically.

How do I set up such a router? Using iptables? If that's the case, how do I tell iptables to accept port 25 and redirect it to a mailserver using my internal DNS?

Thanks!

Last edited by mrcoffee11; 07-04-2006 at 09:29 AM.
 
Old 07-04-2006, 09:47 AM   #2
mrcoffee11
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Is squid a solution?
 
Old 07-04-2006, 10:13 AM   #3
nlinecomputers
Member
 
Registered: Aug 2005
Location: Midland, TX
Distribution: Ubuntu
Posts: 125

Rep: Reputation: 15
I don't see how this can be done behind a NAT router. I assume your dsl router is providing NAT? Your NAT router would have to be a mail relay designed to forward all mail to a set internal ip. That would be a function of your MTA not DNS.

OTOH if you could get your email to forward to a named server who's name is only known to an internal DNS server you might be able to carry this out.
 
Old 07-04-2006, 10:38 AM   #4
mrcoffee11
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
My DSL router supports NAT. Very basic setup. I want to use IPTABLES on Linux if this solves my issue.

If I understand your idea correctly then the NAT router sends the mail to an internal DNS server. That server probably has to contain sendmail so it is used as a the secundairy emailserver I presume? Then this relays the mail to the primairy mail server, or holds it if the primairy is not available. But if the secundairy email server fails then the mail is not received on my LAN and I still have this single point of failure.

Is it so difficult to accept SMTP from WAN to my LAN and decide on the content of my LAN DNS where to send the traffic? Now a mail is send to my domainname, this is forwarded to my home, received on my DSL router. I send it via NAT directly to my mailserver and if my mailserver goes down: problems. I want a secundairy mailserver on my LAN to be my backup. Mail received will be send to my primairy, or else to my secundairy mailserver. Isn't this why we use DNS and MX records? :-)

Last edited by mrcoffee11; 07-04-2006 at 10:40 AM.
 
Old 07-04-2006, 05:42 PM   #5
mrcoffee11
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Testtesttest
 
Old 07-04-2006, 06:40 PM   #6
nlinecomputers
Member
 
Registered: Aug 2005
Location: Midland, TX
Distribution: Ubuntu
Posts: 125

Rep: Reputation: 15
Yes that is why you use DNS records but you keep referring to iptables and I don't see what firewalls have to do with this. SMTP is used to forward mail. You are going to have to have an SMTP server that can been seen from the wan, the real internet, and then forward it to your mailservers on the lan side, either as needed. Another words you need three mailservers. Or you need to put your mail servers, both of them on the wan side of your net. The only thing you can route your mail to is a SMTP/MTA server and that will have to forward to your two internal email servers. You could build a linux router, and replace your hardware router and do this job.
 
Old 07-04-2006, 09:07 PM   #7
depam
Member
 
Registered: Sep 2005
Posts: 824

Rep: Reputation: 30
I think what you need to do is add a MX Record on your DNS entry. In such a way that when the server 1 is down the server 2 will automatically be used.
 
Old 07-05-2006, 02:17 AM   #8
mrcoffee11
LQ Newbie
 
Registered: Jul 2006
Posts: 18

Original Poster
Rep: Reputation: 0
I think I get the picture. IPTABLES works on OSI layer 2, 3 and 4. SMTP is layer 7. So have to let a MTA or SMTP server do the routing. And this will use the DNS with the MX records.

Last edited by mrcoffee11; 07-05-2006 at 02:43 AM.
 
  


Reply

Tags
dns, mailserver, nat, router


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
help: trying to setup firewall router w/ FC4 RottenMutt Linux - Networking 4 03-13-2006 01:32 PM
router and firewall setup jibskg Linux - Networking 1 08-23-2004 09:01 AM
DNS server setup behind router goodman Linux - Networking 2 04-30-2004 03:42 AM
router/firewall setup please help?! basatum Mandriva 1 09-20-2003 03:53 PM
Trying to setup a firewall router using iptables pmoss Linux - Networking 3 03-20-2002 12:15 AM


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