Internet Protocols Summary - Electrical and Computer...
Transcript of Internet Protocols Summary - Electrical and Computer...
1
1
Internet Protocols Summary
TCP(17-24)
ICMP (6-9),Ping (7)
ARP(4)
IGMP(13)
OSPF(10)
RARP(5)
IP (3,9,10),Tracerooute (8)
Ethernet, 802.3, Token Ring, etc. (2)
Application Layer(Message)
Transport Layer(Segment)
Network Layer(Datagram)
Link Layer(Packet, Frame)
* Chapter number in ( ) for reference only, contents may not be covered in class lectures.
Port Number (DEC) 53 520161/162
Telnet(26)
FTP(27) HTTP
DNS(14)
BOOTPDHCP(16)
TFTP(15)
SNMP(25)
RIP(10) RTP
500423 20/21 80 67/68 69
BGP(10)
NFS(29)
2049179
Protocol Number (DEC)
Protocol Type (HEX)
06 17
8901
02
803508000806
SMTP(28)
25
UDP(11-12)
• Packet forwarding was covered before the midterm• How to setup and find a route?
- Routing algorithms- Routing protocols- Routing table lookup
2
2
3
Autonomous System & Its Routing
• Autonomous System (AS)
Intradomain Routing• Routing within an AS• Ignores the Internet
outside the AS• Protocols are also
called IGP’s• Popular protocols are
– RIP (simple, old)– OSPF (better)
Interdomain Routing• Routing between AS’s• Assumes that the
Internet consists of a collection of interconnected AS’s
• Protocols are also called EGP’s.
• Routing protocols:– EGP– BGP (more recent)
4
Approaches to Shortest Path Routing
• Distance Vector Routing– Each node knows the distance (=cost) to its directly
connected neighbors– A node sends a list to its neighbors with the current
distances to all nodes. – If all nodes update their distances, the routing tables
eventually converge
• Link State Routing – Each node knows the distance to its neighbors– The distance information (=link state) is broadcast to all
nodes in the network– Each node calculates the routing tables independently
3
5
Distance Vector
• Each node maintains two tables - Distance Table and Routing Table
• Nodes exchange routing information on the cost of a route
• Reception of messages may triggers routing changes
• Possible Looping• Proper routing updating interval
6
Link State
• Each node requires complete topology information.
• Link state information must be flooded to all nodes. Guaranteed to converge.
• Each node must maintain a global database.• Convergence of the algorithm is guaranteed.• Dijkstra’s algorithm can be used to compute
the shortest path from each node.
4
7
IP Routing
TCP
Network Interfaces
IP InputQueue
IP Output: CalculateNext Hop Router
ICMP
routingdaemon
Process IPOptions
For me ?
UDProute
commandnetstat
command
routingtable
ICMP Redirec
t
Source
Routing
NO:
if forwarding enabled
YES
8
Routing Table Lookup
• For each IP packet, there is one routing table lookup.1. Find matching host address2. Find matching network address3. Find default entry
• Routing table printout with netstat -rn• Example:
Destination Gateway Flags Refcnt Use Interface
140.252.23.32 140.252.23.1 UGH 3 25000 emd0127.0.0.1 127.0.0.1 UH 1 0 lo0default 140.252.13.33 UG 0 0 emd0
5
• Two Transport Protocols
• User Datagram Protocol (UDP)
• Transmission Control Protocol (TCP)
9
10
Orientation
• Transport layer protocols are end-to-end protocols • They are only implemented at the hosts
Application
Transport
Network
HOST
Data Link Data Link Data Link
Network
Application
Transport
Network
HOST
Data Link
ROUTER
6
11
Port Numbers
• UDP and TCP use port numbers to identify applications• A globally unique address at the transport layer is a pair of
numbers: <IP address, port number>– the source pair and destination pair together identify a TCP
connection
• There are 65,535 UDP ports and 65,535 TCP ports per host.
IP
TCP UDP
UserProcess
Demultiplex
based on
Protocol field in IP
header
UserProcess
UserProcess
UserProcess
UserProcess
UserProcess
Demultiplex
based on
port number
12
Transport Protocols Basics
UDPUDP• datagram oriented• unreliable, connectionless• simple• unicast and multicast• useful only for few
applications, e.g., multimedia applications
• used a lot for services– network management
(SNMP), routing (RIP), naming (DNS), etc.
TCP• stream oriented
• reliable, connection-oriented
• complex• only unicast• used for most Internet
applications:– web (http), email (smtp),
file transfer (ftp), terminal (telnet), etc.
7
• UDP supports unreliable transmissions ofdatagrams
• UDP merely extends the host-to-to-host delivery service of IP datagram to an application-to-application service
• The only thing that UDP adds is multiplexing and demultiplexing
• UDP format
13
• Connection-oriented protocol–i.e. establishing client-server full duplex connection before data transfer)
• Provides a reliable unicast end-to-end byte stream over an unreliable internet
–segment acknowledgement–error detection
14
8
15
TCP Byte Stream Service
• To the lower layers, TCP handles data in blocks, the segments.
• To the higher layers TCP handles data as a sequence of bytes and does not identify boundaries between bytes
? Higher layers do not know about the beginning and end of segments !
TCP
Application
1. write 100 bytes2. write 20 bytes
queue ofbytes to betransmitted TCP
queue ofbytes thathave beenreceived
Application1. read 40 bytes2. read 40 bytes3. read 40 bytes
Segments
16
TCP Format
IP header TCP header TCP data
Sequence number (32 bits)
DATA (optional)
20 bytes Min. 20 bytes
0 15 16 31
Source Port Number Destination Port Number
Acknowledgement number (32 bits)
window sizeheaderlength 0 Flags
Options (if any)
TCP checksum urgent pointer
20 bytes
4 bits
6 bits
• TCP segments have at least 20 byte header with >= 0 bytes of data.
9
17
TCP Connection Establishment
Three-way handshake to open a connection:(1) ACTIVE OPEN: Client sends a segment with
– SYN bit set– port number of client, port number of server– initial sequence number (ISN) of client
(2) PASSIVE OPEN: Server responds with a segment with
– SYN bit set
– initial sequence number of server– ACK for ISN of client
(3) Client acknowledges by sending a segment with:– ACK ISN of server
18
Three-Way Handshake
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
10
19
TCP Connection Termination
• Each end of the data flow must be shut down independently (“half-close”)– If one end is done it sends a FIN segment. This means
that no more data will be sent
• Four steps involved:(1) X sends a FIN to Y (ACTIVE CLOSE)
(2) Y ACKs the FIN, (at this time: Y can still send data to X)
(3) and Y sends a FIN to X (PASSIVE CLOSE) (4) X ACKs the FIN.
20
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
11
21
TCP Data Transfer
• TCP applications can be put into the following categories– bulk data transfer, i.e. ftp, mail, http– interactive data transfer, i.e. telnet, rlogin
• TCP has algorithms to deal which each type of applications efficiently.
22
Interactive Data Transfer Implementation
• Delayed acknowledgement– delayed ACK timer– ACK transmission may be delayed up to 200 ms
• Nagle’s algorithm– “Each TCP connection can have only one small
segment (less than MSS) outstanding that has not been acknowledged”
– Nagle’s rule reduces the amount of small segments
– The algorithm can be disabled
12
23
Bulk Data Transfer Implementation
Flow Control - How to prevent that the sender overruns the receiver with information?
• Maximum Segment Size (MSS)
• Sliding Window
- Advertised Window Size
• Acknowledgement
- cumulative
- No NACK
24
Bulk Data Transfer Implementation (cont.)
Congestion Control - intended to reduce congestion in the network
• Two parameters for congestion control:– cwnd (initial value is MSS bytes)– ssthresh (initial value is 65536 bytes)
• Allowed Window= Min(Advertised Window, Congestion window)
• Slow Start - increase cwnd by MMS for each new Ack• BUT when cwnd>ssthresh Congestion Avoidance is
activated– cwnd += segsize*segsize/cwnd+segsize/8
13
25
Bulk Data Transfer Implementation (cont.)
Error Control - involving error detection and retransmission of lost or corrupted segments
• Retransmission Timer for Automatic Repeat reQuest(ARQ) error control
• Exponential Backoff Algorithm applied in lack of RTT• set RTO adaptively based on RTT• Karn’s Algorithm: don’t update RTO on any
segments that have been retransmitted
26
Bulk Data Transfer Implementation (cont.)
More Congestion Control - assumes that a packet loss is caused by congestion, and reduces cwnd
• More Congestion Avoidance - when congestion occurs (indicated by timeout or receipt of three duplicate ACKs):
• ssthresh = Allowed Window/2, but at least 2 segments• In case of timeout only, cwnd = 1 segsize = 1 MSS bytes• When new Ack received, cwnd is increased according to whether it
is in Slow Start or Congestion Avoidence
• Fast retransmit & Fast recovery– If 3rd duplicate ACK is received, retransmit segment based on ssthresh
= min(cwnd, Advertised Window)/2, cwnd = ssthresh+3 segsize; – For each additional duplicate ACK received, 4 th, 5th, etc. transmit a
segment if allowed by new value of cwnd derived as cwnd += segsize– When a new ACK arrives, set cwnd = ssthresh; additionally, set cwnd +=
segsize; now in Congestion Avoidance
14
27
Repacketization
• When TCP does a retransmission, it can send the missing data in differently sized segments
• Increase segment size (if allowed by MSS limit) to improve efficiency (new data arrives after first transmitted segment was lost)
Data (1:100)
ACK 100
ACK 300
Data (100:200) lost
Data (100:300)
new data arrives fromapplication (100 bytes)
before the retransmissiontimer times out
28
Other TCP Timers
• Persist Timer– Ensures that window size information is transmitted
even if no data is transmitted
• Keepalive Timer– Detects crashes on the other end of the connection
• Others– Delayed ACK timer, timeout of connection setup,
abort timeout (total timeout - keeps retransmitting till this timeout, then it kills the connection), 2MSL timeout (when closing connection)
15
29
Common Applications and Services
• Telnet
• rlogin
• RIP (Routing Information Protocol)
• DNS (Domain Name Service)
• File Transfer Protocol (FTP)
• Simple Mail Transfer Protocol (SMTP)
• HyperText Transport Protocol (HTTP)
30
File Transfer: FTP vs. TFTP
File Transfer Protocol (FTP)• Complex but reliable file
transfer use TCP• Specified in RFC959, well-
know port #21(control) and #21(data)
• Data retransmission carried in lower layer by TCP
• Used for general purpose, high throughput applications
• Security feature provided– username and password
checking– data transfer may fail when
address translation/firewall implemented with random port passing
Trivial FTP (TFTP)• Simple and quick file transfer
over UDP• Specified in RFC1350, well-
known UDP port #69 (for originating request to server)
• Both ends use a timeout retransmission to resend a block of data
• Often used to– load into a batch file for
multiple hosts– bootstrap diskless systems
• No username and passwordchecking -> a feature as a “security hole”
16
31
Remote Login: telnet & rlogin
Telnet :• Standard application
implemented over TCP/IP to work between any operating systems/terminals
• Specified in RFC854/855, well-known TCP port #23
• Negotiable parameters for a Network Virtual Terminal (NVT) mapped by end terminals
Rlogin:• Developed initially as one
of Berkeley r* utilities (rsh, rcp, rwho, etc.) for transparent access between Unix systems
• Specified in RFC1282, well-known port #513
• Remote host must be configured to accept user terminal types; no connection negotiation capability
• Security concerns on transparent access (ex. stolen hosts.equiv, .rhosts files)
32
VoIP Implementations
TelcoTelco
Modem
Internet
VoIPGW
ModemPool
LAN
ATMNetwork
Router VoIPGW
VoIPServer
IP phone