-
Notifications
You must be signed in to change notification settings - Fork 31
Quick guide Bonding Example
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 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!
We want to ping test machine 1 (bond0) from test machine 2 (eth1).
Save the following code in file recipe.xml to your controller machine.
<lnstrecipe>
<network>
<host id="testmachine1">
<interfaces>
<eth label="test_net" id="test_if1"/>
<eth label="test_net" id="test_if2"/>
<bond id="test_bond">
<options>
<option name="mode" value="balance-rr"/>
<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>
</host>
<host id="testmachine2">
<interfaces>
<eth id="test_if3" label="test_net">
<addresses>
<address value="192.168.200.2/24"/>
</addresses>
</eth>
</interfaces>
</host>
</network>
<task>
<run module="IcmpPing" host="testmachine1">
<options>
<option name="addr" value="{ip(testmachine2, test_if3)}"/>
<option name="count" value="5"/>
</options>
</run>
</task>
</lnstrecipe>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.serviceon 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. For that you first need to create a pool with the two test machines that you will be using.
-
create a new directory for the pool, e.g. ~/.lnst/pool/
-
create two files describing the test machines, machine1.xml and machine2.xml
-
use this xml as a template for the previous two files, REPLACE the HOSTNAME and HWADDR in both files with an approriate value.
<slavemachine>
<params>
<param name="hostname" value="HOSTNAME"/>
</params>
<interfaces>
<eth label="A" id="1">
<params>
<param name="hwaddr" value="HWADDR"/>
</params>
</eth>
</interfaces>
</slavemachine>And after you've created the pool just run the controller (on the controller machine) like this:
$ lnst-ctl run recipe.xml- IcmpPing test description and options
- Function {ip()}