introduction to tcp/ipjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 raj jain introduction to tcp/ip the...

34
1 ©2002 Raj Jain Introduction Introduction to TCP/IP to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj Jain Email: [email protected] http://www.cis.ohio-state.edu/~jain/

Upload: vanngoc

Post on 16-Mar-2018

230 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

1©2002 Raj Jain

Introduction Introduction to TCP/IPto TCP/IP

The Ohio State University Columbus, OH 43210

Nayna NetworksMilpitas, CA 95035

Raj Jain

Email: [email protected]://www.cis.ohio-state.edu/~jain/

Raj Jain
jain@cse horizontal
Page 2: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

2©2002 Raj Jain

OverviewOverview

! Internetworking Protocol (IP)! IP Addressing! Domain Name System! Routing Protocols: RIP, OSPF, BGP! Transport Protocols: TCP, UDP

Page 3: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

3©2002 Raj Jain

TCP/IP Reference ModelTCP/IP Reference Model! TCP = Transport Control Protocol! IP = Internet Protocol (Routing)

ApplicationPresentation

SessionTransportNetworkDatalinkPhysical

Application

Transport

InternetworkHost to Network

IP

FTP

TCP

Telnet HTTP

UDP

Ethernet

PacketRadio

Point-to-Point

TCP/IP Model OSI Ref ModelTCP/IP Protocols

Page 4: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

4©2002 Raj Jain

Layered Packet FormatLayered Packet Format! Nth layer control info is passed as N-1th layer data.

Example: File Transfer Protocol (FTP)

FTP DataFTP Header

TCP DataTCPHeader

IP DataIPHeader

Ethernet DataEthernetHeader

EthernetTrailer

Page 5: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

5©2002 Raj Jain

InternetworkingInternetworking

! Inter-network = Collection of networks Connected via routers

NetworkNetwork NetworkNetworkRouterRouter

Page 6: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

6©2002 Raj Jain

Internet = Collection of NetworksInternet = Collection of Networks! Any computer can talk to any other computer

Net 2Net 1 Net 3

Net 4

Page 7: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

7©2002 Raj Jain

Internet Protocol (IP)Internet Protocol (IP)! Layer 3 protocol that forwards datagrams across

internet! Uses routing tables prepared by routing protocols,

e.g., Open Shortest Path First (OSPF),Routing Information Protocol (RIP)

! Connectionless servicevs connection-oriented (circuits)

Page 8: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

8©2002 Raj Jain

IP Datagram FormatIP Datagram FormatVersion Header Len Service Type Total Length

Identification FlagsTime to live Payload Type Header Checksum

Fragment Offset

Source IP AddressDestination IP Address

IP Options (May be omitted) Padding

Data

Page 9: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

9©2002 Raj Jain

IP AddressingIP Addressing

! All IP hosts have a 32-bit address.128.10.0.1=1000 0000 0000 1010 0000 0000 0000 0001

! All hosts on a network have the same network prefix

128.10128.10

192.5.48192.5.48

128.10.0.1

RouterRouter

RouterRouter

128.211128.211

1010 RouterRouter

128.10.0.2 128.211.6.115

192.5.48.310.0.0.37 10.0.0.49

Page 10: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

10©2002 Raj Jain

SubnettingSubnetting

! All hosts on a subnetwork have the same prefix.Position of the prefix is indicated by a “subnet mask”

! Example: First 23 bits = subnetAddress: 10010100 10101000 00010000 11110001Mask: 11111111 11111111 11111110 00000000.AND. 10010100 10101000 00010000 00000000

Subnet 1 Subnet 2 Subnet nNetwork

Page 11: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

11©2002 Raj Jain

Forwarding an IP DatagramForwarding an IP Datagram! Delivers datagrams to destination network (subnet)! Routers maintain a “routing table” of “next hops”! Next Hop field does not appear in the datagram

Table at R2:Net 1 Forward to R1Net 2 Deliver DirectNet 3 Deliver DirectNet 4 Forward to R3

Net 1Net 1 R1R1 Net 2Net 2 R2R2 Net 3Net 3 R3R3 Net 4Net 4

Destination Next Hop

Page 12: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

12©2002 Raj Jain

Private AddressesPrivate Addresses! Any organization can use these inside their network

Can’t go on the internet. [RFC 1918]! 10.0.0.0 - 10.255.255.255 (10/8 prefix)! 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)! 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

NetworkAddress

Translator

PrivateNetwork

InternetPrivateAddresses

PublicAddresses

Page 13: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

13©2002 Raj Jain

Domain Name ServiceDomain Name Service! Computers use addresses! Humans cannot remember IP addresses

⇒ Need namesExample, Liberia for 164.107.51.28

! Simplest Solution: Each computer has a unique name and has a built in table of name to address translation

! Problem: Not scalable! Solution: DNS (Adopted in 1983)! Hierarchical Names: Liberia.cis.ohio-state.edu

Page 14: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

14©2002 Raj Jain

Name HierarchyName Hierarchy

reston

com edu gov au us

dec ohio-state nsf co va

cis netlab ee

cnri

Unnamed root

...

Page 15: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

15©2002 Raj Jain

Name HierarchyName Hierarchy! Unique domain suffix is assigned by Internet

Assigned Number Authority (IANA)! The domain administrator has complete control over

the domain! No limit on number of sub-domains or number of

levels! computer.site.division.company.com

computer.site.subdivision.division.company.com! Name space is not related to physical interconnection,

e.g., math.ohio-state and cis.ohio-state could be on the same floor or in different cities

Page 16: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

16©2002 Raj Jain

Name ResolutionName Resolution

User NameResolver

NameServer

NameServer

Cache Cache

Cache

Que

ry

Ref

erra

l

Query

Response

Query

Response

Data-base

Data-base

NameServer

Cache

Data-base

Query

Response

Page 17: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

17©2002 Raj Jain

Name Resolution (Cont)Name Resolution (Cont)! Each computer has a name resolver routine, e.g.,

gethostbyname in UNIX! Each resolver knows the name of a local DNS server! Resolver sends a DNS request to the server! DNS server either gives the answer, forwards the

request to another server, or gives a referral! Referral = Next server to whom request should be sent! Servers respond to a full name only

However, humans may specify only a partial nameResolvers may fill in the rest of the suffix, e.g., Liberia.cis = Liberia.cis.ohio-state.edu

Page 18: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

18©2002 Raj Jain

Autonomous SystemsAutonomous Systems! An internet connected by homogeneous routers under

the administrative control of a single entity

Subnet 1.1 Subnet 2.1

Subnet 2.2Subnet 1.3Subnet 1.2

Subnet 1.4

Subnet 2.4Subnet 2.3

R2

R7

R4 R1

R6

R8R5

R3 Interior

Exterior

Page 19: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

19©2002 Raj Jain

Routing ProtocolsRouting Protocols! Interior Router Protocol (IRP): Among routers

internal to an autonomous system. Also known as IGP.! Examples: Routing Information Protocol (RIP),

Open Shortest Path First (OSPF)! Exterior Router Protocol (ERP): Among routers

between autonomous systems. Also known as EGP.! Examples: Exterior Gateway Protocol (EGP),

Border Gateway Protocol (BGP), Inter-Domain Routing Protocol (IDRP)Note: EGP is a class as well as an instance in that class.

Page 20: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

20©2002 Raj Jain

Routing Information ProtocolRouting Information Protocol! RIP uses distance vector ⇒ A vector of distances to

all nodes is sent to neighbors every 30 seconds! Each router computes new distances and replaces

entries with new lower hop counts

Page 21: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

21©2002 Raj Jain

Shortcomings of RIP V1Shortcomings of RIP V1! Maximum network diameter = 15 hops! Cost is measured in hops

Only shortest routes. May not be the fastest route.! Entire tables are broadcast every 30 seconds.

Bandwidth intensive.! Uses UDP with 576-byte datagrams.

Need multiple datagrams.300-entry table needs 12 datagrams.

! An error in one routing table is propagated to all routers

! Slow convergence

Page 22: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

22©2002 Raj Jain

Open Shortest Path First (OSPF)Open Shortest Path First (OSPF)! Uses true metrics (not just hop count)! Allows load balancing across equal-cost paths! Authenticates route exchanges! Quick convergence! Large networks are subdivided into a backbone

network and areas! Each area has multiple subnets. Each subnet has a

designated router. ! Link state routing ⇒ Each router broadcasts its

connectivity with neighbors to entire area

Page 23: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

23©2002 Raj Jain

Router TypesRouter TypesAnotherAutonomous

System

AreaBorderRouter

BackboneRouter

DesignatedRouter

Backup DR

ASBoundary

Router BackboneRouter

Area 4

Area 1 Area 2InternalRouter

Backbone

Page 24: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

24©2002 Raj Jain

Router Types (Cont)Router Types (Cont)! Internal Router (IR): All interfaces belong to the same

area! Area Border Router (ABR): Interfaces to multiple

areas! Backbone Router (BR): Interfaces to the backbone! Autonomous System Boundary Router (ASBR):

Exchanges routing info with other autonomous systems! Designated Router (DR): Generates link-state info

about the subnet! Backup Designated Router (BDR): Becomes DR if

DR fails.

Page 25: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

25©2002 Raj Jain

OSPF OperationOSPF Operation! Periodic “Hello” packets are multicast on the subnet

to find other routers and elect “designated router” and “backup designated router”

! Designated routers and routers on point-to-point links form “adjacency.” Exchange “Link State Advertisements (LSAs).” New info flooded to all other adjacent routers in the area.

! Area border routers (ABRs) send “summary LSAs” to other ABRs

! Autonomous system border routers (ASBRs) use exterior routing protocol to exchange routing information

Page 26: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

26©2002 Raj Jain

Border Gateway ProtocolBorder Gateway Protocol! Inter-autonomous system protocol [RFC 1267]! Used since 1989 but not extensively until recently! Advertises all transit ASs on the path to a destination

address! A router may receive multiple paths to a destination

⇒ Can choose the best path

Page 27: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

27©2002 Raj Jain

BGP OperationsBGP Operations! BGP systems initially exchange entire routing tables.

Afterwards, only updates are exchanged.! BGP messages have the following information:

! Origin of path information: RIP, OSPF, …! AS_Path: List of ASs on the path to reach the dest! Next_Hop: IP address of the border router to be

used as the next hop to reach the dest! Unreachable: If a previously advertised route has

become unreachable! BGP speakers generate update messages to all peers

when it selects a new route or some route becomes unreachable.

Page 28: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

28©2002 Raj Jain

TCP: Key FeaturesTCP: Key Features! Point-to-point communication: Two end-points! Connection oriented. Full duplex communication.! Reliable transfer: Data is delivered in order

Lost packets are retransmitted.! Stream interface: Continuous sequence of octets

Page 29: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

29©2002 Raj Jain

Transport Control Protocol (TCP)Transport Control Protocol (TCP)! Key Services:

! Send: Please send when convenient ! Data stream push: Please send it all now, if

possible.! Urgent data signaling: Destination TCP! please

give this urgent data to the user(Urgent data is delivered in sequence. Push at the should be explicit if needed.)

! Note: Push has no effect on delivery. Urgent requests quick delivery

Page 30: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

30©2002 Raj Jain

TCP Header FormatTCP Header Format

16 16 32 32 6

SourcePort

DestPort

SeqNo

AckNo

DataOffset Control WindowResvd

4 6 16

16 16 x y Size in bits

Check-sum Urgent Options Pad Data

FTP HTTP SMTP

Page 31: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

31©2002 Raj Jain

TCP HeaderTCP Header! Source Port (16 bits): Identifies source user process

20 = FTP, 23 = Telnet, 53 = DNS, 80 = HTTP, ...! Destination Port (16 bits)! Sequence Number (32 bits): Sequence number of the

first byte in the segment. ! Ack number (32 bits): Next byte expected! Data offset (4 bits): # of 32-bit words in the header! Reserved (6 bits) ! Window (16 bits): Will accept [Ack] to

[Ack]+[window]

Page 32: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

32©2002 Raj Jain

User Datagram Protocol (UDP)User Datagram Protocol (UDP)! Connectionless end-to-end service! Unreliable: No flow control.

No error recovery (No acks. No retransmissions.)! Used by network management and Audio/Video. ! Provides port addressing! Error detection (Checksum) optional.

SourcePort

DestPort

Check-sumLength

16 16 16 Size in bits16

Data

Page 33: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

33©2002 Raj Jain

SummarySummary

! IP is the forwarding protocol between networks! IPv4 uses 32-bit addresses ! DNS: Maps names to addresses! OSPF uses link-state advertisements! BGP is used between autonomous systems! TCP provides reliable full-duplex connections.! UDP is connectionless and simple. No flow/error

control.

Page 34: Introduction to TCP/IPjain/tutorials/ftp/t_2tcp.pdf · 1 ©2002 Raj Jain Introduction to TCP/IP The Ohio State University Columbus, OH 43210 Nayna Networks Milpitas, CA 95035 Raj

35©2002 Raj Jain

Homework 2Homework 2True or False?T F" " A sample IP address is 10.0.110.357" " Two computers cannot have the same IP address" " Two computers cannot have the same complete DNS name" " IANA assigns all names used inside a company." " Each DNS server database stores all computer names in the world." " Routing tables used by IP are prepared using routing protocols like OSPF, BGP." " RIP is used in small networks" " OSPF area border routers connect to other autonomous systems." " OSPF Hellos are flooded through out the area." " BGP is used between autonomous systems" " TCP delivers all packets to the destination exactly as received at the source." " TCP port numbers are related to applications using them. " " UDP is unreliable transport protocol.Marks = Correct Answers _____ - Incorrect Answers _____ = ______