Anda di halaman 1dari 42

Computer

Network

Pujan Srivastava pujan@ait.asia intERLab Asian Institute of Technology

Outline
1. 2. 3. 4. 5. 6. Basic networking concepts Layered protocol architecture Transport Layer UDP Tools Some Programming

10/5/12

Network Components
Router /Switches End Host Laptops Media LAN, WiFi Protocols TCP/IP Applications

10/5/12

Networking Models
OSI Model is an abstract view of how networking protocols do work (conceptual picture) OSI Model breaks various aspects of a computer network into 7 distinct layer Each layer functions independent of the others, just control is passed from one layer to the next Protocols composes the various layers and forms a pile of building blocks stacked one upon another. Group of related protocols are often called protocol stacks
10/5/12 5

Networking Models
The modern Internet sits on top of the TCP/IP technology i.e. all computers connected to the Internet understands TCP/IP TCP/IP model has 4 layers combining top 3 layers of OSI into single application layer and down two layers into network interface (or network access layer) TCP/IP model bridges the gap between non-compatible platforms (dierent hardware and operating systems)

10/5/12

Networking Model
User Process

Kernel Process

10/5/12

Networking Model
User Process

Kernel Process

10/5/12

Why Layering
It provides interoperability between devices from dierent vendors Modications at one layer does not break the other layers It reduces the debugging time It provides the modular approach It allows a structured development of network software etc.

10/5/12

Summary of Layers

10/5/12

10

Routing Stacks

10/5/12

11

Addressing

Addressing
Email address: user@domain.com Web address: www.domain.com SIP URI: sip:user@domain.com Dierent processes has dierent Port addresses (16 bits)

32 bits IPv4, 128 bits IPv6

48 bits

10/5/12

13

Ports

Identication
Destination IP address identies only host computer Hows about which user or which application program (process) will receive the datagram TCP/IP abstracts the destination point known as protocol-port number (UDP Port, TCP Port) OS determines how to bind protocol port number to specic application program

10/5/12

15

IP and Port Numbers

10/5/12

16

Check Port Number for Application

10/5/12

17

UDP Ports
echo 7/udp discard 9/udp systat 11/udp daytime 13/udp qotd 17/udp time 37/udp name 42/udp nicname 43/udp domain 53/udp bootps 67/udp bootpc 68/udp tftp 69/udp kerberos 88/udp sunrpc 111/udp ntp 123/udp snmp 161/udp xns-courier 165/udp s-net 166/udp namp 167/udp who 513/udp syslog 514/udp printer 515/udp # Echo # Discard # Active Users # Daytime (RFC 867) # Quote of the Day # Time # Host Name Server # Who Is # Domain Name Server # Bootstrap Protocol Server # Bootstrap Protocol Client # Trivial File Transfer # Kerberos # SUN Remote Procedure Call # Network Time Protocol # SNMP # Xerox # Sirius Systems # NAMP # maintains data bases showing who's # System Logs # spooler

10/5/12

18

Port Assignment
Small numbers reserved for specic services(1~1024)
Called well-known ports Same interpretation throughout the Internet Used by server software (mainly)

Large numbers not reserved


Available to arbitrary application program Used by client software

Application selects for communication over Internet

Mainly for server 10/5/12 19

Encapsulation
Basic concept:
As data ows down the protocol hierarchy, headers (and trailers) get appended to it. As data moves up the hierarchy, headers (and trailers) get stripped o.

An example to illustrate:
Trivial le transfer protocol (TFTP) client transfers 200 bytes of data and 4 bytes of TFTP header gets added. Visualization next slide

10/5/12

20

Encapsulation
TFTP Data

UDP Packet IP Packet Ethernet Frame

10/5/12

21

Transport Layer

Typical Scenario

10/5/12

23

Multiplexing and Demultiplexing

10/5/12

24

Transport Layer Functions


Multiplexing and Demultiplexing - Transport layer provides a multiplexing/demultiplexing service in order to pass data between the network layer and the correct application processes Formation of data packets by appending source and destination ports in the header Loss Detection: Lost packets due to buer overow at intermediate routers (sequence numbers and acks) Error Recovery: Retransmission Congestion Avoidance: Ensuring network has capacity Flow Control: Ensuring receiver has buers
10/5/12 25

Example

10/5/12

26

UDP (User Datagram Protocol)

UDP Characteristics
Connectionless protocol no prior connection establishment required among the communicating parties Message-oriented applications using UDP send and receive data in the form of individual messages. Arbitrary interaction an application running in one host can send/ receive messages to/ from applications running in other hosts (unicast, multicast, broadcast). Best-Eort Service UDP uses IP for all delivery and does not detect or correct delivery problems. Hence, UDP provides the best-eort service similar to that provided by IP.
10/5/12 28

Protocols Using UDP


DNS VoIP RIP SNMP

10/5/12

29

UDP Packet
The size of a UDP message is bounded by the IP datagram size. UDP messages larger than the IP datagram size are fragmented at the IP layer and it is up to the application layer at the destination host to reorder the fragments delivered by UDP. (immediate routers can fragment too, but in any case defragmentation happens only at end host) UDP messages much smaller than the IP datagram size do not eciently use the available bandwidth.

10/5/12

30

UDP Applications
As UDP uses IP and does not correct or detect delivery problems, a message can be lost, duplicated, corrupted or delivered out-of-order The best-eort service aorded by UDP can be useful for applications that can tolerate delivery errors e.g., audio/video As the audio/video applications have the sender placing a small amount of data (sometimes redundant, and also reproducible from predecessors/ successors) in each message, loss of a single packet may be tolerable and does not require retransmission. On the other hand, UDP cannot be used for on-line transactions that are extremely sensitive to packet loss. (e.g., on-line shopping application).
10/5/12 31

UDP is lightweight Protocol


No connection establishment therefore
no initial overhead due to handshaking

No connection state
greater number of supported connections by a server!

Small packet header overhead


8 bytes only Vs 20 in TCP

UDP was originally intended for simple applications


DNS Network Management (e.g. SNMP) Distributed le system support (e.g. NFS)
10/5/12 32

UDP is lightweight Protocol


UDP is too elementary!
no sequence numbers no timestamp for resynchronization at receiver

10/5/12

33

UDP Format

10/5/12

34

UDP Format
A UDP datagram header consists of four (4) elds of two bytes each (see pic prev slide) :
Source Port Dest Port Length Checksum

16 _______ 16 _______ 16 _______ 16 Port Numbers: 0 ~ 65535. Length: SizeOf ( header + payload ). Header length is a xed size. Payload size depends on the operating environment but has a maximum of 65535 bytes. Checksum Checksums protect message data from tampering/corruption during transmission. The checksum value represents an encoding of the datagram data calculated rst by the sender and later by the receiver. Tampering or corruption of packet is done by matching checksum. Checksum is optional in UDP (but mandatory in TCP)
10/5/12 35

Queue in UDP

10/5/12

36

Queue in UDP (Example)

10/5/12

37

Tools

NetStat Command
$ netstat -na Try another variations $ netstat -in

10/5/12

39

TCPDump
See supplementary material

10/5/12

40

UDP Socket Programming

FTP
Standard le transfer protocol uses TCP But today we will explore by socket programing through UDP!

10/5/12

42

References
Data Communication and Networking, Behrouz A. Forouzan

10/5/12

43

Anda mungkin juga menyukai