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 04-29-2008, 06:50 AM   #1
mraray
Member
 
Registered: Sep 2005
Posts: 49

Rep: Reputation: 15
iptables question


Hi Everyone.

I am replacing a router appliance with a linux box.

The router has two interfaces, the public ip (DSL) (ppp0) call it 1.2.3.4, and the local network eth0 (192.168.0.1).

There are DNAT's setup for port 110 (to allow people from the outside to check email on an internal server (192.168.0.1).

Some people also use the public IP to access email from within the private network - so they access 1.2.3.4 from within 192.168.0.0/24 and it is redirected from the router appliance back to internal server
EG ... client (192.168.0.51) access 1.2.3.4:110 goes via the router, router then relays it to 192.168.0.2 (all within the same subnet!)

I have tried using a guide similar for transparent proxying, but it just doesn't go anywhere... any suggestions? Basically I just want to router to redirect/relay to a different machine on the same subnet.


Thanks,
Andrew.
 
Old 04-29-2008, 07:03 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
maybe something like this (going from memory, may need to check position, switches, ... for accuracy if you get any errors):
Code:
iptables -t nat -I PREROUTING -i ppp0 -p tcp --dport 110 -j DNAT --to 192.168.0.2:110
iptables -I FORWARD -i ppp0 -d 192.168.0.2 -p tcp --dport 110 -j ACCEPT
you'll also want a typical "RELATED,ESTABLISHED" ACCEPT rule, the ip_conntrack module(s), and have enabled ip forwarding.

Since the linux router "owns" both the IP on ppp0 and eth0 it should respond to your clients on the LAN regardless of the interface that the request comes in on.

Hope this helps.
 
Old 04-29-2008, 09:46 AM   #3
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Rep: Reputation: 19
If the hosts are on the same subnet as the mail server why not just access it directly instead of going through the router? Do you have a dns server? If so then just make any entry for 192.168.0.1 that maps to that hostname. If no dns server then modify the /etc/hosts files for all the host computers. Or just configure each machine's respective email client to use the IP address of the mail server.
 
  


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
iptables question cizzi Linux - Networking 3 01-17-2008 04:12 AM
iptables question pinoyskull Linux - Security 4 08-16-2007 07:32 AM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
IPtables Question tebucky Linux - Security 6 12-31-2004 12:49 AM
iptables question enrique_arong Linux - Newbie 9 09-27-2004 02:53 PM

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

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