Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have one server, with double NICs connected to one switch with the same gateway. Behind the switch we have internet.

|Debian| -> eth0 -> switch -> internet -> eth1 -> same

I don't understand how to load-balancing between eth0 and eth1. The inbound/outbound traffic always use eth1.

This is the config:

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.248.82
netmask 255.255.255.240
network 192.168.248.80
broadcast 192.168.248.95
gateway 192.168.248.81

allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.248.83
netmask 255.255.255.240
network 192.168.248.80
broadcast 192.168.248.95
gateway 192.168.248.81

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth1
192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth0
0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth0

Ips aren't real, it's just for the example.

Anybody have an idea on correct routing to use eth0 on 192.168.248.82 and eth1 on 192.168.248.83 ? I have many example for multiple gateway but here it's the same.

Thanks all.

Regards

share|improve this question
1  
Are you sure you don't want channel bonding (aka link aggregation, etherchannel) which allows you to combined multiple physical connections into a single link? –  Zoredache Jan 11 '11 at 19:08
    
I tried it, but doesn't work in my environnement. My problem appears to be simple but i can't route it correctly :s –  pouney Jan 11 '11 at 19:12
    
Why did bonding not work in your environment. Perhaps you should ask a question about that. –  Zoredache Jan 11 '11 at 19:17
    
When i try bonding mode 0, i loss 50% of my packets. Mode 3 works fine but i think only one interface works, and mode 4/6 don't work at all (timeout). I don't own the network infrastructure (datacenter), so i prefer to route traffic by interface, it's more reliable. –  pouney Jan 11 '11 at 19:21
    
You should give bonding another try. –  SpacemanSpiff Jan 11 '11 at 20:05

2 Answers 2

The short answer is that you can't really do that. Things aren't designed to work that way.

Yes, Linux is pretty flexible so you could probably find some really obscure methods to achieve some of the behavior your want, but it would be much better to bond the two links.

share|improve this answer

To do what you want you may want to look at some of the documentation on multiple ISP connections. The concepts may be close enough to what you are trying to do. This Shorewall Multi-IPS documentation may give you an idea how to do it.

share|improve this answer
    
I think that it's easy to route traffic on eth0 when connection is opened on eth0, and eth1 when it's done on eth1. But if not, i'll retry bond 0 but it results as half packets loss. –  pouney Jan 11 '11 at 21:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.