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 06-25-2012, 03:12 AM   #1
Cheerz
LQ Newbie
 
Registered: Sep 2011
Posts: 5

Rep: Reputation: Disabled
Mutiple Outbound Internet Connections


Hi All

I need some assistance in getting my Multi WAN (Outbound internet) connections set up. Followed various articles on the internet and my configuration is included.

My scenario is as follows:

LAN Connection
eth0 - 10.3.1.0/24

Internet Connections using 2 ADSL lines (I just hooked up to existing connections in order for me to do some testing)

eth1 - 192.168.1.2/24 - GW 192.168.1.1
eth2 - 192.168.2.2/24 - GW 192.168.2.1

routes:

ip route add 192.168.1.0/24 dev eth1 src 192.168.1.2 table 1
ip route add default via 192.168.1.1 table 1
ip rule add from 192.168.1.2 table 1

ip route add 192.168.2.0/24 dev eth2 src 192.168.2.2 table 2
ip route add default via 192.168.2.1 table 2
ip rule add from 192.168.2.2 table 2

ip route replace default scope global nexthop via 192.168.1.1 dev eth1 weight 1 nexthop via 192.168.2.1 dev eth2 weight 1


iptables:

iptables -t mangle -N WAN0
iptables -t mangle -N WAN1
iptables -t mangle -N RESTORE
iptables -t mangle -A RESTORE -j CONNMARK --restore-mark
iptables -t mangle -A WAN0 -j MARK --set-mark 1
iptables -t mangle -A WAN0 -j CONNMARK --save-mark
iptables -t mangle -A WAN1 -j MARK --set-mark 2
iptables -t mangle -A WAN1 -j CONNMARK --save-mark
iptables -t mangle -A PREROUTING -i eth0 -p tcp -m state --state ESTABLISHED,RELATED -j RESTORE
iptables -t mangle -A PREROUTING -p tcp -m state --state NEW -m statistic --mode nth --every 2 --packet 0 -j WAN0
iptables -t mangle -A PREROUTING -p tcp -m state --state NEW -m statistic --mode nth --every 2 --packet 1 -j WAN1
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

When doing traceroutes the traffic is leaving one of the two WAN links. Normal browsing works fine but downloads are extremely slow or time out after a while. Using the ADSL's normally from a system works fine.
 
Old 06-25-2012, 02:43 PM   #2
nini09
Member
 
Registered: Apr 2009
Posts: 995

Rep: Reputation: 67
Routing specific subnet (source ip) to a particular interface should be like this.
"ip rule add from 1.2.3.4/24 table 1"
"ip route add 1.2.3.4/24 table 1 dev eth4"
All traffic from 1.2.3.4/24 will be routed using routing table 1 through eth4.
 
  


Reply

Tags
adsl, iproute2, iptables


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
Outbound http connections blocked charu Linux - Newbie 2 11-21-2010 03:04 PM
Iptables Control Outbound Connections - need help xoros Linux - Networking 5 04-29-2009 05:30 AM
Only allow outbound connections CrEsPo Linux - Security 4 01-01-2007 11:54 AM
programs making outbound connections six6 Debian 2 11-03-2004 11:04 PM
suspicious outbound connections di11rod Linux - Networking 13 01-23-2004 02:55 AM


All times are GMT -5. The time now is 11:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration