LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-17-2008, 05:38 AM   #1
vedang
Member
 
Registered: May 2006
Posts: 89

Rep: Reputation: 15
SMTP AND POP3 through iptables


Hi,

I will explain my setup first.
I have a broadband router whose lan ip is 172.16.0.1 which is connected to external interface of gateway ( 172.16.0.3 ).
Internal interface ip of gateway is 192.168.0.114.
I have a sendmail server which pushes mails to external SMTP server
(smtp.example.com) and for receiving mail is fetches mails via fetchmail with protocol POP3. Ip of sendmail and fetchmail server is 192.168.0.113. I have iptables configured on Gateway server.

I want to open ports on gateway server for SMTP and POP3 ports for my sendmail server to be able to send and receive mails through gateway.
 
Old 01-17-2008, 08:15 AM   #2
Acron_0248
Member
 
Registered: Feb 2006
Location: Venezuela
Distribution: Gentoo
Posts: 453

Rep: Reputation: 33
Hi,


Do you want to know what ports you need to open or how to do it using iptables?

The SMTP port is 25 and pop3 110



Regards
 
Old 01-17-2008, 10:53 PM   #3
vedang
Member
 
Registered: May 2006
Posts: 89

Original Poster
Rep: Reputation: 15
SMTP AND POP3 through iptables

I know port numbers and I want to know how to open them on iptables.
 
Old 01-19-2008, 01:05 AM   #4
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
Quote:
I have a broadband router whose lan ip is 172.16.0.1 which is connected to external interface of gateway ( 172.16.0.3 ). Internal interface ip of gateway is 192.168.0.114. Ip of sendmail and fetchmail server is 192.168.0.113.
Include the lines in the gateway machine.

/sbin/iptables -A INPUT -p tcp --dport 25 -m state --state NEW -j ACCEPT

#Port Forward SMTP to the mailserver

/sbin/iptables -t nat -A PREROUTING -p tcp -d 172.16.0.1 --dport 25 -j DNAT --to-destination 192.168.0.113:25
/sbin/iptables -A FORWARD -p tcp -d 192.168.0.113 --dport 25 -j ACCEPT

#SNAT for port 25 and 110

/sbin/iptables -t nat -A POSTROUTING -p tcp -s 192.168.0.113 --dport 25 -o eth1 -j SNAT --to-source 172.16.0.1
/sbin/iptables -t nat -A POSTROUTING -p tcp -s 192.168.0.0/21 --dport 110 -o eth1 -j SNAT --to-source 172.16.0.1

--
Prasanta
 
Old 01-25-2008, 04:15 AM   #5
vedang
Member
 
Registered: May 2006
Posts: 89

Original Poster
Rep: Reputation: 15
SMTP and POP3 port allowing to the gateway machine.

I have not used above commands yet to configure iptables,

but what I suspect is that insted of using ip 172.16.0.1 which is of a router's ip,I shouldn't I use 172.16.0.3 ip of external interface of gateway machine.?

I am a person who have only basic knowledge of iptables. So please do not misunderstand my question.
 
Old 01-30-2008, 11:47 PM   #6
vedang
Member
 
Registered: May 2006
Posts: 89

Original Poster
Rep: Reputation: 15
Iptables problem.

I tried with all iptables commands but not working.

I tried with a win client to telnet to external SMTP through iptables gateway machine but it fails to connect.

When I try to telnet to external SMTP i can observe the LED activity of the router. That means some packet is arriving to the router.

Please provide me solution for that.
 
  


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
SMTP/POP3 problems with squid/iptables dragonleech Linux - Security 8 09-23-2010 04:57 AM
Iptables Configuration for pop3 and smtp access ! help Pluster Linux - Networking 3 05-13-2006 12:24 AM
SMTP/POP3 iptables problem dragonleech Linux - Security 4 12-12-2005 11:33 AM
Pop3/smtp Bensoft Kill MS Linux - Newbie 2 08-24-2003 09:44 PM
POP3/SMTP-IPTABLES Problems chris Linux - Networking 1 02-28-2003 04:55 AM


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