Top Banner
Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1
27

Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

Dec 14, 2015

Download

Documents

Francis Ryder
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

Ryu Book Chapter 1

Speaker: Chang, Cheng-YuDate: 25/Nov./2014

1

Page 2: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

2

Outline

• Switching Hub• Switching Hub by OpenFlow• Archieve a switching hub• Ryu application example

Page 3: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

3

Switiching Hub

Switching hubs have a variety of functions. Here, we take a look at a switching hub having the following simple functions• Learns the MAC address of the host connected to a port and retains it

in the MAC address table.• When receiving packets addressed to a host already learned, transfers

them to the port connected to the host.• When receiving packets addressed to an unknown host, performs

flooding.

Page 4: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

4

Switiching Hub by OpenFlow

OpenFlow switches can perform the following by receiving instructions from OpenFlow controllers such as Ryu.• Rewrites the address of received packets or transfers the packets from

the specified port.• Transfers the received packets to the controller (Packet-In).• Transfers the packets forwarded by the controller from the specified

port (Packet-Out).

It is possible to achieve a switching hub having those functions combined.

Page 5: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

5

Achieve a switching hub Step 1. Initial status

The flow table is empty.host A is connected to port 1.host B is connected to part 4.host C is connected to port 3.

Page 6: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

6

Achieve a switching hub Step 2-1. Host A -> Host B

Packet-In: in-port: 1 eth-dst: Host B eth-src: Host A

When packets are sent from host A to host B, a Packet-In message is sent and the MAC address of host A is learned by port 1.

Page 7: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

7

Packet-in Message• Create the handler of the Packet-In event handler in order to accept received packets

with an unknown destination.

Ryu Event Handler:• With Ryu, when an OpenFlow message is received, an event corresponding to the message is generated.

• The event handler defines a function having the event object for the argument and use the ryu.controller.handler.set_ev_cls decorator to decorate.

Page 8: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

8

Updating the MAC Address TableBased on the acquired sender MAC address and received port number, the MAC address table is updated.

Page 9: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

9

Achieve a switching hub Step 2-2. Host A -> Host B

Packet-In: in-port: 1 eth-dst: Host B eth-src: Host A

Packet-Out: action: OUTPUT:Flooding

Because the port for host B has not been found, the packets are flooded and are received by host B and host C.

Page 10: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

10

Judging the Transfer Destination Port• The corresponding port number is used when the destination MAC address exists in

the MAC address table. If not found, the instance of the OUTPUT action class specifying flooding (OFPP_FLOOD) for the output port is generated.

Page 11: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

11

Achieve a switching hub Step 3. Host B -> Host A

Packet-In: in-port: 4 eth-dst: Host A eth-src: Host B

Packet-Out: action: OUTPUT:Port 1

When the packets are returned from host B to host A, an entry is added to the flow table and also the packets are transferred to port 1. For that reason, the packets are not received by host C.

Page 12: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

12

Adding Processing of Flow Entry• For flow entries, set match that indicates the target packet conditions, and instruction

that indicates the operation on the packet, entry priority level, and effective time.

• Finally, add an entry to the flow table by issuing the Flow Mod message.

Page 13: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

13

Achieve a switching hub Step 4. Host A -> Host B

Packet-In: in-port: 1 eth-dst: Host B eth-src: Host A

Packet-Out: action: OUTPUT:Port 4

Again, when packets are sent from host A to host B, an entry is added to the flow table and also the packets are transferred to port 4.

Page 14: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

14

Packet Transfer• Regardless whether the destination MAC address is found from the MAC address table, at

the end the Packet-Out message is issued and received packets are transferred.

• The class corresponding to the Packet-Out message is OFPPacketOut class

Page 15: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

15

Ryu application example architecture Run ryu-manager --verbose ryu.app.simple_switch_13• c0• s1• h1 -mac_address 00:00:00:00:00:01• h2 -mac_address 00:00:00:00:00:02• h3 -mac_address 00:00:00:00:00:03

Env: Ubuntu 14.04, Ryu ,Mininet

Page 16: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

16

Ryu application example

• Execute ping from host 1 to host 2.1. ARP request

At this point, host 1 does not know the MAC address of host 2, therefore, before ICMP echo request, an ARP request is supposed to be broadcast. The broadcast packet is received by host 2 and host 3.

2. ARP replyIn response to the ARP, host 2 returns an ARP reply to host 1.

3. ICMP echo requestNow host 1 knows the MAC address of host 2, host 1 sends an echo request to host 2.

4. ICMP echo replyBecause host 2 already knows the MAC address of host 1, host 2 returns an echo reply to host 1.

Page 17: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

17

Ryu application example

• Execute ping from host 1 to host 2.1. ARP request

At this point, host 1 does not know the MAC address of host 2, therefore, before ICMP echo request, an ARP request is supposed to be broadcast. The broadcast packet is received by host 2 and host 3.

2. ARP replyIn response to the ARP, host 2 returns an ARP reply to host 1.

3. ICMP echo requestNow host 1 knows the MAC address of host 2, host 1 sends an echo request to host 2.

4. ICMP echo replyBecause host 2 already knows the MAC address of host 1, host 2 returns an echo reply to host 1.

Page 18: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

18

Ryu application example

• Execute ping from host 1 to host 2.1. ARP request

At this point, host 1 does not know the MAC address of host 2, therefore, before ICMP echo request, an ARP request is supposed to be broadcast. The broadcast packet is received by host 2 and host 3.

2. ARP replyIn response to the ARP, host 2 returns an ARP reply to host 1.

3. ICMP echo requestNow host 1 knows the MAC address of host 2, host 1 sends an echo request to host 2.

4. ICMP echo replyBecause host 2 already knows the MAC address of host 1, host 2 returns an echo reply to host 1.

Page 19: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

19

Ryu application example

• Execute ping from host 1 to host 2.1. ARP request

At this point, host 1 does not know the MAC address of host 2, therefore, before ICMP echo request, an ARP request is supposed to be broadcast. The broadcast packet is received by host 2 and host 3.

2. ARP replyIn response to the ARP, host 2 returns an ARP reply to host 1.

3. ICMP echo requestNow host 1 knows the MAC address of host 2, host 1 sends an echo request to host 2.

4. ICMP echo replyBecause host 2 already knows the MAC address of host 1, host 2 returns an echo reply to host 1.

Page 20: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

20

h1 ping h2:

switch s1(flow table)

controller c0(log)

ARP request

ARP request

1. ARP request

Page 21: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

21

Host h1:

Host h2:

Host h3:

1. ARP request

Page 22: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

22

ARP replay

2. ARP replay

ARP replay

switch s1(flow table)

controller c0(log)

Page 23: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

23

Host h1:

Host h2:

Host h3:

2. ARP Replay

Page 24: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

24

3. ICMP echo request

switch s1(flow table)

controller c0(log)

Page 25: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

25

Host h1:

Host h2:

Host h3:

3. ICMP echo request

Page 26: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

26

4. ICMP echo replay

The ICMP echo reply returned from host 2 to host 1 matches the already registered flow entry (1) thus is transferred to host 1 without issuing Packet-In.

switch s1(flow table)

controller c0(log)

Page 27: Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./2014 1.

27

Host h1:

Host h2:

Host h3:

4. ICMP echo replay