ics156 final review xiaowei yang. what this course is about reinforcing basic networking concepts ...
TRANSCRIPT
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 linkMedia 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 email,
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
HTTP
TCP
IP
Ethernet
User data
User dataHTTP Header
TCP Header
TCP HeaderIP Header
TCP HeaderIP HeaderEthernetHeader
EthernetTrailer
IP datagram
TCP segment
Ethernet frame
User dataHTTP Header
User dataHTTP Header
User dataHTTP Header
Multiplexing/Demultiplexing
Application dataTCP HeaderEthernet Header Ethernet Trailer
Ethernet frame
IP Header
DS ECNversion(4 bits)
headerlength
Total Length (in bytes)(16 bits)
Identification (16 bits)flags
(3 bits)Fragment Offset (13 bits)
Source IP address (32 bits)
Destination IP address (32 bits)
TTL Time-to-Live(8 bits)
Protocol(8 bits)
Header Checksum (16 bits)
32 bits
A field in a lower-layer protocol header indicates to which upper layer module to deliver a packet.
IPv4 addressing
network prefixnetwork prefix host numberhost 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.
1000111110000000 10001001 10010000
1111111111111111 1111111 00000000
128 143 137 144
255 255 255 0
Addr
Mask
CIDR notation
CIDR notation of an IP address: 128.143.137.144/24
CIDR notation can nicely express blocks of addresses A contiguous block of addresses
[128.195.0.0, 128.195.255.255] can be represented by an address prefix 128.195.0.0/16
Hierarchical address allocation
ISP obtains an address block 128.0.0.0/8 [128.0.0.0, 128.255.255.255]
ISP allocates 128.195.0.0/16 ([128.195.0.0, 128.195.255.255]) to the university.
University allocates 128.195.4.0/24 ([128.195.4.0, 128.195.4.255]) to the CS department’s network
A host on the CS department’s network gets one IP address 128.195.4.150
128.0.0.0 128.255.255.255128.195.0.0 128.196.255.255
128.195.4.0 128.195.4.255 128.195.4.150
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?
neon.tcpip-lab.edu"Neon"
128.143.71.21
argon.tcpip-lab.edu"Argon"128.143.137.144
router137.tcpip-lab.edu"Router137"
128.143.137.1
router71.tcpip-lab.edu"Router71"128.143.71.1
Ethernet NetworkEthernet Network
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
Hi
Got thetime?
2:00
TCP connection req
TCP connection response
Get http://www.ics.uci.edu
<file>time
What is a protocol? Protocols define
1. Format of messages2. Order of messages sent and received
among network entities3. 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 bridgeIdentifies the sending port
root IDroot ID costcost bridge IDbridge ID port IDport 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)
R1R1 C1C1 B1 B1
M1 M2
P1 P1 R2R2 C2C2 B2 B2 ID P2 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
BB 00 BB PP
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 Brige4A
B
A B
AB A
BA
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,BSend:A: (B1,0,B1,A)B: (B1,0,B1,B)Recv:
R-port: BD-port: ASend:A: (B1,1,B2,A)Recv:A: B:(B1,0,B1,A)
R-port: BD-port: ASend:A: (B1,1,B3,A)Recv:A:(B1,1,B4,B)(B1,1,B5,B)B:(B1,0,B1,B)
R-port: AD-port: BSend:B: (B1,1,B4,B)Recv:A:(B1,0,B1,B)B:(B1,1,B3,A)(B1,1,B5,B)
R-port: AD-port: BSend: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,BSend:A: (B1,0,B1,A)B: (B1,0,B1,B)Recv:
R-port: BD-port: ASend:A: (B1,1,B2,A)Recv:A: B:(B1,0,B1,A)
R-port: BD-port: ASend:A: (B1,1,B3,A)Recv:A:B:(B1,0,B1,B)
R-port: ABlocked: B
Recv:A:(B1,0,B1,B)B:(B1,1,B3,A)
R-port: ABlocked: 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
aida.poly.edu mng.poly.edu
S 1031880193:1031880193(0)win 16384 <mss 1460, ...>
S 172488586:172488586(0)
ack 1031880194 win 8760 <mss 1460>
ack 172488587 win 17520
TCP Connection Termination
aida.poly.edu mng.poly.edu
F 172488734:172488734(0)
ack 1031880221 win 8733
. ack 172488735 win 17484
. ack 1031880222 win 8733
F 1031880221:1031880221(0)ack 172488735 win 17520
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 occurs2. 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.
1 2 3 4 5 6 7 8 9 10 11
window size = 6
sent but notacknowledged can be sent
sent andacknowledged
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
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 8
cwnd = 9
cwnd = 10
0
2
4
6
8
10
12
14
t=0
t=2
t=4
t=6
Roundtrip times
Cw
nd
(in
seg
men
ts)
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 Email
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