본문 바로가기
  • AI (Artificial Intelligence)
Legacy Skills/OpenvSwitch

OpenVswitch Advanced Tutioral

by 로샤스 2014. 7. 31.

Goal

The goal of this tutorial is to demonstrate the power of Open vSwitchflow tables. The tutorial works through the implementation of a MAC-learning switch with VLAN trunk and access ports.

Introduction

  • Open vSwitch is a production quality open source software switch designed to be used as a vswitch in virtualized server environments.
  • A vswitch forwards traffic between different VMs on the same physical host and also forwards traffic between VMs and the physical network.
  • Open vSwitch supports standard management interfaces (e.g. sFlow, NetFlow, IPFIX, RSPAN, CLI), and is open to programmatic extension and control using OpenFlow and the OVSDB management protocol.
  • We are constructing a software simulated network environment based on Open vSwitch.
  • We are using “ovs-sandbox”and Firstly installed Open vSwitch on your system ,then you should be able to just run “ovs-sandbox” from this directory without any options.

We will construct Open vSwitch flow tables for a VLAN-capable,MAC-learning switch that has four ports:

  • p1, a trunk port that carries all VLANs, on OpenFlow port 1.
  • p2, an access port for VLAN 20, on OpenFlow port 2.
  • p3 and p4, both access ports for VLAN 30, on OpenFlow ports 3 and 4, respectively.

Our switch design will consist of five main flow tables, each of which implements one stage in the switch pipeline:

  • Table 0: Admission control.
  • Table 1: VLAN input processing.
  • Table 2: Learn source MAC and VLAN for ingress port.
  • Table 3: Look up learned port for destination MAC and VLAN.
  • Table 4: Output processing.

The following are the steps for the exercise:

Getting Started

1. Install Openvswitch Package
#apt-get install -y openvswitch-switch openvswitch-datapath-dkms
2. Download the ovs-sandbox script file
#cd /opt/
#git clone git://git.openvswitch.org/openvswitch
3. Run ovs-sandbox

When We run ovs-sandbox script file, it creates following:

  • Deletes any subdirectory of the current directory named “sandbox” and any files in that directory.
  • Creates a new directory “sandbox” in the current directory.
  • Sets up special environment variables that ensure that OpenvSwitch programs will look inside the “sandbox” directory instead of in the OpenvSwitch installation directory.
  • Creates an empty Open vSwitch configuration database under “sandbox”.
  • Starts ovsdb-server running under “sandbox”.
  • Starts ovs-vswitchd running under “sandbox”, passing special options that enable a special “dummy” mode for testing.
  • Starts a nested interactive shell inside “sandbox”.
#/opt/openvswitch/tutorial/
#./ovs-sandbox
4. Creates a bridge

In this step, a bridge is created. The command creates new bridge “br0” and puts “br0” into so-called “fail-secure” mode.

#cd sandbox/
#ovs-vsctl add-br br0 -- set Bridge br0 fail-mode=secure
5. Add ports to the bridge

The command below addes ports p1, p2,p3 and p4 to the bridge.

# for i in 1 2 3 4; do
        ovs-vsctl add-port br0 p$i -- set Interface p$i ofport_request=$i
        ovs-ofctl mod-port br0 p$i up
    done
6. Verify the bridge with ports
#ovs-vsctl show
  Bridge "br0"
        fail_mode: secure
        Port "p1"
            Interface "p1"
        Port "p2"
for i in 1 2 3 4; do
        ovs-vsctl add-port br0 p$i -- set Interface p$i ofport_request=$i
        ovs-ofctl mod-port br0 p$i up
    done
            Interface "p2"
        Port "p3"
            Interface "p3"
        Port "br0"
            Interface "br0"
                type: internal
        Port "p4"
            Interface "p4"
    ovs_version: "1.10.2"

Admission Control

In this step, we add a flow into Table 0, where the STP packets are dropped. If the rule does not match, resubmit the packet to Table 1 with prioroty 0. Table 0 is where packets enter the switch. We use this stage to discard packets that for one reason or another are invalid.

1. Add a flow to drop them at ingress to the switch with
#ovs-ofctl add-flow br0 "table=0, dl_src=01:00:00:00:00:00/01:00:00:00:00:00, actions=drop"
2. Adding a flow to drop IEEE 802.1D Spanning Tree Protocol (STP) packets, and other packets with reserved multicast protocols:
#ovs-ofctl add-flow br0  "table=0, dl_dst=01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0, actions=drop"
3. Adding flows with priority and resubmit to table1
#ovs-ofctl add-flow br0 "table=0, priority=0, actions=resubmit(,1)"
4. Testing Table 0
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=01:80:c2:00:00:05
Flow: metadata=0,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:80:c2:00:00:05,dl_type=0x0000
Rule: table=0 cookie=0 dl_dst=01:80:c2:00:00:00/ff:ff:ff:ff:ff:f0
OpenFlow actions=drop

Final flow: unchanged
Datapath actions: drop
Packet come from p1 and check in table0, then drop it

import

Note:

  • The first block of lines describes an OpenFlow table lookup
  • Thesecond line gives the OpenFlow flow that the fields matched (called a “rule” because that is the name used inside Open vSwitch for an OpenFlow flow).
  • The third line gives the rule’s OpenFlow actions.
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=01:80:c2:00:00:10
Flow: metadata=0,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:80:c2:00:00:10,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	No match

Final flow: unchanged
Datapath actions: drop
Packet come from p1 and check in Table0 and Resubmit to Table1, then drop it

import

Note:

  • This time the flow we handed to “ofproto/trace” doesn’t match any of our “drop” rules, so it falls through to the low-priority “resubmit” rule, which we see in the rule and the actions selected in the first block.
  • The “resubmit” causes a second lookup in OpenFlow table 1, described by the additional block of indented text in the output.
  • We haven’t yet added any flows to OpenFlow table 1, so no flow actually matches in the second lookup. Therefore, the packet is still actually dropped, which means that the externally observable results would be identical to our first testing.

VLAN Input Processing

In this step,firstly, We are adding flow on table 1 with priority 0 .If packets are not matched then dropped, secondly adding flow on table 1 with priority 99, if packets are not matched then resubmitted to table 2.

  • A packet that enters table 1 has already passed basic validation in table 0.
  • The purpose of table 1 is validate the packet’s VLAN, based on the VLAN configuration of the switch port through which the packet entered the switch.
  • We will also use it to attach a VLAN header to packets that arrive on an access port, which allows later processing stages to rely on the packet’s VLAN always being part of the VLAN header, reducing special cases.
1. Adding flow on table1 with priority 0
#ovs-ofctl add-flow br0 "table=1, priority=0, actions=drop"

Note:

  • We are adding a low-priority flow that drops all packets, before we add flows that pass through acceptable packets.
  • You can think of this as a “default drop” rule.
2. Add flow on Table 1 and Resubmit to Table 2
#ovs-ofctl add-flow br0 "table=1, priority=99, in_port=1, actions=resubmit(,2)"

Note:

  • Our trunk port p1, on OpenFlow port 1, is an easy case.
  • p1 accepts any packet regardless of whether it has a VLAN header or what the VLAN was, so we can add a flow that resubmits everything on input port 1 to the next table
3. Adding flows with priority on port2,port3, port4 and submit Packet to next table
#ovs-ofctl add-flows br0 - <<'EOF'
	table=1, priority=99, in_port=2, vlan_tci=0, actions=mod_vlan_vid:20, resubmit(,2)
	table=1, priority=99, in_port=3, vlan_tci=0, actions=mod_vlan_vid:30, resubmit(,2)
	table=1, priority=99, in_port=4, vlan_tci=0, actions=mod_vlan_vid:30, resubmit(,2)
EOF 

Note:

  • On the access ports, we want to accept any packet that has no VLAN header, tag it with the access port’s VLAN number, and then pass it along to the next stage.
  • We don’t write any rules that match packets with 802.1Q that enter this stage on any of the access ports, so the “default drop” rule we added earlier causes them to be dropped, which is ordinarily what we want for access ports.
  • Another variation of access ports allows ingress of packets tagged with VLAN 0 (aka 802.1p priority tagged packets). To allow such packets, replace “vlan_tci=0” by “vlan_tci=0/0xfff” above.
4. Testing Table 1

Packet on Trunk Port

Run command
#ovs-appctl ofproto/trace br0 in_port=1,vlan_tci=5
Flow: metadata=0,in_port=1,vlan_tci=0x0005,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		No match

Final flow: unchanged
Datapath actions: drop
Packet come from p1 and check in Table 0 and resubmit Table 1, Table 2, then drop it

import

Valid Packet on Access Port2
  • Here valid packet (a packet without an 802.1Q header) coming in on access port p2
Testing 2 the packet on port2
# ovs-appctl ofproto/trace br0 in_port=2,vlan_tci=5
Flow: metadata=0,in_port=2,vlan_tci=0x0005,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=0
	OpenFlow actions=drop

Final flow: unchanged
Datapath actions: drop
Packet come from port 2 and check on Table 0 and resubmit to Table 1, then drop it

import

Learn source MAC and VLAN for ingress port

  • This table allows the switch we’re implementing to learn that the packet’s source MAC is located on the packet’s ingress port in the packet’s VLAN.
1. Adding single flow on table2
#ovs-ofctl add-flow br0 "table=2 actions=learn(table=10, NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]), resubmit(,3)"

Note:

  • table=10: Modify flow table 10.
  • NXM_OF_VLAN_TCI[0..11]: Make the flow that we add to flow table 10 match the same VLAN ID that the packet we’re currently processing contains.This effectively scopes the MAC learning entry to a single VLAN,which is the ordinary behavior for a VLAN-aware switch.
  • NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[]: Make the flow that we add to flow table 10 match, as Ethernet destination, the Ethernet source address of the packet we’re currently processing.
  • load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]: Whereas the preceding parts specify fields for the new flow to match, this specifies an action for the flow to take when it matches. The action is for the flow to load the ingress port number of the current packet into register 0 (a special field that is an Open vSwitch extension to OpenFlow).
  • A real use of “learn” for MAC learning would probably involve two additional elements.
  • Firstly, the “learn” action would specify a hard_timeout for the new flow, to enable a learned MAC to eventually expire if no new packets were seen from a given source within a reasonable interval.
  • Second, one would usually want to limit resource consumption by using the Flow_Table table in the Open vSwitch configuration database to specify a maximum number of flows in table 10.
2. Testing Table 2
Run command
#ovs-appctl ofproto/trace br0 in_port=1,vlan_tci=20,dl_src=50:00:00:00:00:01 -generate
Flow: metadata=0,in_port=1,vlan_tci=0x0014,dl_src=50:00:00:00:00:01,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-ofctl dump-flows br0 table=10
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=147.465s, table=10, n_packets=0, n_bytes=0, idle_age=147, vlan_tci=0x0014/0x0fff,dl_dst=50:00:00:00:00:01 actions=load:0x1->NXM_NX_REG0[0..15]

Note:

  • You can see that the packet coming in on VLAN 20 with source MAC 50:00:00:00:00:01 became a flow that matches VLAN 20 (written in hexadecimal) and destination MAC 50:00:00:00:00:01. The flow loads port number 1, the input port for the flow we tested, into register 0.
Run command
#ovs-appctl ofproto/trace br0 in_port=2,dl_src=50:00:00:00:00:01 -generate
Flow: metadata=0,in_port=2,vlan_tci=0x0000,dl_src=50:00:00:00:00:01,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=2,vlan_tci=0x0000
	OpenFlow actions=mod_vlan_vid:20,resubmit(,2)

		Resubmitted flow: metadata=0,in_port=2,dl_vlan=20,dl_vlan_pcp=0,dl_src=50:00:00:00:00:01,dl_dst=00:00:00:00:00:00,dl_type=0x0000
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-ofctl dump-flows br0 table=10
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=530.999s, table=10, n_packets=0, n_bytes=0, idle_age=530, hard_age=71, vlan_tci=0x0014/0x0fff,dl_dst=50:00:00:00:00:01 actions=load:0x2->NXM_NX_REG0[0..15]

Note:

  • You can see that the packet coming in on VLAN 20 with source MAC 50:00:00:00:00:01 became a flow that matches VLAN 20 (written in hexadecimal) and destination MAC 50:00:00:00:00:01. The flow loads port number 2, the input port for the flow we tested, into register 0
  • actions=load:0x2: It identify the flow loads on port 2

Look up learned port for destination MAC and VLAN

In this step, We are adding flow on table3 with priority 50 and priority 99. If packets are not matched then resubmitted to table 10 , table 4

1. Adding flow on Table3 and Resubmit to Table 10 ,Table 4
#ovs-ofctl add-flow br0  "table=3 priority=50 actions=resubmit(,10), resubmit(,4)"

Note:

  • The flow’s first action resubmits to table 10, the table that the “learn” action modifies. As you saw previously, the learned flows in this table write the learned port into register 0.
  • If the destination for our packet hasn’t been learned, then there will be no matching flow, and so the “resubmit” turns into a no-op. Because registers are initialized to 0, we can use a register 0 value of 0 in our next pipeline stage as a signal to flood the packet.
2. Adding flow on table3 with priority 99 if not matches then resubmit to table 4
#ovs-ofctl add-flow br0 "table=3 priority=99 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00  actions=resubmit(,4)"
  • The second action resubmits to table 4, continuing to the next pipeline stage. (In turn,that’s because we put a flow into table 0 to drop packets that have a multicast source address.)
3. Testing Table 3
command that should cause OVS to learn that f0:00:00:00:00:01 is on p1 in VLAN 20
#ovs-appctl ofproto/trace br0 in_port=1,dl_vlan=20,dl_src=f0:00:00:00:00:01,dl_dst=90:00:00:00:00:01 -generate
Flow: metadata=0,in_port=1,dl_vlan=20,dl_vlan_pcp=0,dl_src=f0:00:00:00:00:01,dl_dst=90:00:00:00:00:01,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=50
			OpenFlow actions=resubmit(,10),resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Packet come from port 1 and check in Table 0 and resubmit in Table 1, Table 2, Table 3, Table 10, Table 4 then drop it

import

Run command
#ovs-ofctl dump-flows br0 table=10
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=4437.937s, table=10, n_packets=0, n_bytes=0, idle_age=4437, hard_age=3978, vlan_tci=0x0014/0x0fff,dl_dst=50:00:00:00:00:01 actions=load:0x2->NXM_NX_REG0[0..15]
 cookie=0x0, duration=347.72s, table=10, n_packets=0, n_bytes=0, idle_age=347, vlan_tci=0x0014/0x0fff,dl_dst=f0:00:00:00:00:01 actions=load:0x1->NXM_NX_REG0[0..15]

Output Processing

In this step, We are adding flows on table 4 with reg0 2,3,4 respectively and priority 99,99,50 respectively and actions are strip_vlan 2,3,4 respectively.

  • At entry to stage 4, we know that register 0 contains either the desired output port or is zero if the packet should be flooded.
  • We also know that the packet’s VLAN is in its 802.1Q header, even if the VLAN was implicit because the packet came in on an access port.
  • The job of the final pipeline stage is to actually output packets.
  • The job is trivial for output to our trunk port p1.
1. Adding flow on table 4
#ovs-ofctl add-flow br0 "table=4 reg0=1 actions=1"
2. Adding Flow on table 4
#ovs-ofctl add-flows br0 - <<'EOF'
        table=4 reg0=2 actions=strip_vlan,2
        table=4 reg0=3 actions=strip_vlan,3
        table=4 reg0=4 actions=strip_vlan,4
EOF
3. Adding Flow on table 4
#ovs-ofctl add-flows br0 - <<'EOF'
        table=4 reg0=0 priority=99 dl_vlan=20 actions=1,strip_vlan,2
        table=4 reg0=0 priority=99 dl_vlan=30 actions=1,strip_vlan,3,4
        table=4 reg0=0 priority=50            actions=1
EOF
4. Testing Table 4
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=30
Flow: metadata=0,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=3,dl_dst=ff:ff:ff:ff:ff:ff
Flow: metadata=0,in_port=3,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=3,vlan_tci=0x0000
	OpenFlow actions=mod_vlan_vid:30,resubmit(,2)

		Resubmitted flow: metadata=0,in_port=3,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff
Flow: metadata=0,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=55
Flow: metadata=0,in_port=1,dl_vlan=55,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=ff:ff:ff:ff:ff:ff,dl_vlan=20
Flow: metadata=0,in_port=1,dl_vlan=20,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=2,dl_dst=ff:ff:ff:ff:ff:ff
Flow: metadata=0,in_port=2,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=2,vlan_tci=0x0000
	OpenFlow actions=mod_vlan_vid:20,resubmit(,2)

		Resubmitted flow: metadata=0,in_port=2,dl_vlan=20,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=4,dl_dst=ff:ff:ff:ff:ff:ff
Flow: metadata=0,in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=4,vlan_tci=0x0000
	OpenFlow actions=mod_vlan_vid:30,resubmit(,2)

		Resubmitted flow: metadata=0,in_port=4,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=ff:ff:ff:ff:ff:ff,dl_type=0x0000
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=4,dl_dst=01:00:00:00:00:00
Flow: metadata=0,in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=01:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=4,vlan_tci=0x0000
	OpenFlow actions=mod_vlan_vid:30,resubmit(,2)

		Resubmitted flow: metadata=0,in_port=4,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=01:00:00:00:00:00,dl_type=0x0000
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=99,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
			OpenFlow actions=resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=90:12:34:56:78:90,dl_vlan=20
Flow: metadata=0,in_port=1,dl_vlan=20,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=90:12:34:56:78:90,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=50
			OpenFlow actions=resubmit(,10),resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_dst=90:12:34:56:78:90,dl_vlan=30
Flow: metadata=0,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=00:00:00:00:00:00,dl_dst=90:12:34:56:78:90,dl_type=0x0000
Rule: table=0 cookie=0 priority=0
OpenFlow actions=resubmit(,1)

	Resubmitted flow: unchanged
	Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
	Resubmitted  odp: drop
	Rule: table=1 cookie=0 priority=99,in_port=1
	OpenFlow actions=resubmit(,2)

		Resubmitted flow: unchanged
		Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
		Resubmitted  odp: drop
		Rule: table=2 cookie=0 
		OpenFlow actions=learn(table=10,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG0[0..15]),resubmit(,3)

			Resubmitted flow: unchanged
			Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
			Resubmitted  odp: drop
			Rule: table=3 cookie=0 priority=50
			OpenFlow actions=resubmit(,10),resubmit(,4)

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

				Resubmitted flow: unchanged
				Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
				Resubmitted  odp: drop
				No match

Final flow: unchanged
Datapath actions: drop

1. MAC Learning

Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_vlan=30,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01 -generate
Flow: metadata=0,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01,dl_type=0x0000
Rule: table=0 cookie=0 priority=0,reg0=0x1
OpenFlow actions=controller(reason=no_match)

No match, flow generates "packet in"s.

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=4,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01 -generate
Flow: metadata=0,in_port=4,vlan_tci=0x0000,dl_src=20:00:00:00:00:01,dl_dst=10:00:00:00:00:01,dl_type=0x0000
Rule: table=0 cookie=0 priority=0,reg0=0x1
OpenFlow actions=controller(reason=no_match)

No match, flow generates "packet in"s.

Final flow: unchanged
Datapath actions: drop
Run command
#ovs-appctl ofproto/trace br0 in_port=1,dl_vlan=30,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01 -generate
Flow: metadata=0,in_port=1,dl_vlan=30,dl_vlan_pcp=0,dl_src=10:00:00:00:00:01,dl_dst=20:00:00:00:00:01,dl_type=0x0000
Rule: table=0 cookie=0 priority=0,reg0=0x1
OpenFlow actions=controller(reason=no_match)

No match, flow generates "packet in"s.

Final flow: unchanged
Datapath actions: drop















































































































































































































































































































































































































































































































































































































































출처 : http://vlabs.cfapps.io/openvswitch/openvswitch_tutorial.html











'Legacy Skills > OpenvSwitch' 카테고리의 다른 글

VLANs  (0) 2014.08.06
openvswitch-1.1.0 Directory Reference  (0) 2014.07.31
OpenvSwitch v2.1.2 on Ubuntu 12.04 LTS  (0) 2014.07.29
[ovs-discuss] installing ovs2 on ubuntu 12.04  (0) 2014.07.29
2013 Wheezy source  (0) 2014.07.15

댓글