Bond a physical interface with its alias

R.K.
2011-10-09
2013-06-06
  • R.K.
    R.K.
    2011-10-09

    I have been working on a network communication controller device which its OS is the Linux kernel 2.6. This device

    has just one WAN interface in order to make it available to get connected to other communication controllers in

    other sites ( other communication controllers are in other locations). The communication controllers are connected

    to each others by OpenVPN bridging.

    I have two network services. One of them is MPLS and its ipaddress has been set on WAN interface (eth0). The other

    one is VPLS and I have to set its IP address on an alias network interface (eth0:0).

    What I want to do is to bond or aggregate the bandwidth of these two services for loadbalance and failover.
    My question is: Is it possible to bond a physsical interface with its alias network interface?
    If yes, is this solution has any confilict with the OpenVPN tunnels between communication controllers or it is going

    to be OK to load OpenVPN?

    Thanks in Advance
    R.K.

     
  • Jay Vosburgh
    Jay Vosburgh
    2011-10-10

    >My question is: Is it possible to bond a physsical interface with its alias network interface?

    No, it's not.

    The reason is that "alias" interfaces don't really exist; they're magic done by labels and ifconfig.  E.g., suppose we have eth0 and eth0:1, each with a separate IP address:

    # ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 00:11:25:0D:80:B2
              inet addr:10.0.1.1  Bcast:10.0.255.255  Mask:255.255.0.0
              inet6 addr: 6000::1/96 Scope:Global
              inet6 addr: fe80::211:25ff:fe0d:80b2/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:2183304 errors:0 dropped:67 overruns:0 frame:0
              TX packets:3444366 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:2037719462 (1943.3 Mb)  TX bytes:2031382055 (1937.2 Mb)

    # ifconfig eth0:1
    eth0:1    Link encap:Ethernet  HWaddr 00:11:25:0D:80:B2
              inet addr:10.99.1.1  Bcast:10.99.255.255  Mask:255.255.0.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

    We can use the "ip" program to show how this really works:

    # ip addr show eth0
    3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 00:11:25:0d:80:b2 brd ff:ff:ff:ff:ff:ff
        inet 10.0.1.1/16 brd 10.0.255.255 scope global eth0
        inet 10.99.1.1/16 brd 10.99.255.255 scope global eth0:1
        inet6 6000::1/96 scope global
           valid_lft forever preferred_lft forever
        inet6 fe80::211:25ff:fe0d:80b2/64 scope link
           valid_lft forever preferred_lft forever

    The "alias" interface address, 10.99.1.1 in this example, is really a second IP address on the real interface eth0, with a label, "eth0:1", so that ifconfig can present the "alias" interface in the manner it always has, even though there is no actual separate interface.

    Bonding is a layer 2 load balancer; what you would have to do to balance your traffic here is something at layer 3, in the routing system.  For that, I'd suggest you look at the Linux Advanced Routing and Traffic Control HOWTO, at lartc.org.  Depending upon exactly what you need, some kind of policy routing system may provide what you're looking for.