Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-10-2013, 05:44 PM
|
#1
|
LQ Newbie
Registered: Sep 2013
Posts: 6
Rep: 
|
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.
|
|
|
09-11-2013, 03:31 AM
|
#2
|
Member
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56
Rep: 
|
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
|
|
|
09-11-2013, 05:10 AM
|
#3
|
LQ Newbie
Registered: Sep 2013
Posts: 6
Original Poster
Rep: 
|
Quote:
Originally Posted by akiuni
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
|
|
|
09-11-2013, 05:44 AM
|
#4
|
Member
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56
Rep: 
|
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...
|
|
|
09-11-2013, 06:48 AM
|
#5
|
LQ Newbie
Registered: Sep 2013
Posts: 6
Original Poster
Rep: 
|
Quote:
Originally Posted by akiuni
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.
|
|
|
09-11-2013, 07:59 AM
|
#6
|
Member
Registered: Sep 2012
Location: France
Distribution: debian
Posts: 56
Rep: 
|
Quote:
Originally Posted by linuxrules1
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
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
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.
|
|
|
09-11-2013, 08:10 AM
|
#7
|
LQ Newbie
Registered: Sep 2013
Posts: 6
Original Poster
Rep: 
|
Quote:
Originally Posted by akiuni
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
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?
|
|
|
All times are GMT -5. The time now is 03:49 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|