LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 07-26-2011, 02:33 AM   #1
cableguy187
LQ Newbie
 
Registered: Jul 2011
Posts: 5

Rep: Reputation: Disabled
Routing to internal mailserver?


Hi,

I am stumped on how to work out my issue:

I have two boxes, 1- Centos router, 2- centos web/mail server..

When trying to receive mail using mail.xxx.xxx in the mail client server settings, it will not resolve to any machine on the internal network... I have to enter the internal IP address in the incoming and outgoing email settings..

Same with the website I host.. I have to enter the internal IP to get access..

It just will not resolve the DNS on the internal network.

Everything works as it should outside my network.

I am a bit of a noob but managed to get this far


Any help is greatly appreciated.
 
Old 07-26-2011, 03:45 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi and welcome to LQ,

The easiest way to do this, is to add in /etc/hosts:
Code:
x.x.x.x mail.domain.com www.domain.com
where x.x.x.x is your server's internal IP

Regards
 
Old 07-26-2011, 04:07 AM   #3
cableguy187
LQ Newbie
 
Registered: Jul 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Hi and welcome to LQ,

The easiest way to do this, is to add in /etc/hosts:
Code:
x.x.x.x mail.domain.com www.domain.com
where x.x.x.x is your server's internal IP

Regards
Wow, it couldnt be that easy?

Should I enter that in the GW or the mail/web server?
 
Old 07-26-2011, 04:21 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You should add it in your client box, i.e. the box you're using to access the mailserver or the webserver.
Of course it does not harm if you add it to any other internal box.
As I told you this is the easiest way, but if you have many boxes, it would be a waste of time to configure all of them. In this case you can use an internal dns, or a split (internal/external) dns to do your job.

Regards
 
Old 07-26-2011, 04:39 AM   #5
cableguy187
LQ Newbie
 
Registered: Jul 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks, but i did do that with my main pc..

What i am trying to work out is a fix for the GW or my mail/web server which is also my main dns server.

I have >10 pc's that access mail on the network and outside as well..

One thing, i did have a simple netgear router that was a temporary fix while I was upgrading the GW and i did not experience this issue. It must be something with my firewall rules?
 
Old 07-26-2011, 07:57 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

First of all it's not a firewall but a dns problem, as you said you can access your servers with their IP addresses. And since you said it worked with the router, I guess the router was running dhcpd to assign IPs to your boxes along with hostnames.
Since you are running your own dns server, you should consider using views to distinguish between internal and external network

Regards
 
Old 07-26-2011, 03:46 PM   #7
cableguy187
LQ Newbie
 
Registered: Jul 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Hi,

First of all it's not a firewall but a dns problem, as you said you can access your servers with their IP addresses. And since you said it worked with the router, I guess the router was running dhcpd to assign IPs to your boxes along with hostnames.
Since you are running your own dns server, you should consider using views to distinguish between internal and external network

Regards
Thanks for the reply but it was my firewall..

I added- (xxx.xxx.xxx.xxx- your IP) GW is .254, Mail is .250
# Reroute public request to internal server :

$IPTABLES -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -m tcp -p tcp --dport 80 -j DNAT --to-destination 192.168.1.250
$IPTABLES -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -m tcp -p tcp --dport 143 -j DNAT --to-destination 192.168.1.250
$IPTABLES -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -m tcp -p tcp --dport 993 -j DNAT --to-destination 192.168.1.250

#NAT Loopback for internal to public:

$IPTABLES -t nat -A POSTROUTING -d 192.168.1.250 -s 192.168.1.0/24 -j SNAT --to-source 192.168.1.254

Working perfectly now..

Anyone see any security issues with this?
 
  


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
Routing 2 Internal Networks nytram1984 Linux - Networking 29 01-14-2012 06:10 PM
Internal Mailserver issue selva.k Linux - Server 1 04-28-2009 02:06 AM
Routing between internal subnets teamchachi Linux - Networking 2 05-11-2005 07:21 AM
Internal Routing Saris Linux - Newbie 12 06-24-2003 11:30 PM
LAN internal mailserver no internet access guanyu Linux - Networking 8 11-14-2002 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:03 PM.

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