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 03-23-2010, 10:43 AM   #31
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92

A PREROUTING -d 202.a.b.c1/32 -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.16.1.69:25

This is your first rule.
Answer please,
1. What is 202.a.b.c1?
2. What is 172.16.1.69?
 
Old 03-23-2010, 10:48 AM   #32
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
ok.. let me clarify:

-A PREROUTING -d 202.a.b.162/32 -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.16.1.69:25
-A PREROUTING -d 202.a.b.162/32 -i eth0 -p tcp -m tcp --dport 110 -j DNAT --to-destination 172.16.1.69:110

172.16.1.69 is the mail server
 
Old 03-23-2010, 11:01 AM   #33
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by Winanjaya View Post
202.a.b.166/32 is this Linux firewall box?..
are you sure?

202.a.b.162/32 is mail server
This is your post, here you said that: 202.a.b.162/32 is mail server.

Can you please, be more definite.
If your mail server IP is 172.16.1.69, and you can ping 202.a.b.166 from internet, then next rule should do what you want:


A PREROUTING -d 202.a.b.166/32 -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.16.1.69:25
 
Old 03-23-2010, 11:08 AM   #34
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
yes, I able to ping 202.a.b.166/32 from internet .. but that's the linux firewall (172.16.1.1)

but you suggest below:
A PREROUTING -d 202.a.b.166/32 -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 172.16.1.69:25

could you please advise? why I should use 202.a.b.166/32 instead of 202.a.b.162/32
 
Old 03-23-2010, 11:11 AM   #35
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
because I have 16 IPs from my ISP:

202.a.b.162 is want to be used for mail
202.a.b.163 is for ... bla bla
202.a.b.166 is for linux firewall on eth0 and eth1 is 172.16.1.1

or do I need to create 16 virtual NICs on linux firewall?

any idea?
 
Old 03-23-2010, 11:13 AM   #36
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
As I understood, 202.a.b.166 is linux firewall interface reachable from internet. And linux box has only two interfaces - eth0 and eth1.

What is 202.a.b.162?
 
Old 03-23-2010, 11:18 AM   #37
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
What is 202.a.b.162?
A: this IP 202.a.b.162 is want to be IP port-forwarding to 172.16.1.69 for SMTP and POP3 service.

or Do I need to create virtual IP of 202.a.b.162 in Linux-Firewall as Eth1:1
 
Old 03-23-2010, 11:27 AM   #38
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Linux box can do it.
Packets from internet will come to eth0=202.a.b.166, go through firewall, through router and go to second interface eth1=172.16.1.1, then to mail server=172.16.1.69

You do not need anything else
 
Old 03-23-2010, 11:39 AM   #39
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
yes, that also what I thought, Linux-firewall box on 202.a.b.166 receives package from internet, if incoming package destination is to IP 202.a.b.162 and destination port is 25 then it should be forwarded to 172.16.1.69:25 .. but it does not work ..this really make me confusing today :<(
 
Old 03-23-2010, 11:41 AM   #40
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
I am suspecting the routing..

Eth0 is on 202.a.b.166
Eth1 is on 172.16.1.1

and the Internet Router is on 202.a.b.161

Do you have suggestion about routing for the above conditions?
 
Old 03-23-2010, 12:02 PM   #41
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
What makes you confusing is you do not understand that if packets from internet was addressed to 202.a.b.166, they will never go any farther because their destination address is 202.a.b.166. That is why you use iptables router - you manually resend them where you want.
That is happen because only 202.a.b.166 is reachable from internet and remote computer can address its packets only to 202.a.b.166, it does not know about anything else.
 
Old 03-23-2010, 08:50 PM   #42
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
Hi,
so the all packets will arrives on eth0 202.a.b.166 and go to eth2=172.16.1.1..
but how to make access-list for

202.a.b.162 should be forwarded to 172.16.1.169 for smtp and pop3?

I am asking you this.. because I put dns record for smtp & pop3 @202.a.b.162

please advise

thanks & regards
 
Old 03-23-2010, 09:36 PM   #43
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by Winanjaya View Post
Hi,
so the all packets will arrives on eth0 202.a.b.166 and go to eth2=172.16.1.1..
but how to make access-list for
202.a.b.162 should be forwarded to 172.16.1.169 for smtp and pop3?
I am asking you this.. because I put dns record for smtp & pop3 @202.a.b.162
please advise
thanks & regards
If you put DNS record to IP=202.a.b.162 for your mail server, it means that mail client will attempt to connect to IP=202.a.b.162 and 202.a.b.162 should be reachable from internet. Is it?
Can you ping 202.a.b.162 from internet?
 
Old 03-23-2010, 10:08 PM   #44
Winanjaya
Member
 
Registered: Sep 2003
Posts: 239

Original Poster
Rep: Reputation: 32
currently, I am using CISCO PIX, I am unable to ping 202.a.b.162 but I able to port-forwarding..
using Linux.. I am unable to ping 202.a.b.162 and I also unable to port-forwarding
 
Old 03-23-2010, 10:22 PM   #45
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
DNS record gives an IP address, which is used for connection from internet. If 202.a.b.166 is reachable from internet, you should put it in DNS. And then with Linux you will forward this connection to any internal IP and ports.

Last edited by nimnull22; 03-23-2010 at 10:23 PM.
 
  


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
public ip address from behind nat mrtwice Linux - Networking 4 09-13-2012 09:24 AM
[SOLVED] NAT 1-1 for Three Public IPs on Ubuntu debianfan Linux - Security 61 03-21-2010 10:11 PM
NAT to different Public IP's compucoder Linux - Networking 1 01-29-2009 09:26 PM
Public IP behind NAT abdul_zu Linux - Networking 12 07-08-2005 02:42 AM
NAT + public IPS (+ firestarter) Stefan Pantiru Linux - Networking 2 05-17-2005 05:43 AM

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

All times are GMT -5. The time now is 09:44 AM.

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