CPS 110 Networks Landon Cox March 25 2009

  • Slides: 33
Download presentation
CPS 110: Networks Landon Cox March 25, 2009

CPS 110: Networks Landon Cox March 25, 2009

Network hardware reality ê Lots of different network interface cards (NICs) ê 3 Com/Intel,

Network hardware reality ê Lots of different network interface cards (NICs) ê 3 Com/Intel, Ethernet/802. 11 x ê Each NIC has a fixed hardware address ê MAC address: 01: 10: C 6: CE: 8 E: 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 Applications OS Hardware

Virtual/physical interfaces Applications OS Hardware

Distributed computing ê Try to make multiple computers look like one ê We won’t

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) HTTP (web) SMTP (email) SSH (login) RPC Applications Abstraction UDP

Protocol layers NFS (files) HTTP (web) SMTP (email) SSH (login) RPC Applications Abstraction UDP Abstraction TCP IP Ethernet ATM Abstraction PPP Hardware

OSI model ê Open Systems Interconnections Layer 7 Applications Layer 6 Presentation Layer 5

OSI model ê Open Systems Interconnections Layer 7 Applications Layer 6 Presentation Layer 5 Session Layer 4 Transport Layer 3 Network Layer 2 Layer 1 Data. Link Physical

Network layers (the stack) ê Build higher-level services on simpler ones ê IP over

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

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 Applications OS Hardware

Virtual/physical interfaces Applications OS Hardware

Routing ê HW lets us send to neighbor on same LAN ê Single-hop route

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 switch ê Messages delivered using ê Ethernet MAC

Local-area network ê Typically, switched Ethernet switch ê Messages delivered using ê Ethernet MAC address ê E. g. 00: 0 D: 56: 1 E: AD: BB ê Unique to physical card (like a serial number) ê Switch knows all connected computers’ MAC addresses

Routing ê Can’t put all computers on one switch! ê Think of the wiring

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 B Each letter is a router, possibly with a LAN connected

Internet graph A B Each letter is a router, possibly with a LAN connected to it. C E D G F

Internet graph Each node is an Autonomous System (AS). Can think of as an

Internet graph Each node is an Autonomous System (AS). Can think of as an ISP.

Internet graph A B C E D G F How does D know how

Internet graph A B C E D G F 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)

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 ê www. kernel. org ê Unix traceroute utility

Traceroute example ê www. kernel. org ê Unix traceroute utility

Virtual/physical interfaces Applications OS Hardware

Virtual/physical interfaces Applications OS Hardware

Naming other computers ê Low-level interface ê Provide the destination MAC address ê 00:

Naming other computers ê Low-level interface ê Provide the destination MAC address ê 00: 13: 20: 2 E: 1 B: ED ê Middle-level interface ê Provide the destination IP address ê 152. 3. 140. 183 ê High-level interface ê Provide the destination hostname ê crocus. cs. duke. edu

Translating hostname to IP addr ê Hostname IP address ê Performed by Domain Name

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

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: www. cs. duke. edu ê nslookup in interactive mode

Example: www. cs. duke. edu ê nslookup in interactive mode

Translating IP to MAC addrs ê IP address MAC address ê Performed by ARP

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 152. 3. 140. 183? ê ê ê 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 Applications OS Hardware

Virtual/physical interfaces Applications OS Hardware

Message sizes ê Hardware interface ê Max Ethernet message size is 1500 bytes ê

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 1 Router

Message sizes ê IP layer fragments larger MTU to smaller MTU Computer 1 Router Computer 2 IP IP IP Ethernet ATM

Virtual/physical interfaces Applications OS Hardware

Virtual/physical interfaces Applications OS Hardware

Processes vs machines ê IP is machine-to-machine ê E. g. crocus. cs. duke. edu

Processes vs machines ê IP is machine-to-machine ê E. g. crocus. cs. duke. edu www. kernel. org ê 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

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

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 ê

Sockets ê OS allows apps to program sockets ê E. g. BSD sockets ê Win. Sock 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:

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

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 P 2 questions ê Any questions?