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.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Networking
Reload this Page Multiple internet outbound connections
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

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

Reply
 
Thread Tools Display Modes
Old 07-03-2008   #1 (permalink)
einundswanzig
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




All times are GMT. The time now is 06:10 AM.




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

Content Relevant URLs by vBSEO 3.0.0