Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-27-2010, 04:50 PM   #1
LQ Newbie
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
IPTABLES - CENTOS - Redirection

Hi all,

Im pretty new to Linux but have a good understanding of networks etc. Im using Centos 5.5 and IPTables. I just have a simple question and want to get the syntax right for my network.

Basically, I have a Centos Box with two interfaces. ETH0 is internal, ETH1 is external.

ETH1 (x.x.x.10) is connected to a switch that connects to 2 gateways. x.x.x.252 & x.x.x.253.

The default gateway on ETH1 is x.x.x.252.

Basically i want to have all http traffic automatically go out x.x.x.253 and everything else stay the same going out x.x.x.252.

Seems a simple NAT rule in practice, but I just can't get the syntax right in IPTables. I have no other rules defined in IPtables as the security FW's are on the level above.

Any help would be greatly appreciated. Thanks
Old 09-28-2010, 01:43 AM   #2
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
Basically you need advanced routing for this, as you want policy based routing. Therefore you need additional routing tables each directing to the appropriate gateway.

Then, in iproute2 you need to set routing rules that, based on a packet flag (being set by IPTables) the packets should be directed to the seperate routing table.

You might find this link useful: Where, in your case, your two ISPs are not on separate interfaces but on separate gateways. The notes and commands about additional NAT rules won't apply to you I presume. The iproute2 will probably be very useful to you (combined with te connsave/restore functions in IPTables).

Hope this helps,


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
iptables redirection rexjenny Linux - Networking 2 03-26-2010 08:55 AM
IPTables redirection hazza96 Linux - Networking 8 02-16-2009 01:57 AM
iptables redirection? prayag_pjs Linux - Newbie 3 04-16-2008 11:10 PM
iptables redirection mallikk_in Linux - Networking 11 09-02-2007 01:00 AM
Help:iptables redirection swmok Linux - Networking 2 11-24-2004 07:47 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration