Skip to content

Quick guide Simple VLAN configuration on two machines

Ondrej Lichtner edited this page Nov 3, 2016 · 6 revisions

Test setup

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

Test goal

We want to ping test machine 2 (eth1.10) from test machine 1 (eth1.10). Both NICs are using the same VLAN with ID 10.

LNST recipe

Save the following code into file recipe.xml on controller machine.

<lnstrecipe>
    <network>

        <host id="testmachine1">
            <interfaces>
                <eth id="1" label="tnet"/>
                <vlan id="testifc1">
                    <options>
                        <option name="vlan_tci" value="10"/>
                    </options>
                    <slaves>
                        <slave id="1"/>
                    </slaves>
                    <addresses>
                        <address value="192.168.200.2/24"/>
                    </addresses>
                </vlan>
            </interfaces>
        </host>

        <host id="testmachine2">
            <interfaces>
                <eth id="1" label="tnet"/>
                <vlan id="testifc2">
                    <options>
                        <option name="vlan_tci" value="10"/>
                    </options>
                    <slaves>
                        <slave id="1"/>
                    </slaves>
                    <addresses>
                        <address value="192.168.200.3/24"/>
                    </addresses>
                </vlan>
            </interfaces>
        </host>

    </network>

    <task>
        <run module="IcmpPing" host="testmachine1">
            <options>
                <option name="addr" value="{ip(testmachine2,testifc2)}"/>
                <option name="count" value="3"/>
            </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. For that you first need to create a pool with the two test machines that you will be using.

  1. create a new directory for the pool, e.g. ~/.lnst/pool/

  2. create two files describing the test machines, machine1.xml and machine2.xml

  3. 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

References