Interesting: How to setup ROUTER and/or FIREWALL that uses DNS
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.