LinuxQuestions.org
Review your favorite Linux distribution.
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 10-26-2004, 11:21 PM   #1
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Rep: Reputation: 0
Two WAN cards on same gateway


I am trying to figure out how to handle load balancing using two wan cards that on the same gateway.

WAN NETWORK | LAN NETWORK

(eth1) 192.168.0.2 ---------------------|
[ROUTER]---------------- (eth0) 192.168.1.*
(eth2) 192.168.0.3 ---------------------|


Thats basically how I want it to work. I have two WAN cards with different IPs on the same gateway (from the same ISP router) going to my router. I want to make my router take requests from everything on the LAN and send it out eth1 or eth2 depending on the load of each card. So if eth1 has alot of traffic it would send it out eth2.

Should I look into something more load balancing or tc related with iproute2, nat related with iptables, or bridging? I have searched for all on google and tried various configurations and nothing worked yet. Iproute2 had something, but because both were on the same gateway/netmask it wouldn't accept 1/3 of the commands : \

Please help!!!
 
Old 10-27-2004, 12:46 AM   #2
nitin_batta
Member
 
Registered: Aug 2004
Location: India
Distribution: Redhat Enterprise Server 2.1
Posts: 96

Rep: Reputation: 15
Are you trying to balance the load for the traffic coming in to the server through the router.

 
Old 10-27-2004, 08:31 AM   #3
neilman
Member
 
Registered: Oct 2004
Location: Northville, MI
Distribution: Slackware
Posts: 65

Rep: Reputation: 15
Darn it -- I just read an article in Linux Journal a month or two ago that had mentioned this. In fact, it very well have may been just an editors code snip to a reader who asked a question. I'll search hard for it, but if you're a subscriber, I'd do the same. I think it was simple ifconfig and route commands that did exactly what it is you wanted to do -- but, mostly for automatic failover if I remember correctly. Do you actually have true distinct WAN access by each NIC? And secondly, have you ever come to the point where you''ve really exceeded the bandwidth available from your WAN, through your NIC?
 
Old 10-27-2004, 04:17 PM   #4
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for your replies...

I am trying to load balancing traffic going out from the LAN to the WAN. The IPs are routed from my school, but do not slow each other down. In other words if eth1 is at 90%+ eth2 can still use the network just fine.

There are a couple reasons why we want to use both network connections through one router and we may try different setups depending on what we can get to work. One reason we want to do it is so we can have a combine bandwidth limit (our school limits download and upload amount). Another idea we have is with out Direct Connect network at school. Its on the LAN so it definetely uses the max speed of our network connection speed (10 mbit to our school's gateway, but we are using 100mbit cards). If we leave DC on and play a game and have someone downloading from us we get bad ping times (no FPS loss or CPU loss, definitely just network). So we were thinking of doing load balance based on the current transfer rate of the cards and having our DC default through a specific card. Ex:

DC goes through eth1 and lots of people are downloading. If we try to play a game or use the web it will go through eth2 (because eth1 has a higher transfer rate).
If DC is not being used and both cards are idle it will make connections based on which ever card has the least transfer rate.

I was looking into using iptables and the connrate extension, but the patch-o-matic fails on both kernel versions I have (2.6.9 and 2.4.x whatever came with Slackware 10)

Another idea we explored was having one network card send data out and the other recieve data, but I dunno if we would really benefit that much since they are fast connections. In case you are curious why I am trying to make things more complicated than they need to be I am doing this for an educational experience and maybe to utilize two DSL lines when I move off campus.

Thanks for your help, I'll search around in 'Linux Journal ' to see if I can find this article
 
Old 10-27-2004, 04:48 PM   #5
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Awesome suggestion, I think the article will fix it... I am going to try it in a little bit, ill let you know the results. I think the router is the main problem, I can probably figure out those other ideas working with iptables.

Thanks man!!!

http://www.linuxjournal.com/article.php?sid=7291
 
Old 10-28-2004, 06:16 PM   #6
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Alright it was working quite well since last night, but now today we are having a problem with web browsing. Completely random sites will not work from anything off eth0 (the routed lan network), but will work straight off the router or from SSH logged in to one of my schools servers. I am guessing this is an IPTABLES issue? I can't really tell, but I MIGHT be sending out traffic all on eth2 and recieving it on eth1... Anyone have any ideas or suggestions?

FILTER

Chain INPUT (policy ACCEPT 8893K packets, 6692M bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 4155 packets, 2354K bytes)
pkts bytes target prot opt in out source destination
618K 879M ACCEPT all -- eth0 eth1 anywhere anywhere
9316K 5250M ACCEPT all -- eth0 eth2 anywhere anywhere
11M 10G ACCEPT all -- eth1 eth0 anywhere anywhere
2046K 379M ACCEPT all -- eth2 eth0 anywhere anywhere

Chain OUTPUT (policy ACCEPT 2263K packets, 1260M bytes)
pkts bytes target prot opt in out source destination

NAT

Chain PREROUTING (policy ACCEPT 708K packets, 138M bytes)
pkts bytes target prot opt in out source destination
553 22656 DNAT tcp -- eth1 any anywhere resnet-172.xxx.xxx.xxx.resnet.rutgers.edu tcp dpt:af to:192.168.0.200
1489 231K DNAT udp -- eth1 any anywhere resnet-172.xxx.xxx.xxx.resnet.rutgers.edu udp dpt:af to:192.168.0.200
32 1536 DNAT tcp -- eth1 any anywhere resnet-172.xxx.xxx.xxx.resnet.rutgers.edu tcp dpt:innosys to:192.168.0.128
447 68512 DNAT udp -- eth1 any anywhere resnet-172.xxx.xxx.xxx.resnet.rutgers.edu udp dpt:innosys to:192.168.0.128

Chain POSTROUTING (policy ACCEPT 40036 packets, 6271K bytes)
pkts bytes target prot opt in out source destination
60382 3083K MASQUERADE all -- any eth2 anywhere anywhere
597 46990 MASQUERADE all -- any eth1 anywhere anywhere

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination


The second MASQUERADE (the one for eth1) was removed to do some testing and then added again so the traffic on it should be much higher.
 
Old 10-28-2004, 08:29 PM   #7
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
I just restart the computer and did some stuff again, basically the same setup. It doesn't really matter because this was happening before the reboot too. It seems that on my LAN card everything works fine, but on my two WAN cards I send out nothing but error packets and recieve normal packets. I think this might be a problem. The numbers are low right now, but before they were in the millions+

What does the error mean and should I be concerned about it if my internet works (for the most part) and I never transmit anything out of the WAN cards except an error?

eth0 = LAN
eth1 and eth2 = WAN on the same gateway/netmask

eth0 Link encap:Ethernet HWaddr 00:xx:xx:xx:xx:xx
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:31806 errors:0 dropped:0 overruns:0 frame:0
TX packets:31681 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3290346 (3.1 Mb) TX bytes:18799518 (17.9 Mb)
Interrupt:11

eth1 Link encap:Ethernet HWaddr 00:xx:xx:xx:xx:xx
inet addr:172.xxx.xxx.xxx Bcast:172.xxx.xxx.255 Mask:255.255.252.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14620 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:373 dropped:0 overruns:0 carrier:720
collisions:0 txqueuelen:1000
RX bytes:1634188 (1.5 Mb) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xdc00

eth2 Link encap:Ethernet HWaddr 00:xx:xx:xx:xx:xx
inet addr:172.xxx.xxx.xxx Bcast:172.xxx.xxx.255 Mask:255.255.252.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16814 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:859 dropped:0 overruns:0 carrier:1619
collisions:0 txqueuelen:1000
RX bytes:2252417 (2.1 Mb) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xd800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:43 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10159 (9.9 Kb) TX bytes:10159 (9.9 Kb)
 
Old 10-28-2004, 09:37 PM   #8
mikek
LQ Newbie
 
Registered: Feb 2004
Posts: 7

Rep: Reputation: 0
an alternative

Yes I definately think you are trying to make things too complicated.

But it you insist, another way way of doing some of the things you are talking about can be done with the bonding.o kernel module. It supports features like: AFT is an active-passive with a standby NIC. ALB is load balancing where all NICs receive and one NIC sends (usually useful on a server being accessed by many clients). RLB will allow all NICs to send and receive.
 
Old 10-28-2004, 10:37 PM   #9
h8trix
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Under other circumstances the bonding driver would be ideal, but am not connected to a gateway that would support the driver : \
 
  


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
dhclient not setting default gateway - no WAN route kadissie Linux - Networking 2 03-10-2005 04:55 AM
FreeS/Wan Vs. OpenS/Wan Vs. StrongS/Wan bkankur Linux - Security 1 03-01-2005 09:27 AM
Gateway setting for dual NIC cards? Moonman Red Hat 4 02-02-2005 01:28 AM
3 network cards and problem with gateway Oderus Slackware 4 10-19-2004 02:46 PM
two nic cards configuration for gateway red1526 Linux - Networking 3 03-06-2002 04:44 PM


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