Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Networking > Multiple internet outbound connections

Forgot Password?
 Linux Networking   Hardware/Software related, Modems, Internet connection sharing, IPTables etc.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-03-2008   #1 (permalink)
Just Joined!
 
Join Date: Jul 2008
Posts: 1
Multiple internet outbound connections

I'm trying to get selective traffic(by port) 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 shown by 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 ONLY need this specific port traffic(3389) go through this interface this solution is unacceptable. Any clues?

Thanks in advance.
einundswanzig is offline  


Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 07:29 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2