LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 09-27-2010, 05:50 PM   #1
jenkinsgroup
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, 02:43 AM   #2
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 360

Rep: Reputation: 41
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: http://www.mariusv.com/netfilteripta...multiple-isps/ 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,
 
  


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


All times are GMT -5. The time now is 04:37 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration