Networking Overview: “Everything” you need to know, in 50 minutes CS 161: Computer Security Prof. David Wagner March 16, 2016
Local-Area Networks A C point-to-point shared How does computer A send a message to computer C? 2
Local-Area Networks: Packets From: A To: C Message: Hello world! A C Hello world! A C Hello world! 3
Wide-Area Networks A How do we connect two LANs? router C 4
Wide-Area Networks A A R A.com C.com Hello world! How do we connect two LANs? R C router C A.com C.com Hello world! A.com C.com Hello world! 5
Key Concept #1: Protocols • A protocol is an agreement on how to communicate • Includes syntax and semantics – How a communication is specified & structured o Format, order messages are sent and received – What a communication means o Actions taken when transmitting, receiving, or timer expires • Example: making a comment in lecture? 1. Raise your hand. 2. Wait to be called on. 3. Or: wait for speaker to pause and vocalize 4. If unrecognized (after timeout): say “excuse me” 6
Key Concept #2: Dumb Network • Original Internet design: interior nodes ( “ routers ” ) have no knowledge* of ongoing connections going through them • Not how you picture the telephone system works – Which internally tracks all of the active voice calls • Instead: the postal system! – Each Internet message (“packet”) self-contained – Interior “routers” look at destination address to forward – If you want smarts, build it “ end-to-end ”, not “hop-by-hop” – Buys simplicity & robustness at the cost of shifting complexity into end systems * Today’s Internet is full of hacks that violate this 7
Self-Contained IP Packet Format IP = Internet Protocol 4-bit 8-bit 4-bit 16-bit Total Length (Bytes) Header Type of Service Version Length (TOS) 3-bit 13-bit Fragment Offset 16-bit Identification Header is like a Flags letter envelope: 8-bit Time to contains all info 8-bit Protocol 16-bit Header Checksum Live (TTL) needed for delivery 32-bit Source IP Address 32-bit Destination IP Address Payload (remainder of message) . . . . .
Key Concept #2: Dumb Network • Original Internet design: interior nodes ( “ routers ” ) have no knowledge* of ongoing connections going through them • Not : how you picture the telephone system works – Which internally tracks all of the active voice calls • Instead: the postal system! – Each Internet message (“packet”) self-contained – Interior routers look at destination address to forward – If you want smarts, build it “ end-to-end ”, not “hop-by-hop” – Buys simplicity & robustness at the cost of shifting complexity into end systems * Today’s Internet is full of hacks that violate this 9
Key Concept #3: Layering • Internet design is strongly partitioned into layers – Each layer relies on services provided by next layer below … – … and provides services to layer above it • Analogy: – Consider structure of an Code You Write application you’ve written Run-Time Library and the “services” each System Calls layer relies on / provides Magnetic Domains } Device Drivers Fully isolated Voltage Levels / from user programs 10
Internet Layering ( “ Protocol Stack ” ) Note on a point of potential confusion: these diagrams are always drawn with lower layers below higher layers … 7 Application But diagrams showing the layouts of packets 4 Transport are often the opposite , with the lower layers at the top since their headers precede those 3 (Inter)Network for higher layers 2 Link 1 Physical 11
Horizontal View of a Single Packet First bit transmitted Link (Inter)Network Transport Application Data: structure Layer Layer Header Layer depends on the application Header (IP) Header … 12
Vertical View of a Single Packet Link Layer Header First bit transmitted (Inter)Network Layer Header (IP) Transport Layer Header Application Data: structure depends on the application . . . . . . 13 .
Internet Layering ( “ Protocol Stack ” ) 7 Application 4 Transport 3 (Inter)Network 2 Link 1 Physical 14
Layer 1: Physical Layer 7 Application 4 Transport Encoding bits to send them over a single physical link 3 (Inter)Network e.g. patterns of 2 Link voltage levels / photon intensities / 1 Physical RF modulation 15
Layer 2: Link Layer Framing and transmission of a collection of bits into individual messages sent across a 7 Application single “ subnetwork ” (one physical technology) 4 Transport 3 (Inter)Network Might involve multiple physical 2 Link links (e.g., modern Ethernet) 1 Physical Often technology supports broadcast transmission ( every “ node ” connected to subnet receives) 16
Layer 3: (Inter)Network Layer (IP) Bridges multiple “ subnets ” to provide end-to-end internet connectivity between nodes 7 Application • Provides global addressing 4 Transport Works across different link 3 (Inter)Network technologies } 2 Link Different for each Internet “ hop ” 1 Physical 17
Layer 4: Transport Layer End-to-end communication between processes 7 Application Different services provided: TCP = reliable byte stream 4 Transport UDP = unreliable datagrams 3 (Inter)Network ( Datagram = single packet message) 2 Link 1 Physical 18
Layer 7: Application Layer Communication of whatever you wish 7 Application Can use whatever transport(s) is convenient 4 Transport 3 (Inter)Network Freely structured 2 Link E.g.: 1 Physical Skype, SMTP (email), HTTP (Web), Halo, BitTorrent 19
Internet Layering ( “ Protocol Stack ” ) } Implemented only at hosts, 7 Application not at interior routers 4 Transport ( “ dumb network ” ) 3 (Inter)Network 2 Link 1 Physical 20
Internet Layering ( “ Protocol Stack ” ) 7 Application 4 Transport } 3 (Inter)Network 2 Link Implemented everywhere 1 Physical 21
Internet Layering ( “ Protocol Stack ” ) 7 Application 4 Transport } 3 (Inter)Network ~Same for each Internet “ hop ” } 2 Link Different for each Internet “ hop ” 1 Physical 22
Hop-By-Hop vs. End-to-End Layers Host A communicates with Host D Host C Host D Host A Router 1 Router 2 Router 3 Router 5 Host B Host E Router 7 Router 6 Router 4 23
Hop-By-Hop vs. End-to-End Layers Host A communicates with Host D Host C Host D Host A E.g., Ethernet Router 1 Router 2 Router 3 E.g., Wi-Fi Router 5 Host B Host E Router 7 Router 6 Router 4 Different Physical & Link Layers (Layers 1 & 2) 24
Hop-By-Hop vs. End-to-End Layers Host A communicates with Host D Host C Host D Host A Router 1 Router 2 Router 3 Router 5 E.g., HTTP over TCP over IP Host B Host E Router 7 Router 6 Router 4 Same Network / Transport / Application Layers (3/4/7) (Routers ignore Transport & Application layers) 25
Layer 3: (Inter)Network Layer (IP) Bridges multiple “ subnets ” to provide end-to-end internet connectivity between nodes 7 Application • Provides global addressing 4 Transport Works across different link 3 (Inter)Network technologies 2 Link 1 Physical 26
IP Packet Structure 4-bit 8-bit 4-bit 16-bit Total Length (Bytes) Header Type of Service Version Length (TOS) 3-bit 16-bit Identification 13-bit Fragment Offset Flags 8-bit Time to 8-bit Protocol 16-bit Header Checksum Live (TTL) 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload
IP Packet Structure 4-bit 8-bit 4-bit 16-bit Total Length (Bytes) Header Type of Service Version Length (TOS) 3-bit 16-bit Identification 13-bit Fragment Offset Flags Specifies the length of the entire 8-bit Time to IP packet: bytes in this header 8-bit Protocol 16-bit Header Checksum Live (TTL) plus bytes in the Payload 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload
IP Packet Structure 4-bit 8-bit 4-bit 16-bit Total Length (Bytes) Header Type of Service Version Length (TOS) 3-bit 16-bit Identification 13-bit Fragment Offset Flags Specifies how to interpret the start of the Payload , which is 8-bit Time to 8-bit Protocol 16-bit Header Checksum the header of a Transport Live (TTL) Protocol such as TCP or UDP 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload
IP Packet Structure 4-bit 8-bit 4-bit 16-bit Total Length (Bytes) Header Type of Service Version Length (TOS) 3-bit 16-bit Identification 13-bit Fragment Offset Flags 8-bit Time to 8-bit Protocol 16-bit Header Checksum Live (TTL) 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload
IP Packet Header (Continued) • Two IP addresses – Source IP address (32 bits) – Destination IP address (32 bits) • Destination address – Unique identifier/locator for the receiving host – Allows each node to make forwarding decisions • Source address – Unique identifier/locator for the sending host – Recipient can decide whether to accept packet – Enables recipient to send a reply back to source 31
Postal Envelopes: (Post office doesn’t look at the letter inside the envelope) 32
Analogy of IP to Postal Envelopes: IP source address IP destination address (Routers don’t look at the payload beyond the IP header) 33
Recommend
More recommend