CPS110: Networks Landon Cox March 25, 2009
Network hardware reality Lots of different network interface cards (NICs) 3Com/Intel, Ethernet/802.11x Each NIC has a fixed hardware address MAC address: 01:10:C6:CE:8E:42 Send packet to LAN by specifying MAC address Max packet size is 1500 bytes Packets can be reordered, corrupted, dropped Anyone can sniff packets from the network
Virtual/physical interfaces Hardware OS Applications
Distributed computing Try to make multiple computers look like one We won’t really cover Take CPS 214 Distributed shared memory Distributed file systems Parallelizing compilers Process migration
Protocol layers NFS (files) NFS (files) HTTP (web) HTTP (web) SMTP ( ) SMTP ( ) SSH (login) SSH (login) RPC TCP UDP IP Ethernet ATM PPP Applications Abstraction Hardware
OSI model Open Systems Interconnections Applications Layer 7 Presentation Layer 6 Session Layer 5 Transport Layer 4 Network Layer 3 DataLink Layer 2 Physical Layer 1 Applications Presentation Session Transport Network DataLink Physical
Network layers (the stack) Build higher-level services on simpler ones IP over Ethernet TCP over IP HTTP over TCP Why build in layers? Could have 0 layers (build directly on top of HW) What would happen? Have to build from scratch each time HW changes E.g. one firefox for wired NIC, one for wireless NIC
Network layers (the stack) Build higher-level services on simpler ones IP over Ethernet TCP over IP HTTP over TCP Why build in layers? Could have 1 layer (OS provides single layer) What would happen? Better to let applications choose functionality they need Unneeded features usually cost something (performance) E.g. would you ever not need reliable communication?
Virtual/physical interfaces Hardware OS Applications
Routing HW lets us send to neighbor on same LAN Single-hop route Want to send to computer on another LAN Multi-hop route IP (Internet Protocol) handles this
Local-area network Typically, switched Ethernet Messages delivered using Ethernet MAC address E.g. 00:0D:56:1E:AD:BB Unique to physical card (like a serial number) Switch knows all connected computers’ MAC addresses Ethernet switch
Routing Can’t put all computers on one switch! Think of the wiring logistics Want to connect two LANs together Use a machine that straddles two networks Called a router or gateway or bridge LANs and routers form the Internet
Internet graph A A C C B B D D E E F F G G Each letter is a router, possibly with a LAN connected to it.
Internet graph Each node is an Autonomous System (AS). Can think of as an ISP.
Internet graph A A C C B B D D E E F F G G How does D know how to get to router G? Should it send messages to E, C, or F?
Internet routing is imprecise Internet has no centralized state Makes it (supposedly) more fault-tolerant Routing is hard when a network is Large (a lot to track) Dynamic (connections change quickly) Incentives to lie (make money by accepting traffic) The Internet exhibits all three Basic idea Routers propagate info about the graph to each other BGP (Border Gateway Protocol)
Traceroute example Unix traceroute utility
Virtual/physical interfaces Hardware OS Applications
Naming other computers Low-level interface Provide the destination MAC address 00:13:20:2E:1B:ED Middle-level interface Provide the destination IP address High-level interface Provide the destination hostname crocus.cs.duke.edu
Translating hostname to IP addr Hostname IP address Performed by Domain Name Service (DNS) Used to be a central server /etc/hosts at SRI What’s wrong with this approach? Doesn’t scale to the global Internet
DNS Centralized naming doesn’t scale Server has to learn about all changes Server has to answer all lookups Instead, split up data Use a hierarchical database Hierarchy allows local management of changes Hierarchy spreads lookup work across many computers
Example: nslookup in interactive mode
Translating IP to MAC addrs IP address MAC address Performed by ARP protocol Only done after you get to the right LAN How does a router know the MAC address of ? ARP (Address Resolution Protocol) If it doesn’t know the mapping, broadcast through switch “Whoever has this IP address, please tell me your MAC address” Cache the mapping “/sbin/arp” Why is broadcasting over a LAN ok? Number of computers connected to a switch is relatively small
Virtual/physical interfaces Hardware OS Applications
Message sizes Hardware interface Max Ethernet message size is 1500 bytes Application interface IP maximum packet size is 64 kbytes What if the route narrows? Start at Ethernet max of 1500 bytes Could traverse ATM w/ max of 53 bytes
Message sizes IP layer fragments larger MTU to smaller MTU Computer 1Computer 2Router IP Ethernet IP Ethernet ATM IP ATM
Virtual/physical interfaces Hardware OS Applications
Processes vs machines IP is machine-to-machine E.g. crocus.cs.duke.edu Process abstraction Each app thinks it has its own machine Give each process multiple virtual NICs
Processes vs machines Hardware interface One network endpoint per machine Application interface Multiple network endpoints per machine Sockets Software endpoints for communication Like virtual network cards
Sockets Another example of virtualized hardware Thread virtual processor Address space virtual memory Endpoint/socket virtual NIC NIC and socket both have unique identifiers NIC: MAC address Socket: ‹hostname, port number› bind () assigns a port number to a host’s socket
Sockets OS allows apps to program sockets E.g. BSD sockets WinSock has pretty much same interface Processes name each other via sockets Each message includes a destination ‹host, port› Tells routers which computer gets message Tells dst computer which process gets message
Sockets OS can multiplex multiple connections over one NIC Kinds of sockets: UDP (datagrams), TCP (ordered, reliable)
Course administration Project 2 due on Friday Two groups are done Many more are very close Normal office hours Thursday and Friday Use Friday discussion section to answer P2 questions Any questions?