LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-12-2006, 04:43 AM   #1
kassle
Member
 
Registered: Jan 2006
Distribution: bodhi
Posts: 44

Rep: Reputation: 15
Unhappy Gateway with Dual ISP


I have follow linux advanced routing and trafic control manual to merge two ISP (A and B), and it work well. Using traceroute (from gateway) the gateway is able to splitting into different ISP.

But the problem is the clients (LAN) always use ISP A, never use B. Which is wrong? the route and/or iptable, or the other.

the routing picture:
Code:
------------              ------------
|  ISP A   |              |   ISP B  |
| 10.0.0.1 |              | 10.1.1.1 |
------------              ------------
      |                        |
      -----------        ---------
(eth0 10.0.0.2) |        | (eth1 = 10.1.1.2)
             ---------------
             |   GATEWAY   |
             |     eth2    |
             | 11.11.11.11 |
             ---------------
                    |
                 -------
                 | LAN |
                 -------
here is my routing
Code:
ip route add 10.0.0.0/24 dev eth0 src 10.0.0.2 table CBN
ip route add default via 10.0.0.1 table CBN
ip route add 10.1.1.0/24 dev eth1 src 10.1.1.2 table IDS
ip route add default via 10.1.1.1 table IDS

ip route add default scope global nexthop via 10.0.0.1 dev eth0 weight 1 nexthop via 10.1.1.1 dev eth1 weight 1
my routing rule
Code:
ip rule add from 10.1.1.2 table IDS
ip rule add from 10.0.0.2 table CBN
my iptables
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
 
Old 07-12-2006, 09:57 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Try using SNAT target in the iptables instead of MASQUERADE. See man iptables:

MASQUERADE
This target is only valid in the nat table, in the POSTROUTING chain.It should only be used with dynamically assigned IP (dialup) connec-tions: if you have a static IP address, you should use the SNAT target.
Masquerading is equivalent to specifying a mapping to the IP address of the interface the packet is going out, but also has the effect that connections are forgotten when the interface goes down. This is the correct behavior when the next dialup is unlikely to have the same interface address (and hence any established connections are lost anyway).

SNAT
This target is only valid in the nat table, in the POSTROUTING chain.
It specifies that the source address of the packet should be modified (and all future packets in this connection will also be mangled), and rules should cease being examined. It takes one type of option:
--to-source ipaddr[-ipaddr][:port-port]
which can specify a single new source IP address, an inclusive range of IP addresses, and optionally, a port range (which is only valid if the rule also specifies -p tcp or -p udp). If no port range is specified, then source ports below 512 will be mapped to other ports below 512: those between 512 and 1023 inclusive will be mapped to ports below 1024, and other ports will be mapped to 1024 or above. Where possible, no port alteration will occur.

You can add several --to-source options. If you specify more than one source address, either via an address range or multiple --to-source options, a simple round-robin (one after another in cycle) takes place between these adresses.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
dual-booting a Gateway 500GR doulos05 Linux - Newbie 3 05-10-2005 07:49 PM
Gateway setting for dual NIC cards? Moonman Red Hat 4 02-02-2005 01:28 AM
second gateway from second ISP on FEdoara Firewall NAT Router SERVER saint99 Linux - Networking 1 05-23-2004 06:02 PM
How do I connect dual nics in firewall to the gateway? scoobadiver Linux - Newbie 3 01-12-2004 05:03 PM
About GATEWAY AND ISP Tancrede Linux - Newbie 1 08-07-2003 10:08 AM

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

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