final_review

advertisement
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


Network layer



Ethernet, ARP, and learning bridge
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
Application
User-level programs
Transport
Network
Operating system / router
Data Link


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.
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 email,
retrieval of HTML documents, reliable transfer of file)
 Functions:
Application specific
Encapsulation/decapsulation
User data
HTTP
HTTP Header
User data
HTTP Header
User data
TCP
TCP Header
IP
TCP segment
IP Header
Ethernet
TCP Header
HTTP Header
User data
IP datagram
Ethernet
Header
IP Header
TCP Header
HTTP Header
User data
Ethernet frame

As data is moving down the protocol stack, each
protocol is adding layer-specific control information
Ethernet
Trailer
Multiplexing/Demultiplexing
32 bits
version
(4 bits)
header
length
DS
flags
(3 bits)
Identification (16 bits)
TTL Time-to-Live
(8 bits)
Total Length (in bytes)
(16 bits)
ECN
Protocol
(8 bits)
Fragment Offset (13 bits)
Header Checksum (16 bits)
Source IP address (32 bits)
Destination IP address (32 bits)
Ethernet Header
IP Header
TCP Header
Application data
Ethernet Trailer
Ethernet frame

A field in a lower-layer protocol header
indicates to which upper layer module to
deliver a packet.
IPv4 addressing
31
0
network prefix


host 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).
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
128
Addr
Mask

143
137
10000000
10001111
10001001
255
255
255
11111111
11111111
1111111
144
10010000
0
00000000
A network mask specifies the
number of bits used to identify a
network in an IP address.
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
128.195.4.0
128.0.0.0
128.195.0.0
128.195.4.150
128.195.4.255
128.196.255.255
128.255.255.255

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
IP forwarding
1.
2.
3.
Hosts on the same subnet can directly
reach each other without using a router.
To send a packet to a destination host on
a different subnet, a host will direct the
packet to its default router.
A router looks up the destination address
in its routing table to determine the next
hop.

4.
Longest prefix match
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
argon.tcpip-lab.edu
"Argon"
128.143.137.144
neon.tcpip-lab.edu
"Neon"
128.143.71.21
router137.tcpip-lab.edu
"Router137"
128.143.137.1
router71.tcpip-lab.edu
"Router71"
128.143.71.1
Router
Ethernet Network
Ethernet Network
Review of Protocols

Link layer



Network layer



Ethernet, ARP
Learning bridge
 Learning forwarding state
 Spanning tree
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
TCP connection req
TCP connection response
Got the
time?
Get http://www.ics.uci.edu
2:00
<file>
time
What is a protocol?

Protocols define
1.
2.
3.

Format of messages
Order of messages sent and received
among network entities
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
root ID cost bridge ID port ID
root bridge (what the sender thinks it is)
root path cost for sending bridge
Identifies sending bridge
Identifies the sending port

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.
Ordering of Messages
R1
C1
M1
B1
P1
R2
C2
B2
ID P2
M2
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)
Initialization message


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:
B
0
B
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
LAN 1
A
B
Brige2


Brige1
A
B
LAN 3
Brige3
LAN 2
A
Brige5
B
A
B
A
Brige4
LAN 4
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.
B
Example: BPDU’s sent by the
bridges
T=1sec
Bridge
1
Bridge
2
Bridge
3
Bridge Bridge
4
5
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
T=2sec
Bridge
1
Bridge
2
Bridge
3
Bridge
4
Bridge
5
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
T=3sec
Bridge
1
Bridge
2
Bridge
3
Bridge
4
Bridge
5
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
R-port: A
Blocked: B
Recv:
A:
(B1,0,B1,B)
B:
(B1,1,B3,A)
Recv:
A:
(B1,0,B1,A)
B:
(B1,1,B3,A)
Network layer protocols

IP




ICMP


Forwarding: longest prefix match
Route entry aggregation
IP fragmentation
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, bytestream service
Things to know about TCP


How a TCP connection is established and
terminated.
How TCP sends data reliably


Flow control: how a TCP sender avoids
overflowing a receiver buffer


Cumulative acknowledgement, error/loss detection,
and retransmission
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 103188
0193:103
1880193(
win 16384
0)
<mss 146
0, ...>
8586(0)
8
4
2
7
:1
6
8
5
8
8
S 1724
<mss 1460>
0
6
7
8
in
w
4
9
ack 10318801
ack 172488
587 win 175
20
TCP Connection Termination
aida.poly.edu
mng.poly.edu
F 172488734:172488734(0)
ack 1031880221 win 8733
. ack 17
2488735
win 174
84
F 10318
80221:1
0318802
ack 1 72
21(0)
488735
win 175
20
222 win
. ack 1031880
8733
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
window size = 6
1
2
sent and
acknowledged
3
4
5
sent but not
acknowledged
6
7
8
9
10 11
can be sent
can't sent



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.
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
14
cwnd = 8
10
ssthresh
8
6
4
cwnd = 9
2
6
t=
4
t=
2
t=
0
0
t=
Cwnd (in segments)
12
Roundtrip times
cwnd = 10
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
Download