Skip to content

Quick guide Bonding Example

jtluka edited this page Aug 19, 2013 · 10 revisions

In this quick guide, we will demonstrate how to configure and use bonding driver in LNST recipes.

LNST is a very powerful tool for testing logical interfaces built on top of physical ones, such as bonding, team and VLAN interfaces. It manages all the configuration within the <interfaces> facility in the recipe. The configuration will be applied automatically each time the recipe is executed.

Test Setup

     test machine 1
  ---------------------
    eth0   +-bond0-+                  test machine 2
     |     |       |                ------------------
     |    eth1    eth2                  eth1  eth0
     |     |       |                     |     |
     |     |       |    +--------+       |     |
     |     |       +----|        |       |     |
     |     |            | SWITCH |-------+     |
     |     +------------|        |             |
     |                  +--------+             |
     |                                         |
     |                  +--------+             |
     +------------------| SWITCH |-------------+
                        +--------+
                            |
                            |
                           eth0
                    ------------------
                    controller machine
                    (e.g. your laptop)

It is vital to point out, that neither the test machines nor the switches need to be physical. You can use bridged virtual machines for testing as well!

Test goal

We want to ping test machine 1 (bond0) from test machine 2 (eth1).

LNST recipe

Save the following code in file recipe.xml to your controller machine.

Modify:

  • hostname inside <params> tag to match the IP addresses or host names of test machine 1 and test machine 2
  • hwaddr inside <eth> tag to match the MAC addresses of the "eth1" interface on test machine 1 and test machine 2
<lnstrecipe>
    <machines>
        <machine id="testmachine1">
            <params>
                <param name="hostname" value="192.168.1.2"/>
            </params>
            <interfaces>
                <eth network="test_net" id="test_if1">
                    <params>
                        <param name="hwaddr" value="52:54:01:00:00:05"/>
                    </params>
                </eth>
                <eth network="test_net" id="test_if2">
                    <params>
                        <param name="hwaddr" value="52:54:01:00:00:08"/>
                    </params>
                </eth>
                <bond id="test_bond">
                    <options>
                        <option name="mode" value="0"/>
                        <option name="miimon" value="100"/>
                    </options>
                    <slaves>
                        <slave id="test_if1"/>
                        <slave id="test_if2"/>
                    </slaves>
                    <addresses>
                        <address value="192.168.200.1/24"/>
                    </addresses>
                </bond>
            </interfaces>
        </machine>
        <machine id="testmachine2">
            <params>
                <param name="hostname" value="192.168.1.3"/>
            </params>
            <interfaces>
                <eth id="test_if3" network="test_net">
                    <params>
                        <param name="hwaddr" value="52:54:01:00:00:06"/>
                    </params>
                    <addresses>
                        <address value="192.168.200.2/24"/>
                    </addresses>
                </eth>
            </interfaces>
        </machine>
    </machines>
    <task>
        <run module="IcmpPing" machine="testmachine2">
            <options>
                <option name="addr" value="{ip(testmachine2,test_bond)}"/>
                <option name="count" value="5"/>
            </options>
        </run>
    </task>
</lnstrecipe>

Running the test

First you need to make sure that the lnst-slave daemon is running on the specified slave machines. To do this you run:

$ systemctl start lnst-slave.service

on all the slave machines. You can learn more about the LNST invocation in LNST Invocation.

After you've made sure that lnst is running on all the slave machines you just need to run the controller. To do this you run:

$ lnst-ctl -c recipe.xml run

on the controller machine.

References

Clone this wiki locally