ICS156 final review Xiaowei Yang
What this course is about Reinforcing basic networking concepts Practical networking knowledge Today Review concepts Final Concepts, and labs
Basic networking concepts Layering architecture Encapsulation and decapsulation Multiplexing and demultiplexing Addressing and routing
Protocols Link layer Ethernet, ARP, and learning bridge Network layer IP and ICMP Routing protocols: RIP, OSPF, and BGP Transport layer UDP and TCP
Layering Architecture The task of communication is to send data from one entity to another entity. The complexity of the communication task is reduced by using multiple protocol layers. Each protocol is implemented independently Each protocol is responsible for a specific subtask
Internet Protocol Suite The Internet protocol suite has four layers: Application, Transport, Network, and Data Link Layer End systems (hosts) implement all four layers. Routers only need the bottom two layers. Application Transport Network Operating system / router User-level programs Data Link
Functions of the Layers Data Link Layer: Service: Reliable transfer of frames over a link Media Access Control on a LAN Functions: Framing, media access control, error checking Network Layer: Service: Move packets from source host to destination host Functions: Routing, addressing Transport Layer: Service: Delivery of data between hosts Functions: Connection establishment/termination, error control, flow control Application Layer: Service: Application specific (delivery of , retrieval of HTML documents, reliable transfer of file) Functions: Application specific
Encapsulation/decapsulation As data is moving down the protocol stack, each protocol is adding layer-specific control information
Multiplexing/Demultiplexing A field in a lower-layer protocol header indicates to which upper layer module to deliver a packet.
IPv4 addressing network prefixhost number An IP address is 4-byte long. It encodes both a network number (network prefix) and an interface number (host number). network prefix identifies a network the host number identifies a specific host (actually, interface on the network). 0 31
Classless Inter-domain routing (CIDR) Network prefix is of variable length Addresses are allocated hierarchically. Routers can aggregate multiple address prefixes into one routing entry to minimize routing table size
CIDR network prefix is variable length A network mask specifies the number of bits used to identify a network in an IP address Addr Mask
CIDR notation CIDR notation of an IP address: /24 CIDR notation can nicely express blocks of addresses A contiguous block of addresses [ , ] can be represented by an address prefix /16
Hierarchical address allocation ISP obtains an address block /8 [ , ] ISP allocates /16 ([ , ]) to the university. University allocates /24 ([ , ]) to the CS department’s network A host on the CS department’s network gets one IP address
IP forwarding 1. Hosts on the same subnet can directly reach each other without using a router. 2. To send a packet to a destination host on a different subnet, a host will direct the packet to its default router. 3. A router looks up the destination address in its routing table to determine the next hop. Longest prefix match 4. Routing protocols build the contents of a router’s routing table.
How does a host figure out whether a destination address is on the same subnet? Short answer: Uses its routing table Long answer: A host applies its network mask to both its address and a destination address. If the network prefixes are the same, the destination address is on the same subnet. A host with multiple interfaces will compare the network prefix of each interface to determine which subnet the destination address is on.
How does a host directly send a packet to a destination address? A host sends an Ethernet frame using the hardware address of the destination host. Address resolution protocol (ARP) is used to map an IP address to an Ethernet address. How does a host send a packet to a default router? How does a router send a packet to a next hop router?
Sending a packet from Argon to Neon
Review of Protocols Link layer Ethernet, ARP Learning bridge Learning forwarding state Spanning tree Network layer IP and ICMP Routing protocols: RIP, OSPF, and BGP Transport layer UDP and TCP
What’s a protocol? a human protocol and a computer network protocol: Hi Got the time? 2:00 TCP connection req TCP connection response Get time
What is a protocol? Protocols define 1. Format of messages 2. Order of messages sent and received among network entities 3. Actions taken on message transmission and receipt When reviewing, learning, or implementing a protocol, pay attention to the above details.
ARP Function: translates an IP address into a hardware address Message format Message types: ARP request, ARP response When an ARP request/response is sent What happens after an ARP request/response is received ARP cache is updated
Bridge spanning tree protocol Function: to organize bridges into spanning tree to avoid loops Message format When a BPDU is sent What actions are taken when a BPDU is received
BPDU contents Each bridge is sending out BPDUs that contain the following fields: root bridge ID, cost to root bridge, sending bridge ID, and sending port ID. root bridge (what the sender thinks it is) root path cost for sending bridge Identifies sending bridge Identifies the sending port root ID cost bridge ID port ID
Ordering of Messages We say M1 advertises a better path than M2 (“M1<<M2”) if (R1 < R2), Or (R1 == R2) and (C1 < C2), Or (R1 == R2) and (C1 == C2) and (B1 < B2), Or (R1 == R2) and (C1 == C2) and (B1 == B2) and (P1 < P2) R1 C1 B1 M1M2 P1 R2 C2 B2 ID P2
Initially, all bridges assume they are the root bridge. Each bridge with bridge ID B sends BPDUs of this form on its LANs from each port P: Initialization message B B 0 0 B B P P
When a BPDU is received Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs. Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives, the root is updated).
When a BPDU is received (cont.) Compare and update BPDU If a bridge sends a BPDU from port P1 with four-tuple (R1, C1, B1, P1) receives a better BPDU (R2, C2, B2, P2), it will update its BPDU to (R2, C2 + cost, B1, P1). Cost is a configuration parameter, and can be set for each port. Elect root port On each bridge, the port where the “best BPDU” (via relation “<<“) was received is elected as the root port of the bridge.
When to send a BPDU B will send its updated BPDU (R2, C2 + cost, B1, P1) on port P1 only if its BPDU is better than any BPDU that B received from port P1. In this case, B also assumes that it is the designated bridge for the LAN to which P1 connects And port P1 is the designated port for that LAN
Selecting the Ports for the Spanning Tree B can decide which ports are in the spanning tree: B’s root port and all designated ports are part of the spanning tree. Those parts are in forwarding state. Other ports are not part of the spanning tree. Those ports are in blocking state. Data packets are only broadcasted on spanning tree ports if forwarding state is unavailable Learning bridge algorithm
Example Assume that all bridges send out their BPDU’s once per second, and assume that all bridges send their BPDUs at the same time Assume that all bridges are turned on simultaneously at time T=0 sec. Messages are sent out every second. Brige2 LAN 1 LAN 2 LAN 3 LAN 4 Brige1 Brige5 Brige3 Brige4 A B A B A B A B A B
Example: BPDU’s sent by the bridges Bridge 1 Bridge 2 Bridge 3 Bridge 4 Bridge 5 T=1sec Send: A: (B1,0,B1,A) B: (B1,0,B1,B) Recv: A: (B5,0,B5,A) (B2,0,B2,B) B: (B3,0,B3,B) (B4,0,B4,A) Send: A: (B2,0,B2,A) B: (B2,0,B2,B) Recv: A: B: (B1,0,B1,A) (B5,0,B5,A) Send: A:(B3,0,B3, A) B:(B3,0,B3, B) Recv: A: (B5,0,B5,B) (B4,0,B4,B) B: (B1,0,B1,B) (B4,0,B4,A) Send: A:(B4,0,B4, A) B:(B4,0,B4, B) Recv: A: (B3,0,B3,B) (B1,0,B1,B) B: (B3,0,B3,A) (B5,0,B5,B) Send: A:(B5,0,B5, A) B:(B5,0,B5, B) Recv: A: (B2,0,B2,B) (B1,0,B1,A) B: (B3,0,B3,A) (B4,0,B4,B)
Example: BPDU’s sent by the bridges Bridge 1 Bridge 2 Bridge 3 Bridge 4 Bridge 5 T=2sec D-port: A,B Send: A: (B1,0,B1,A) B: (B1,0,B1,B) Recv: R-port: B D-port: A Send: A: (B1,1,B2,A) Recv: A: B: (B1,0,B1,A) R-port: B D-port: A Send: A: (B1,1,B3,A) Recv: A: (B1,1,B4,B) (B1,1,B5,B) B: (B1,0,B1,B) R-port: A D-port: B Send: B: (B1,1,B4,B) Recv: A: (B1,0,B1,B) B: (B1,1,B3,A) (B1,1,B5,B) R-port: A D-port: B Send: B: (B1,1,B5,B) Recv: A: (B1,0,B1,A) B: (B1,1,B3,A) (B1,1,B4,B)
Example: BPDU’s sent by the bridges Bridge 1 Bridge 2 Bridge 3 Bridge 4 Bridge 5 T=3sec D-port: A,B Send: A: (B1,0,B1,A) B: (B1,0,B1,B) Recv: R-port: B D-port: A Send: A: (B1,1,B2,A) Recv: A: B: (B1,0,B1,A) R-port: B D-port: A Send: A: (B1,1,B3,A) Recv: A: B: (B1,0,B1,B) R-port: A Blocked: B Recv: A: (B1,0,B1,B) B: (B1,1,B3,A) R-port: A Blocked: B Recv: A: (B1,0,B1,A) B: (B1,1,B3,A)
Network layer protocols IP Forwarding: longest prefix match Route entry aggregation IP fragmentation ICMP When and why an ICMP message is sent Routing protocols RIP: distance vector protocol Count-to-infinity problem OSPF: link state protocol BGP: path vector protocol how each protocol works: Order of messages sent and received Actions taken when messages are sent or received. In particular, how next hop is selected. The underlying routing algorithm
Transport layer protocol UDP Connectionless, unreliable, datagram service TCP Connection-oriented, reliable, byte- stream service
Things to know about TCP How a TCP connection is established and terminated. How TCP sends data reliably Cumulative acknowledgement, error/loss detection, and retransmission Flow control: how a TCP sender avoids overflowing a receiver buffer Receiver’s advertisement window to limit sender’s sliding window Congestion control: how a TCP sender avoids overflowing a router buffer Dynamically compute congestion window to limit sender’s sliding window
Three-Way Handshake to establish a TCP connection
TCP Connection Termination
How TCP sends data reliably Sender associates each byte sent with a sequence number A receiver acknowledges the highest number of bytes received. A TCP sender retransmits a segment when it assumes that the segment has been lost: 1. No ACK has been received and a timeout occurs 2. Multiple ACKs have been received for the same segment
Flow control: sliding window algorithm A window size variable specifies the maximum amount of data a sender can send without receiving an acknowledgement from a receiver. A receiver uses the advertisement window size field to tell a sender the available receiving buffer A sender’s window size is set to less than the advertisement window size window size = 6 sent but not acknowledged can be sent sent and acknowledged can't sent
Congestion control The sender has two internal parameters: Congestion Window (cwnd) Slow-start threshhold Value (ssthresh) The sender’s sending window size is set to the minimum of (cwnd, receiver advertised win)
Slow start and congestion avoidance Congestion control operates in two modes: slow start (cwnd < ssthresh) Probe the available bandwidth congestion avoidance (cwnd >= ssthresh) Try not to overload the network.
Slow Start Initial value: cwnd = 1 (or 2) Note: Unit is a segment size. In real implementation, cwnd = 2MSS Each time an ACK is received by a sender, the congestion window is increased by 1 segment: cwnd = cwnd + 1
Congestion Avoidance If cwnd >= ssthresh then each time an ACK is received, increment cwnd as follows: cwnd = cwnd + 1/cwnd In byte units: cwnd = cwnd + MSS*MSS/cwnd cwnd is increased by one only if all cwnd segments have been acknowledged.
Example of Slow Start/Congestion Avoidance Assume that ssthresh = 8 Roundtrip times Cwnd (in segments) ssthresh
Summary Basic networking concepts How protocols work Note: We cannot review all protocols in this session, but you are responsible for all protocols we covered in lectures and labs (1-6).
Things that will show up in the final Basic concepts Knowledge about lab You are expected to understand data traces Protocols Questions: My office hours TA lab hours Discussion board
What you’ve learned in this course will Help you find a job in the field of networking Set up and manage your own home network Equip you with the basic knowledge and skills to understand new network protocols