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 09-30-2010, 08:52 AM   #1
hansemmanuel
LQ Newbie
 
Registered: Feb 2010
Posts: 13

Rep: Reputation: 0
ip routing based on port number.


Hi all.


First I would like to explain my scenario and requirement.

I have 3 gateways in my office. I want to redirect all web traffic

(port 80 and 443) through one gateway and ssh connections through other

one. All machines have single network interface. For this what I did

is created an ip alias et0:1 and assigned ip to it. Then wrote an ip route rule to route packets from eth0:1's ip to other gateway.

All other traffic will go through default gateway. But here I am not sure how I can make web browser to use eth0:1's ip. It's using eth0 's ip. I wrote a ip table rule to change source ip of http packets to
et0:1's ip. But rule is on POSTROUTING chain. So I think it's happening after routing.


Am I on wrong way. Please give me your valuable suggestions.
 
Old 09-30-2010, 10:52 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You may find it simpler to set up a proxy ...
 
Old 10-01-2010, 12:07 AM   #3
hansemmanuel
LQ Newbie
 
Registered: Feb 2010
Posts: 13

Original Poster
Rep: Reputation: 0
yes

But I found a way for this..I marked packets with destaination port 80 , with iptables mangle table. Then used ip route rule
to forward these packets to other gateway.

Thanks
 
Old 10-01-2010, 09:17 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I realise your solution is possible, I was just thinking about what happens when you leave and someone else has to look after it ? ... know what I mean ?

cheers
 
Old 10-02-2010, 12:46 AM   #5
hansemmanuel
LQ Newbie
 
Registered: Feb 2010
Posts: 13

Original Poster
Rep: Reputation: 0
yep..I know proxy is the simple way for this. But I also want to route ssh traffic since I have 4 gateways in my office..

Thanks for your support.
 
  


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
Routing based on destination port rvo Linux - Networking 9 01-11-2011 09:48 AM
Port-policy based routing, not a gateway murmel Linux - Networking 0 09-13-2009 09:16 PM
port based routing for local traffic houska Linux - Networking 2 05-24-2009 07:10 AM
Advanced routing based on outgoing port tenko20xx Linux - Networking 2 02-14-2009 11:18 AM
Port based routing neos Linux - Networking 1 09-21-2005 01:15 PM

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

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

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