Difference between revisions of "ONE/RTR setup"

From fd.io
< ONE
Jump to: navigation, search
(Created page with " = Overview = This tutorial shows how to setup a topology with an re-encapsulating LISP tunnel router (RTR) with a single interface used as an ingress and egress. === Prere...")
(No difference)

Revision as of 12:03, 31 May 2016

Overview

This tutorial shows how to setup a topology with an re-encapsulating LISP tunnel router (RTR) with a single interface used as an ingress and egress.

Prerequisites

Topology

ONE tutorial topology

Setup

This section explains how to build VPP lite and walks through the host, vpp and ODL configs

Build VPP lite

Assuming this is done in a vagrant vm:

cd /vpp
export PLATFORM=vpp_lite
make build

More details on vpp-lite and other alternative builds can be found in the alternative builds section.

Host

Install bridge-utils and ethtool if needed:

sudo apt-get install bridge-utils ethtool 

Create namespaces and set up client, vpp and ODL interfaces.

#!/usr/bin/env bash
# path to vpp executable and configurations folder
VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
VPP_LITE_CONF=/etc/vpp/lite/

pkill vpp

# delete previous incarnations if they exist
ip netns exec xtr-rtr-ns ifconfig vppbr1 down
ip netns exec xtr-rtr-ns brctl delbr vppbr1
ip link del dev vpp1 &> /dev/null
ip link del dev vpp2 &> /dev/null
ip link del dev xtr_rtr1 &> /dev/null
ip link del dev xtr_rtr2 &> /dev/null
ip link del dev xtr_rtr3 &> /dev/null
ip link del dev odl &> /dev/null

ip netns del vpp-ns1 &> /dev/null
ip netns del vpp-ns2 &> /dev/null
ip netns del xtr-rtr-ns &> /dev/null

if [ "$1" == "clean" ] ; then
  exit 0
fi

if [ ! -e ${VPP_LITE_BIN} ] ; then
  echo "VPP binary not found: $VPP_LITE_BIN"
  exit 1
fi

ip netns add vpp-ns1
ip netns add vpp-ns2
ip netns add xtr-rtr-ns

ip link add veth_xtr_rtr1 type veth peer name xtr_rtr1
ip link add veth_xtr_rtr2 type veth peer name xtr_rtr2
ip link add veth_xtr_rtr3 type veth peer name xtr_rtr3
ip link add veth_odl type veth peer name odl
ip link set dev xtr_rtr1 up
ip link set dev xtr_rtr2 up
ip link set dev xtr_rtr3 up
ip link set dev odl up

ip link set dev veth_xtr_rtr1 up netns xtr-rtr-ns
ip link set dev veth_xtr_rtr2 up netns xtr-rtr-ns
ip link set dev veth_xtr_rtr3 up netns xtr-rtr-ns
ip link set dev veth_odl up netns xtr-rtr-ns

ip netns exec xtr-rtr-ns brctl addbr vppbr1
ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr1
ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr2
ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr3
ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_odl
ip netns exec xtr-rtr-ns ifconfig vppbr1 up

ip link add veth_vpp1 type veth peer name vpp1
ip link set dev vpp1 up
ip link set dev veth_vpp1 up netns vpp-ns1

ip netns exec vpp-ns1 \
  bash -c "
    ip link set dev lo up
    ip addr add 6.0.2.2/24 dev veth_vpp1
    ip route add 6.0.4.0/24 via 6.0.2.1
"

ip link add veth_vpp2 type veth peer name vpp2
ip link set dev vpp2 up
ip link set dev veth_vpp2 up netns vpp-ns2

ip netns exec vpp-ns2 \
  bash -c "
    ip link set dev lo up
    ip addr add 6.0.4.4/24 dev veth_vpp2
    ip route add 6.0.2.0/24 via 6.0.4.1
"

ifconfig odl 6.0.3.100/24
ethtool --offload  odl rx off tx off

sudo ${VPP_LITE_BIN} \
  unix { log /tmp/vpp1.log cli-listen \
         localhost:5002 full-coredump \
         exec ${VPP_LITE_CONF}/rtr-simple/vpp1.config } \
  api-trace { on } chroot {prefix xtr1}

sudo ${VPP_LITE_BIN} \
  unix { log /tmp/vpp2.log cli-listen \
         localhost:5003 full-coredump \
         exec ${VPP_LITE_CONF}/rtr-simple/vpp2.config } \
  api-trace { on } chroot {prefix xtr2}

sudo ${VPP_LITE_BIN} \
  unix { log /tmp/rtr.log cli-listen \
         localhost:5004 full-coredump \
         exec ${VPP_LITE_CONF}/rtr-simple/rtr.config } \
  api-trace { on } chroot {prefix rtr}

vpp1 config

create host-interface name vpp1
set int state host-vpp1 up
set int ip address host-vpp1 6.0.2.1/24
create host-interface name xtr_rtr1
set int state host-xtr_rtr1 up
set int ip address host-xtr_rtr1 6.0.3.1/24

lisp enable

lisp map-resolver add 6.0.3.100
lisp locator-set add ls1 iface host-xtr_rtr1 p 1 w 1
lisp eid-table add eid 6.0.2.0/24 locator-set ls1

vpp2 config

create host-interface name vpp2
set int state host-vpp2 up
set int ip address host-vpp2 6.0.4.1/24
create host-interface name xtr_rtr3
set int state host-xtr_rtr3 up
set int ip address host-xtr_rtr3 6.0.3.2/24

lisp enable

lisp map-resolver add 6.0.3.100
lisp locator-set add ls1 iface host-xtr_rtr3 p 1 w 1
lisp eid-table add eid 6.0.4.0/24 locator-set ls1

rtr config

create host-interface name xtr_rtr2
set int state host-xtr_rtr2 up
set int ip address host-xtr_rtr2 6.0.3.3/24

lisp enable
lisp locator-set add ls1 iface host-xtr_rtr2 p 1 w 1
lisp pitr ls ls1
lisp remote-mapping deid 6.0.0.0/16 action send-map-request
lisp map-resolver add 6.0.3.100

ODL Map-Server/Resolver

Steps to install and configure ODL, assuming the SR1 tar archive is downloaded:

Install and configure ODL

wget https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.4.1-Beryllium-SR1/distribution-karaf-0.4.1-Beryllium-SR1.tar.gz
tar xzf distribution-karaf-0.4.1-Beryllium-SR1.tar.gz
cd distribution-karaf-0.4.1-Beryllium-SR1/

ODL configuration
In order to get RTR to be working correctly you need to have following line in config file etc/custom.properties:

lisp.elpPolicy = replace

And then run ODL with:

cd bin
./karaf

To install LispFlowMapping Map-Server/Resolver, in the karaf console type:

feature:install odl-lispflowmapping-msmr

Give it some time to load all bundles. You can check progress with log:tail and exit from the log with Ctrl-C

Add necessary mappings to ODL
Prepare two json files with the mappings to be inserted elp1.json and elp2.json shown below:
elp1.json

{
    "input": {
        "mapping-record": {
            "recordTtl": 1440,
            "action": "NoAction",
            "authoritative": true,
            "eid": {
                "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
                "ipv4-prefix": "6.0.2.0/24"
            },
            "LocatorRecord": [
                {
                    "locator-id": "ELP",
                    "priority": 1,
                    "weight": 1,
                    "multicastPriority": 255,
                    "multicastWeight": 0,
                    "localLocator": true,
                    "rlocProbed": false,
                    "routed": false,
                    "rloc": {
                        "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
                        "explicit-locator-path": {
                            "hop": [
                                {
                                    "hop-id": "Hop 1",
                                    "address": "6.0.3.3",
                                    "lrs-bits": "lookup rloc-probe strict"
                                },
                                {
                                    "hop-id": "Hop 2",
                                    "address": "6.0.3.1",
                                    "lrs-bits": "lookup strict"
                                }
                            ]
                        }
                    }
                }
            ]
        }
    }
}

elp2.json

{
    "input": {
        "mapping-record": {
            "recordTtl": 1440,
            "action": "NoAction",
            "authoritative": true,
            "eid": {
                "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
                "ipv4-prefix": "6.0.4.0/24"
            },
            "LocatorRecord": [
                {
                    "locator-id": "ELP",
                    "priority": 1,
                    "weight": 1,
                    "multicastPriority": 255,
                    "multicastWeight": 0,
                    "localLocator": true,
                    "rlocProbed": false,
                    "routed": false,
                    "rloc": {
                        "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf",
                        "explicit-locator-path": {
                            "hop": [
                                {
                                    "hop-id": "Hop 1",
                                    "address": "6.0.3.3",
                                    "lrs-bits": "lookup rloc-probe strict"
                                },
                                {
                                    "hop-id": "Hop 2",
                                    "address": "6.0.3.2",
                                    "lrs-bits": "lookup strict"
                                }
                            ]
                        }
                    }
                }
            ]
        }
    }
}

Test

To test this you can simply send an ICMP request from the client interface using following command:

ip netns exec vpp-ns1 ping 6.0.4.4

Traffic and control plane message exchanges can be checked with a wireshark listening on the odl interface.