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 06-30-2008, 12:31 PM   #1
einundswanzig
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
Selective traffic diverge with multiple internet connections


I'm trying to get selective traffic(by port) to go through the specified interface(i have TWO internet providers with two different ip address in two different interfaces) I'm following instructions from this site (linux-ip.net/html/adv-multi-internet.html) and basically what I did is:
  1. Add the respective ip address to ethx(x.x.x.2), ethy(y.y.y.2), ethz(z.z.z.2).
  2. Allow INPUT, OUTPUT, FORWARD traffic for testing purposes.
    iptables -P INPUT ACCEPT
    iptables -P OUTPUT ACCEPT
    iptables -P FORWARD ACCEPT
  3. Enable masquerade in both internet providers interfaces:
    iptables -t nat -A POSTROUTING -o ethx -j MASQUERADE
    iptables -t nat -A POSTROUTING -o ethz -j MASQUERADE
  4. Enable kernel ip_forward:
    echo 1 > /proc/sys/net/ipv4/ip_forward
  5. Separate IP2(internet provider 2) routing information in its own table (tableX):
    ip route add x.x.x.0/28 dev ethx table tableX
    ip route add y.y.y.0/24 dev ethy table tableX
    ip route add default via x.x.x.1 dev ethx table tableX
    ip rule add from x.x.x.2 table tableX
  6. Set default (main table) route to IP1(internet provider 1):
    ip route add default via z.z.z.1 dev ethz
  7. Mark selected traffic to avoid this going through the default route(z.z.z.1):
    iptables -t mangle -A PREROUTING -i ethy -p tcp --dport 3389 -j MARK --set-mark 200
  8. Finally set marked packets to go through selected table:
    ip rule add fwmark 200 table tableX

The problem is that a computer in the LAN side(y.y.y.0/24) is unable to connect to the external target. Using tcpdump to trace the traffic in the ethx interface shows that the packet is actually reaching the target AND that the target is responding back, BUT this response never gets to the client(as shows a tcpdump in the ethy interface). The weird point is that if i replace the step 7(the mangle rule) with an iproute2 rule:

ip rule add from y.y.y.155 table tableX

Everything works. But since I need ONLY this specific port traffic(3389) go through this interface this solution is unacceptable. Any clues?

Thanks in advance.
 
Old 07-01-2008, 05:08 PM   #2
einundswanzig
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Original Poster
Rep: Reputation: 0
I

Well i think I'll dead alone in this road
 
  


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 Specific Traffic Through Different Internet Connections afrorobot Linux - Networking 9 09-17-2008 04:57 PM
Routing multiple Internet connections abhinandan Linux - Networking 9 06-04-2008 05:26 AM
Routing Multiple Internet Connections qwertyjoe Linux - Networking 2 11-25-2006 06:24 AM
Selective Internet Traffic? DukieJF Linux - Newbie 4 08-27-2005 01:16 AM
Multiple internet connections kojie Linux - Networking 2 12-08-2004 03:19 PM

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

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