LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-14-2011, 10:14 AM   #1
meekamoo
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Routing traffic by port number to specific interface


So I have a server set up with 2 ppp interfaces.

ppp0 = fast capped at 5GB/m
ppp1 = slow uncapped

I have set up a second proxy server listening on port 8888 on the server. I am trying to route all of those requests through the slow interface and have everything else run through the fast interface.

My ideal set up is to get torrents to run through the slower one (similar to http://www.linuxquestions.org/questi...erface-792766/) but I'll try that once I've gotten this working (as far as i know torrents use a specific port range so it shouldn't be that tricky to adapt this)

As far as I know, it involves 3 steps.
Step 1 - Mark packets in firewall
Step 2 - Create a routing rule to send all marked packets to a specific lookup table
Step 3 - Set the default route for that lookup table to the gateway + dev for the interface.

I have marked the packets in the firewall as when I access the proxy I can see the requests in the firewall logs.

Code:
iptables -t mangle -A PREROUTING -p tcp --dport 8888 -j MARK --set-mark 5
iptables -t mangle -A PREROUTING -p tcp --dport 8888 -j LOG --log-level DEBUG --log-prefix "port 8888 test: "
I don't need it on the OUTPUT table as this is only for pc's behind the NAT, not the server itself.

I have added the tables into /etc/iproute2/rt_tables:

Code:
200 telkom
201 axxess
Then the iproute2 magic:

Code:
ip rule add fwmark 5 lookup axxess
ip route add default via 41.240.0.1 dev ppp1 table axxess
tcpdump listening on ppp1 sees nothing.

I don't really know what else to do here? I've literally spent over 20 hours on this over the past few months! About to go crazy here!

Last edited by meekamoo; 01-17-2011 at 03:26 AM.
 
Old 01-16-2011, 05:25 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
ip route add default via 41.240.0.1 dev ppp2 table axxess
ppp2 ?
 
Old 01-17-2011, 03:25 AM   #3
meekamoo
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Sorry, my bad. I'll edit my post - it was meant to say ppp1
 
Old 01-17-2011, 08:14 AM   #4
jimbo1954
Member
 
Registered: Oct 2006
Location: High Wycombe, Bucks, UK.
Distribution: Debian and Fedora Core in equal measure
Posts: 264

Rep: Reputation: 33
Are you doing it the hard way?

Just my 2c worth....this may be way off the mark, but....

It looks like you want to do someting like what I do to feed my HTTP traffic through my Proxy, but I do the redirect a simpler way than writing direct to IPTables...would it not be simpler to use s a front-end (I use shorewall) and just tell shorewall to capture and redirect certain traffic to a different interface? I may be misinterpreting what you are doing, and respect is due if you manually hack IPTables, but I'm trying to see a simpler way of doing what you are doing.
 
  


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
Send traffic from one application out a specific interface? xamindar Linux - Networking 6 08-08-2011 06:22 PM
Routing traffic from one interface to another Vaelek Linux - Networking 10 05-07-2009 10:39 PM
Routing Specific Traffic Through Different Internet Connections afrorobot Linux - Networking 9 09-17-2008 04:57 PM
routing traffic from one interface to another a550ee Linux - Networking 0 07-08-2007 03:28 PM

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

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