FreeBSD Networking from the Bottom Up

This course describes the FreeBSD networking stack. It is made up of a series of lectures derived from tutorials given by George Neville-Neil. Additional lectures will be developed over the next few years. Each lecture may be ordered separately and is described below.

Lecture 1: Device Drivers

This lecture describes how to write and maintain network drivers in FreeBSD. By way of example it uses the Intel Gigabit Ethernet driver (igb). The lecture covers the basic data structures and APIs necessary to implement a network driver in FreeBSD. The lecture is general enough that it can be applied to other BSDs, and likely to other embedded and UNIX like systems. It is specific enough that given a device and a manual, you should be able to develop a working driver on your own.

Lecture 2: The IPv6 Stack

All of the BSDs have had rich support for version 6 of the Internet Protocols from the very beginning of the work to specify a new set of network layer protocols for the Internet. While many references exist for engineers interested in version 4 of the IP protocols, to date, very little has been published describing the newer code. This lecture presents an in depth discussion and code walk through of version 6 of the IP protocols, describing and dissecting the paths that packets take from the driver layer up to the socket layer of the network stack. The lecture covers the four paths packets travel through the network stack: reception, transmission, forwarding, and error handling.

Lecture 3: Routing

This lecture covers the packet forwarding and routing subsystems in FreeBSD. The routing and forwarding code are the glue that keeps the networking stack together, connecting the network protocols, such as IP and IPv6, to their underlying data link layers and making sure that packets are sent to the correct next hop in the network. Topics in the lecture include the Routing Information Base (RIB), Forwarding Information Base (FIB), and the systems that interact with them. Also covered are routing sockets and the RIB/FIB APIs, the address-resolution protocol (ARP), Neighbor Discovery (ND6), the Common Address Redundancy Protocol (CARP), the IP firewall and traffic shaper control program (ipfw), and the packet filter interface (pfil).

Lecture 4: Packet Processing Frameworks

The FreeBSD Kernel has several different packet processing frameworks, software that is meant to transform packets but which are not traditionally considered to be network protocols. It is these packet processing frameworks that are often the basis for new products built with FreeBSD, but they are not well understood. This tutorial covers all of the packet processing frameworks, including the Berkeley Packet Filter (BPF), IP Firewall (IPFW), Dummynet, Packet Filter (PF), Netgraph, and netmap. It discusses the appropriate use of each framework and takes a walk through the relevant sections of each framework. Working examples of extensions to each framework are given so that students can see how to build new systems with and around the frameworks that are present in the kernel. An outline is available here.

Lecture 5: A Look Inside FreeBSD Using DTrace

One of the largest challenges to building complex software is a lack of run time visibility into what the system is doing at any particular time. Typical approaches to adding tracing and logging emphasize sprinkling calls to printf() or similar statements throughout the source code, and enabling these in debug builds. DTrace is a modern system that gives software developers the ability to add low overhead tracing that is always available to programs that they are creating, modifying, and debugging. The desired tracing is described and controlled with an advanced scripting language. This tutorial covers the basics of DTrace, including basic and advanced uses. Using a set of worked examples, students learn to add tracing to user space and kernel space systems. The tutorial includes a set of short labs carried out on virtual machines that give the students hands on experience working with DTrace. This tutorial requires you to have a laptop computer which can run Virtual Machine software such as bhyve, VMWare, Virtual Box, or QEMU.

George Neville-Neil is a FreeBSD Committer, member of the FreeBSD Core team, and an author. He works on networking and operating system code for fun and profit. He also teaches various course on subjects related to computer programming. His professional areas of interest include code spelunking, operating systems, networking and security. He is the co-author with Marshall Kirk McKusick of The Design and Implementation of the FreeBSD Operating System, and is the columnist behind ACM Queue's ``Kode Vicious.'' Mr. Neville-Neil earned his bachelor's degree in computer science at Northeastern University in Boston, Massachusetts, and is a member of the ACM, the Usenix Association and the IEEE. He is an avid bicyclist and traveler who currently resides in New York City.

Further Information

Click here to purchase the class on DVD video.