P4 demo: a basic L2/L3 switch in 170 LOC

Slides:



Advertisements
Similar presentations
CSC458 Programming Assignment II: NAT Nov 7, 2014.
Advertisements

Programming Protocol-Independent Packet Processors
How to tell your plumbing what to do Protocol Independent Forwarding
P4: specifying data planes
ENGINEERING WORKSHOP Compute Engineering Workshop P4: specifying data planes Mihai Budiu San Jose, March 11, 2015.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
IP Forwarding Relates to Lab 3.
NetFPGA Project: 4-Port Layer 2/3 Switch Ankur Singla Gene Juknevicius
OpenFlow overview Joint Techs Baton Rouge. Classic Ethernet Originally a true broadcast medium Each end-system network interface card (NIC) received every.
Ryu Book Chapter 1 Speaker: Chang, Cheng-Yu Date: 25/Nov./
OpenFlow Switch Specification-v part1 Speaker: Hsuan-Ling Weng Date: 2014/12/02.
© 2009 Cisco Systems, Inc. All rights reserved. SWITCH v1.0—4-1 Implementing Inter-VLAN Routing Deploying Multilayer Switching with Cisco Express Forwarding.
Lab 4: Simple Router CS144 Lab 4 Screencast May 2, 2008 Ben Nham Based on slides by Clay Collier and Martin Casado.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Internet Networking Spring 2003
IP Routing: an Introduction. Quiz
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
Module 10. Internet Protocol (IP) is the routed protocol of the Internet. IP addressing enables packets to be routed from source to destination using.
CS 6401 Internet Protocol Outline Introduction to Internet Protocol Header and address formats ICMP Tools.
ARP Scenarios CIS 81 and CST 311 Rick Graziani Fall 2005.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
IP Forwarding.
CDPA 網管訓練 駭客任務 2 Ethernet Switching ARP, IP, LAN, Subnet IP Header, Routing ICMP
Washington WASHINGTON UNIVERSITY IN ST LOUIS Packet Routing Within MSR Fred Kuhns
Traffic Management - OpenFlow Switch on the NetFPGA platform Chun-Jen Chung( ) Sriram Gopinath( )
Understanding IPv6 Slide: 1 Lesson 12 IPv6 Mobility.
Monitoring Troubleshooting TCP/IP Chapter 3. Objectives for this Chapter Troubleshoot TCP/IP addressing Diagnose and resolve issues related to incorrect.
1 Requirements for Internet Routers (Gateways) and Hosts Relates to Lab 3. (Supplement) Covers the compliance requirements of Internet routers and hosts.
Introduction to Mininet, Open vSwitch, and POX
Switch 1 Switch 2 Switch 3 Blocking Forwarding ROOT BRIDGE BRIDGE’S ROOT PORT DESIGNATED PORT DESIGNATED BRIDGE.
David M. Zar Block Design Review: PlanetLab Line Card Header Format.
Packet Switch Network Server client IP Ether IPTCPData.
PISCES: A Programmable, Protocol-Independent Software Switch
Network Layer session 1 TELE3118: Network Technologies Week 5: Network Layer Forwarding, Features Some slides have been taken from: r Computer.
InterVLAN Routing 1. InterVLAN Routing 2. Multilayer Switching.
P4: Programming Protocol-Independent Packet Processors
COS 561: Advanced Computer Networks
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
CSC458 Programming Assignment II: NAT
Some slides have been adapted from:
Programmable Overlays with VPP
MAC Address Tables on Connected Switches
Data Center Networks and Fast and Programmable Switching Technologies
Network Data Plane Part 2
IP Forwarding Covers the principles of end-to-end datagram delivery in IP networks.
Reference Router on NetFPGA 1G
Design of a Diversified Router: Packet Formats
IP Forwarding Relates to Lab 3.
IP Forwarding Relates to Lab 3.
Internet Control Message Protocol (ICMP)
Some slides have been taken from:
IP Forwarding Relates to Lab 3.
Chapter 2: Static Routing
Network Core and QoS.
Packet Switch Architectures
IP Forwarding Relates to Lab 3.
Design of a Diversified Router: November 2006 Demonstration Plans
Code Review for IPv4 Metarouter Header Format
Debugging P4 Programs with Vera
Implementing an OpenFlow Switch on the NetFPGA platform
Design of a High Performance PlanetLab Node: Line Card
IP Forwarding Relates to Lab 3.
P4C-XDP: Programming the Linux Kernel Forwarding Plane using P4
Networking and Network Protocols (Part2)
IP Forwarding Relates to Lab 3.
Reference Router on NetFPGA 1G
Chapter 5 Data Link Layer – Hub, Switch
Packet Switch Architectures
Network Core and QoS.
Chapter 4: outline 4.1 Overview of Network layer data plane
Presentation transcript:

P4 demo: a basic L2/L3 switch in 170 LOC netdev0.1 Ottawa, February 15, 2015 Mihai Budiu

Setup h1 h2 Router control P4 program P4 software switch Mininet Table access API P4 program RPC h1 h2 P4 compiler cd p4factory/targets/simple_router make behavioral cd ../../.. cd mininet-demo sudo python 1sw_demo.py --behavioral-exe ../p4factory/targets/simple_router/behavioral-model Tables Data plane P4 software switch Mininet

Creating a basic ethernet+IPv4 switch from a P4 program DEMO PART 1 Creating a basic ethernet+IPv4 switch from a P4 program P4 program Tables P4 compiler P4 compiler Data plane P4 software switch

Layer 3 packet forwarding Control plane mininet> h1 wireshark & mininet> h1 ping h2 # this should fail $ ./simple_router_control --thrift-path ../p4factory/targets/simple_router/of-tests/pd_thrift < commands.txt mininet> h1 ping h2 # this should succeed IPv4.dst -> nextHop.ipv4address, outputPort, ipv4.ttl nextHop.ipv4address -> ethernet.dst_addr outputPort -> ethernet.src_addr Packet Packet

Headers header_type ethernet_t { fields { dstAddr: 48; srcAddr: 48; etherType: 16; } } header_type ipv4_t { … } // no options

Parser parser parse_ethernet { extract(ethernet); return select(latest.etherType) { 0x0800 : parse_ipv4; default: ingress; }} … parser parse_ipv4 { … } calculated_field ipv4.hdrChecksum { verify ipv4_checksum; update ipv4_checksum; }

Last table action rewrite_mac(smac) { modify_field(ethernet.srcAddr, smac); } table send_frame { reads { std_metadata.egress_port: exact; } actions { rewrite_mac; drop; } size: 256; outputPort -> ethernet.src_addr

Complete pipeline control ingress { apply(ipv4_match); apply(forward); } control egress { apply(send_frame); }

2. Started switch running 1. Compiled a new switch from P4

1. Running wireshark on h1 2. Ping from h1 to h2 does not work 3. Pings sent but no reply returned

Populate switch tables to enable forwarding DEMO PART 2 Router control Table access API Populate switch tables to enable forwarding RPC Tables Data plane P4 software switch

1. Populated all tables; ping starts running 2. Pings sent and reply received

Counters in the datapath DEMO PART 3 Counters in the datapath

Adding counters to table entries counter send_frame_bytes { type : bytes; direct : send_frame; } output_port Action counter Table send_frame

Reading byte counters while ping is running

DEMO PART 4 Divert traffic

nextHop.ipv4address -> Diverting traffic Divert traffic for specific destinations to another destination IPv4.dst -> IPv4.dst $ ./simple_router_control --thrift-path ../p4factory/targets/simple_router/of-tests/pd_thrift < divert.txt Mininet> h1 ping h2 # this should fail, but wireshark shows packet coming back IPv4.dst -> nextHop.ipv4address, outputPort, ipv4.ttl nextHop.ipv4address -> ethernet.dst_addr outputPort -> ethernet.src_addr

Modified pipeline control ingress { apply(divert); apply(ipv4_match); apply(forward); } control egress { apply(send_frame); } ./simple_router_control --thrift-path ../p4factory/targets/simple_router/of-tests/pd_thrift SimpleRouter: get_ctr send_frame_bytes 0 <reply> SimpleRouter: ^D

Diverting traffic action replaceIp(ipdest) { modify_field(ipv4.dstAddr, ipdest); } table divert { reads { ipv4.dstAddr: exact;} actions { replaceIp; nop; } size: 256; }

1. Inserted table entries to divert packets 2. Pings sent and received by same host

Availability All this code will be available as FOSS before March 31, 2015 on http://p4.org