Understanding Networks: Week 1

See also Nick Yulman's excellent notes from Fall 2011

Network Topologies

Definition of “network?":

  • nodes connected by links
  • networks tend to exist to distribute something within the network
  • Example: power network (e.g. “grid”)
    • some networks exist in order to deal with things that are difficult to store
    • there is a concept of “stocks” and “flows”
    • in a well functioning dynamic network, there is a balance between stocks and flows
    • power networks are interesting because they must find ways to distribute power without storing it, because storing energy is difficult and dangerous
  • Ben: what do you call the “waste” of a network, e.g. the power lost by the energy grid? Tom: waste is a good term
  • all networks exist in a condition of vulnerability--all networks can be disrupted, all nodes within any network become vulnerable by their participation in the network
  • Tom: vulnerability is a condition, not a bug
  • networks do break

The big points:

  • distribution, how stocks flow
  • vulnerability, networks break
  • resilience: the ability to heal, in some way
  • protecting a network tends to limit the network’s operation
    • e.g. ping of death, ping flooding
    • ITS network policy limits access to some network tools like ICMP ping and traceroute

Network topologies show how the nodes are linked

  • a network of 3 nodes, with 3 links
  • a network of 5 nodes with 4 links
  • a network of 6 nodes with 5 links, in a star topology
    • this is a totally centralized network
  • a network of 5 nodes with 5 links, in a ring topology
    • e.g. token ring network, avoiding collisions by agreeing to have only node speaking at once
    • no matter the topology, good network nodes must work out how to listen, in order to avoid collisions where more than one node is communicating at the same time
  • a network of 5 nodes with 10 links, maximum hop distance of 1
    • this is a totally decentralized network
    • Tom, quoting Clay: "the trick is to practice Satanism so you know how to draw pentagrams"
    • one typical topology is several tightly connected networks that are sparsely connected to other tightly connected networks
    • there are special nodes, which you could call “hubs”
    • hub nodes have special vulnerabilities, sometimes mitigated by traffic management
    • the Internet is roughly organized like this, as a “distributed network” rather than a “decentralized network”
  • formula for link count of totally connected network: D = (N^2 - N) / 2
  • the greater a network’s link density, the greater its robustness

“Bus network”

  • e.g. Arduino SPI, USB
  • centralized controller, connected on a single communication line
  • communication is one at a time
  • typically, the controller node tends to provide a clock signal, and the controller sends data on the uptick of the clock signal, while the rest of the nodes send data on the downtick of the clock signal
  • bus networks tend to be synchronous rather than asynchronous

“Mesh” networks

  • e.g. ad hoc wifi networks
  • mesh networks tends to be protocols that assign addresses among cooperating nodes
    • e.g. DARPA’s smart minefield project that physically redistribute themselves when a mine is detonated or disabled
  • ITP should teach you how to gracefully interoperate between incompatible protocols
  • example of peer to peer networks
  • example of protocols layered on top of each other (e.g. HTTP is implemented on top of TCP/IP)

The “network metaphor” is one way to understand the world, but not the only one

  • other examples of useful metaphors are the Enlightenment era “universe as a clockworks” metaphor
  • question: difference between bus and decentralized network
    • e.g. I2C protocol
    • e.g. RGB LEDs in Adafruit’s Flora (like a LilyPad) allows control of multiple LEDs
    • e.g. SPI, serial peripheral interface, “synchronous serial”
  • difference between synchronous serial and asynchronous serial
    • synchronous: single clock
    • asynchronous: multiple clocks with a protocol defining agreement on baud rate, and agreement on who should be talking and who should be listening
    • e.g. hardware handshaking using CTS and RTS lines
    • e.g. software handshaking

OSI Model

  • pneumonic: "Please Do Not Throw Sausage Pizza Away," for "Physical Datalink Network Transport Session Presentation Application"
  • this is the OSI Model, AKA the “Reference Lie” (Clay’s term)
  • See http://en.wikipedia.org/wiki/OSI_model
  • Physical layer
    • e.g. Ethernet cables, wifi adapters
  • Datalink
    • e.g. Ethernet packets, addressing (MAC, media access control, addresses)
    • format of data to be transferred, possibly containing addressing, checksums, metadata, and data
  • Network
    • this is where an Internet network address is assigned
    • “IP address” is an address on the Internet
  • Transport
    • defines how we’re going to exchange data over our network as a whole
    • e.g. streaming media vs. email
    • in streaming media, loss of a small amount of data tends to not have a huge impact on the usability of the data
    • in email, loss of a small amount of data can have a much more significant impact on the usability of the data
    • UDP versus TCP
    • streaming media tends to use UDP, email tends to use TCP
    • TCP does error checking and can resend data if the data was corrupted or lost in transit
    • UDP just blasts the data across without regard to whether it was received or corrupted
    • there are many other transport protocols, e.g. ICMP which is used for the Ping protocol
  • Session
    • allows multiple kinds of data to be transmitted or received on a single IP address
    • e.g. you can SSH to a server and get web pages from the same server--how does the server know to send the SSH related data to your SSH client, but the HTTP data to your web browser?
  • Presentation
    • data format that is agreed on within a session or transport
    • e.g. ASCII
  • Application
    • this is where you’ve been living within ITP so far

Sessions: HTTP Communication on the Command Line

Example: telnet directly to a web server, in Terminal (on Mac):

telnet tigoe.net 80
GET / HTTP/1.1
Host: tigoe.net

HTTP/1.1 200 OK
Date: Tue, 03 Sep 2013 21:48:37 GMT
Server: Apache
MS-Author-Via: DAV
Vary: Accept-Encoding
Content-Length: 1241
Content-Type: text/html


		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Tom Igoe</title>
		<link rel="stylesheet" href="css/tomstyle.css" type="text/css">

		<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
<script type="text/javascript">
_uacct = "UA-1541944-1";


		<div align="right">
			<table border="0" cellpadding="0" cellspacing="10" width="594" align="center">
					<td colspan="4" valign="top">
						<div align="right">
							<h2>Tom Igoe</h2>
					<td valign="top">
							<div align="right">
							<span class="margin" align = "right">  
<P><A href="/pcomp/index.php">physical computing</A>
<P><A href="/consulting.php">consulting</A> 
<P><A href="/resume.php">r?sum?</A>
<P><A href="/projects.php">projects</A>
<P><A href="/photo/">images</A>
<P><A href="/blog/">blog</A>
</span>						</div>
					<td align="left" valign="middle" colspan="2">
						<div align="right">
								<img src="img/sil8.jpg"><p>Disciplined self-indulgence

Connection closed by foreign host.

Sessions: Serial Communication on the Command Line

Example: serial communication on the command line (in Mac), connecting to the Arduino Yun, the Beaglebone, and the Pi

List of all serial devices:

ls /dev/tty.*

You can use screen to access those serial ports:

screen <device> <baud>
screen /dev/tty.udbmodem621 115200

From here you’ll see a Linux command line session.

In screen, control-A control-K will disconnect the serial session.

The Raspberry Pi requires a special serial cable to communicate with it over USB. Adafruit has a cable that you can use to wire the Pi serial pins to a USB cable.