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 09-10-2013, 05:44 PM   #1
linuxrules1
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Rep: Reputation: Disabled
Sub interface Bonding


I currently have Bond0 and Bond 1 defined. Bond 0 has eth0 and eth1 bonded to it and bond 1 has eth 2 and eth3 bonded to it.
I created an additional bond called Bond2 since we needed more interfaces with different IPs for socket creation on the server. Since we didn’t have more physical interface on the machine I created eth2:1 and eth2:2 and bonded them to bond2. I copied all the configuration from existing interfaces so they should be fine (bond2 was created from bond 1 and I have changed the ip from 26.26.26.141 to 26.26.26.142 – the ip doesn’t have to be routable so a different subnet isn’t necessary, eth2:1 and eth2:2 were created from eth2 – they have the same mac address as eth2 as they should).
The interfaces themselves don’t have IP addresses as the IPs are defined on the bonds.
I have added the “alias bond2 bonding” command to the /etc/modprobe.conf file.
I have restarted the network service, bond2 was started correctly, I reach 26.26.26.26.142 by py but interfaces eth2:1 and 2:2 aren’t shown when I do the ifconfig command (bond2 is shown correctly), but then I specifically do the ifconfig eth2:1 and ifconfig eth2:2 it does give the following output (eth2:2):
eth2:2 Link encap:Ethernet HWaddr 5C:F3:FC:21:85:0C
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
Interrupt:193 Memory:fa000000-fa012800
When I use the “cat /proc/net/bonding/bond2” command it shows only the following and doesn’t show the related eth interfaces, like it does how for bond0 and bond1 (which I want to mention that have worked properly for years – bond2 is the new addition everything else works perfectly).
cat /proc/net/bonding/bond2
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: None
MII Status: down
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

How can I fix it? Is there a problem that eth2:1 and eth2:2 who are sub interfaces of eth2 belong to a different bond than eth2?
And is there a different solution for adding multiple addresses to a port – obviously I can use a secondary address but (and this is really important part) our entire purpose of adding the new bond is to be able to force the traffic created on the server to have different source ip address based on some parameter that we use and our solution to that is to bind the new sockets to an interface in order to for it to take the interfaces address as the source address, than we catch that traffic with ip rule, tell it to go be routed according to a certain routing table and than using SNAT we change its source ip again – so the ip address on that sub interface can be anything – it is used just to catch the packet with ip rule. But the issue is that we think that unless we bind the to a physical interface during socket creation the source ip of the packet won’t change to that which we want and will remain the same for all packets – that’s why w think that simply adding a secondary address won’t suffice.

Help.
 
Old 09-11-2013, 03:31 AM   #2
akiuni
Member
 
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56

Rep: Reputation: Disabled
Hi

I don't think that you can bond eth aliases because they are just an IP alias, not a devices alias. Bonding needs devices because it will consider layer 1 or 2 parameters (like duplex, mtu etc...). To illustrate this, try to affect a different MTU on a device and its alias, you will get the same MTU for both.

But I don't understand why don't you just create an IP alias on your bonded device ?
For example :
bond0 --> 192.168.1.1
bond1 --> 192.168.2.1
bond1:1 --> 192.168.3.1

bests
Julien
 
Old 09-11-2013, 05:10 AM   #3
linuxrules1
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by akiuni View Post
Hi
But I don't understand why don't you just create an IP alias on your bonded device ?
For example :
bond0 --> 192.168.1.1
bond1 --> 192.168.2.1
bond1:1 --> 192.168.3.1

bests
Julien
the reason why we want to add aliases is to be able to bind to them so different types of traffic will have a different source ip so we can then use an ip rule to catch them based on this source ip and make them get routed according to separate routing tables. We heard somewhere that unless we bind to a different interfaces the source ip won't really change and that it will still get out from bond1 and not for example bond1:1. Do you think that using Bond1:1 which doesn't create a different interface with enough for making the socket take the source ip of bond1:1?

By the way - we want to use on the secondary interface (lets say bond1:1) an ip address from the same segment like on bond1 - for example bond1:1 192.168.2.2
since we change it using snat just before it leaves the server. Will it be okay?

Thanks
 
Old 09-11-2013, 05:44 AM   #4
akiuni
Member
 
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56

Rep: Reputation: Disabled
I think that it will work fine. If your server binds "192.168.2.2" then the packets will get out with that source ip address (which is bond1:1).

However, keep in mind that bond1:1 is just a layer 3 alias, the packets will travel through a physical device (bond1/ethx).
I've never tested snat with bonding, but ip aliases are working well. So my advice would be to setup your rules based on source ip (192.168.2.2 on our example), not the device (bond1:1) because I don't know if snat will operate after the packet has been passed to eth or not...
 
Old 09-11-2013, 06:48 AM   #5
linuxrules1
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by akiuni View Post
I think that it will work fine. If your server binds "192.168.2.2" then the packets will get out with that source ip address (which is bond1:1).

However, keep in mind that bond1:1 is just a layer 3 alias, the packets will travel through a physical device (bond1/ethx).
I've never tested snat with bonding, but ip aliases are working well. So my advice would be to setup your rules based on source ip (192.168.2.2 on our example), not the device (bond1:1) because I don't know if snat will operate after the packet has been passed to eth or not...
If I use bond1:1 do I need to assign interfaces to it or will it use the same interfaces that are assigned to bond1?
Is there a difference between a sub bond like bond1:1 and a new bond like bond2? Maybe in that it's not necessary to assign interfaces to it? What about doing this command: “alias bond1:1 bonding” command to the /etc/modprobe.conf file. is it necessary for sub bond?

Another thing: what's the difference between using bond1:1 and just adding a secondary address to bond1. Isn't it the same in both cases?

Last edited by linuxrules1; 09-11-2013 at 07:16 AM.
 
Old 09-11-2013, 07:59 AM   #6
akiuni
Member
 
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56

Rep: Reputation: Disabled
Quote:
Originally Posted by linuxrules1 View Post
If I use bond1:1 do I need to assign interfaces to it or will it use the same interfaces that are assigned to bond1?
Another thing: what's the difference between using bond1:1 and just adding a secondary address to bond1. Isn't it the same in both cases?
It's exactly the same, bond1:1 is a secondary address to bond1 (like eth1:1 is a secondary address to eth1). It will use the same interfaces that are assigned to bond1 (like eth1:1 will use the same nic as eth1) so you won't be able to add an interface to bond1:1 (like, for example, you won't be able to change the mtu to eth1).

Quote:
Originally Posted by linuxrules1 View Post
Is there a difference between a sub bond like bond1:1 and a new bond like bond2? Maybe in that it's not necessary to assign interfaces to it?
The difference is that bond1:1 is not a device, it's just secondary IP adress to bond1. So you won't be able to assign interfaces to it. Whereas bond2 is a seperate device, aggregating two physical devices different than those in bond1.

Quote:
Originally Posted by linuxrules1 View Post
What about doing this command: “alias bond1:1 bonding” command to the /etc/modprobe.conf file. is it necessary for sub bond?
I don't think that command will work and if it does I'm wondering the consequences... bond1:1 should be created in /etc/network/interface (for debian), not in modprobe


What I believe is that bonding has nothing to do with your snat/routing goal, you would face exactly the same behavior with eth devices, but I also may be wrong. My idea is just to create a secondary IP address on your device (whatever bonding or physical), bind you server to that alias and base your routing/snat rules on it.
 
Old 09-11-2013, 08:10 AM   #7
linuxrules1
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by akiuni View Post
Whereas bond2 is a seperate device, aggregating two physical devices different than those in bond1.
Do you mean that I can't sub interfaces to bond2? I have done so (doesn't work yet) but do you think I can't add sub interfaces of for example eth2, that belongs to bond1 (eth2:1 and eth2:2) to bond2 and use them as its interfaces?

Quote:
Originally Posted by akiuni View Post
What I believe is that bonding has nothing to do with your snat/routing goal, you would face exactly the same behavior with eth devices, but I also may be wrong. My idea is just to create a secondary IP address on your device (whatever bonding or physical), bind you server to that alias and base your routing/snat rules on it
So you suggestion is to use bond1:1. right? What its difference between it and simply adding a secondary address for bond1?
 
  


Reply

Tags
bonding, interface, netwoking, network, nic


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
Bonding a virtual interface frd4460 Linux - Networking 3 11-01-2013 04:48 PM
Bonding / Binding multiple interface into 1 netguy2000 Linux - Networking 1 05-27-2010 12:15 PM
bonding and vlans. Bonding a vlan interface vs applying vlans to a bond interface JasonCzerak Linux - Networking 0 09-11-2008 10:59 AM
Interface bonding question bajones Linux - Newbie 2 07-21-2008 12:40 PM
Bonding / Binding multiple interface into 1 netguy2000 Linux - Networking 15 09-03-2007 05:06 AM

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

All times are GMT -5. The time now is 03:49 PM.

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