LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-23-2013, 09:58 AM   #1
Gil@LQ
Member
 
Registered: Apr 2010
Location: India /Hyderabad
Distribution: RedHat, CentOS
Posts: 273

Rep: Reputation: 1
smtp natting with iptables


Hi all,

I have mail server running behind CentOS firewall. So if user wants to connect mail server he has to go through the firewall. I configured iptalbes as below
Quote:
iptables -t nat -A PREROUTING -s 0/0 -p tcp --dport 25 -j DNAT --to-destination 192.168.x.x:25
seems ok but some times not,
Quote:
if i telnet from outside it takes around half a min to connect. but if telnet from CentOS it connects quickly like normal.
is my rule ok or i need anything else, please help me.

thanks in advance.
 
Old 07-23-2013, 11:40 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
long delays are typically DNS lookup based. I'd guess that your server is taking your source IP and trying to get a name for it.

if you're using postfix, see here - http://www.postfix.org/postconf.5.ht...eername_lookup although it doesn't look like there's really anything to fix.
 
Old 07-23-2013, 02:08 PM   #3
Gil@LQ
Member
 
Registered: Apr 2010
Location: India /Hyderabad
Distribution: RedHat, CentOS
Posts: 273

Original Poster
Rep: Reputation: 1
Hi,

thanks for reply, i'm using ms exchange 2003. Please help me, how to over come this dns lookup issue.

And what about iptables, is it correct do i need any forward rule, please tell me.


thank you very much.

Last edited by Gil@LQ; 07-23-2013 at 02:10 PM.
 
Old 07-24-2013, 02:14 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well that's a windows problem then. Personally I've no idea about M$ specifics, but I'm sure google could help you out in seconds. I'd presume offhand it's just a case of having a functional DNS service for Exchange to query. Some traffic dumps from wireshark on the server would be useful to see if there are unanswered DNS queries being made. I've also no proof that that IS the problem, just a hunch.
 
Old 07-24-2013, 08:07 AM   #5
paddy2de
LQ Newbie
 
Registered: Sep 2011
Posts: 9

Rep: Reputation: Disabled
Hi,

If your telnet is trying to do a lookup there should be an option to prevent it from doing so, for eg. on mac you can do a telnet with the -N flag to prevent a lookup and see if that is what's causing the time delay.
 
Old 07-24-2013, 08:31 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by paddy2de View Post
Hi,

If your telnet is trying to do a lookup there should be an option to prevent it from doing so, for eg. on mac you can do a telnet with the -N flag to prevent a lookup and see if that is what's causing the time delay.
the -N flag would be for a telnet **server**. He doesn't have a telnet server, he has an MS Exchange server.
 
Old 07-24-2013, 08:40 AM   #7
Gil@LQ
Member
 
Registered: Apr 2010
Location: India /Hyderabad
Distribution: RedHat, CentOS
Posts: 273

Original Poster
Rep: Reputation: 1
Hi all,

As acid_cupid said, it could be dnslookup error, what i did was i port forwarded in iptalbes, i did like
Quote:
source port to 1535 and destination port to 25
now telnet is normal and quick, i guess 25 is universally for smtp which is why trying dnslookup.

my doubt is telnet is ok from CentOS firewall, but why users unable to do quickly through the same CentOS firewall ? any idea, so that i could try sorting out.

Thank you very much.
 
Old 07-24-2013, 08:45 AM   #8
paddy2de
LQ Newbie
 
Registered: Sep 2011
Posts: 9

Rep: Reputation: Disabled
Angry

Quote:
Originally Posted by acid_kewpie View Post
the -N flag would be for a telnet **server**. He doesn't have a telnet server, he has an MS Exchange server.
Perhaps I misunderstood, I gathered from the OP that he was trying to telnet through the firewall to the Exchange server, telneting throught it causes a delay, telneting from the firewall (bypassing IP tables does not).

What I meant was that if the delay is being caused by DNS lookup delays then he should be able to prevent his telnet client from attempting a lookup. I just tested this:

xxx@mac1:~$ telnet 172.19.xx.xx 22
Trying 172.19.99.10...
Connected to <hostname>.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.2

telnet> quit
Connection closed.
xxx@mac1:~$ telnet -N 172.19.xx.xx 22
Trying 172.19.xx.xx...
Connected to 172.19.xx.xx.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.2
Connection closed by foreign host.

Now see if the delay is apparent on both tests.

If I've completely missed the point I apologise, our coffee machine is broken...

Last edited by paddy2de; 07-24-2013 at 08:46 AM.
 
Old 07-24-2013, 08:53 AM   #9
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by Gil@LQ View Post
Hi all,

I have mail server running behind CentOS firewall. So if user wants to connect mail server he has to go through the firewall. I configured iptalbes as below
seems ok but some times not,
is my rule ok or i need anything else, please help me.
thanks in advance.
What command are you using on the firewall box, and what command are you using from outside? Are they both linux machines? What does the routing table look like? different dns servers? are you using the firewall for anything else, and does it work correctly?
 
  


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
static ( one to one ) natting issue in Iptables for RHEL5 ywaikul Linux - Security 6 02-24-2011 01:08 PM
iptables and SMTP custertel Linux - Security 5 10-01-2009 11:22 AM
IPTABLES and SMTP daveginorge Linux - Networking 1 01-24-2007 04:14 PM
SMTP iptables problem venom_casos Linux - Security 6 08-25-2006 07:15 PM
Natting errors (iptables).... GnomeKing Linux - Networking 4 09-23-2001 10:58 AM

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

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