Introduction to TCP/IP. What is an internet? A set of interconnected networks The Internet is the...

Post on 19-Jan-2016

219 views 0 download

Tags:

Transcript of Introduction to TCP/IP. What is an internet? A set of interconnected networks The Internet is the...

Introduction to TCP/IP

What is an internet?

• A set of interconnected networks• The Internet is the most famous example

• Networks can be completely different– Ethernet, ATM, modem, …– (TCP/)IP is what links them

What is an internet? (cont)

• Routers (nodes) are devices on multiple networks that pass traffic between them

• Individual networks pass traffic from one router or endpoint to another

• TCP/IP hides the details as much as possible

What is TCP/IP

• Transmission Control Protocol/Internet Protocol

• TCP/IP refers to an entire suite of networking protocols, developed for use on the Internet

• TCP and IP are certainly two of the most important

TCP/IP Characteristics

• TCP/IP provides the services necessary to interconnect computers and to interconnect networks, creating the Internet

• Independence from underlying network topology, physical network hardware, and OS

• Unique IP Address• Universal connectivity throughout the network• Standardize high-level protocols

TCP/IP Internetworking

TokenRing

FDDI

Private Netsand Internet

Router

TCP/IP Networking Software

• TCP/IP protocol suites define a set of universal communication services

• Services can be implemented in a standardized manner in the networking software, normally bundled with OS

TCP/IP Comm. Software

InternetTCP/IP Comm. Software

TCP/IP and Internet

• 1957 USSR sputnik, USA established ARPA• 1969 ARPA funded ARPANET• 1971 Network with 15 nodes• 1974 Cerf/Kahn Protocol• 1973 Ethernet (Ph.D Disssertation Bob Metcalfe)• 1982/83 TCP/IP as a core protocol • 1983 4.2 BSD Unix with TCP/IP from UCB

Internet growth

Year #Hosts69 4 84 1024 87 28174 90 313000 91 617000 92 1.1M93 2.0M 94 3.8M 95 6.6M 96 12.8M

1/97 16M 2014 3000M

TCP/IP Architectural Layers

Application

Transport

Internet

Network

Physical

NetworkApplications

End-to-endServices

Routing

Transmission

Network Interface

TCP/IP majors protocols

Physical

Application

Transport

Internet

Network

FTP TELNET SMTP TFTP NFS NTP SNMP NNTPDNS BOOTP DHCP HTTP X-windows

TCP UDP

IP

Network Driver Software

OSI and Protocol StackOSI: Open Systems Interconnect

OSI Model TCP/IP Hierarchy Protocols

7th

Application Layer

6th

Presentation Layer

5th

Session Layer

4th

Transport Layer

3rd

Network Layer

2nd

Link Layer

1st

Physical Layer

Application Layer

Transport Layer

Network Layer

Link Layer

Link Layer : includes device driver and network interface cardNetwork Layer : handles the movement of packets, i.e. RoutingTransport Layer : provides a reliable flow of data between two hostsApplication Layer : handles the details of the particular application

Packet Encapsulation The data is sent down the protocol stack Each layer adds to the data by prepending headers

22Bytes20Bytes20Bytes 4Bytes

64 to 1500 Bytes

Internet Layer

• Packaging• Addressing• Routing

Core Internet Layer Protocols

• IP– A connectionless unreliable protocol that is part of the

TCP/IP protocol suite• ARP (Address Resolution Protocol)

– Resolves IP addresses to MAC addresses • ICMP (Internet Control Message Protocol)

– Diagnostics and error reporting• (IGMP) Internet Group Management Protocol

– Management of group multicast

IP

• Responsible for end to end transmission

• Sends data in individual packets• Maximum size of packet is

determined by the networks– Fragmented if too large

• Unreliable– Packets might be lost, corrupted,

duplicated, delivered out of order

IP addresses

• 4 bytes– e.g. 163.1.125.98– Each device normally gets one (or more)– In theory there are about 4 billion available

Routing

• How does a device know where to send a packet?– All devices need to know what IP addresses are on

directly attached networks– If the destination is on a local network, send it directly

there

• If the destination address isn’t local– Most non-router devices just send everything to a

single local router– Routers need to know which network corresponds to

each possible IP address

IP packets

• Source and destination addresses • Various options

– e.g. to control fragmentation

• Time to live (TTL)– Prevent routing loops

IP Routing

• Routing TableDestination IP address IP address of a next-hop router Flags Network interface specification

Application

Transport

Network

Link

Application

Transport

Network

Link

Network

Link

Source Destination

Router

Transport Layer

• Sequencing and transmission of packets• Acknowledgment of receipts• Recovery of packets• Flow control• In essence, it engages in host-to-host

transportation of data packets and the delivery of them to the application layer

Core Protocols of the Transport Layer

TCP (Transmission Control Protocol)

UDP (User Datagram Protocol)

Transport Layer

TCP

• Transmission Control Protocol (TCP)• One-to-one and connection-oriented reliable

protocol• Used in the accurate transmission of large

amount of data• Slower compared to UDP because of

additional error checking being performed

TCP implementation

• Connections are established using a three-way handshake

• Data is divided up into packets by the operating system

• Packets are numbered, and received packets are acknowledged

• Connections are explicitly closed– (or may abnormally terminate)

TCP Packets

• Source + destination ports• Sequence number (used to order packets)• Acknowledgement number (used to verify

packets are received)

TCP : Data transferHostClien

tSend Packet 1Start Timer

Retransmit Packet1Start Timer

Packet should arrive ACK should be sent

ACK would normallyArrive at this time

Receive Packet 1Send AXK 1

Time Expires

Receive ACK 1Cancel Timer

Packet LostTimer

Timer

UDP• User Datagram Protocol (UDP)• One-to-one or one-to-many,connectionless and unreliable

protocol• Used for the transmission of small amount of data

– Accuracy is not of prime concern– The overhead of establishing a TCP connection is not warranted

• Used in video and audio casting– Multicasting– Broadcasting

• Also used for multimedia transmission• Faster compared to TCP

WAP

• Wireless Application Protocol• Technical standard for accessing information

over a mobile wireless network• A WAP browser is a web browser for mobile

devices such as mobile phones that uses the protocol.

Web Server

Content

CGIScripts

etc.

WM

L D

ecks

with

WM

L-Sc

ript

WAP Gateway

WML Encoder

WMLScriptCompiler

Protocol Adapters

Client

WML

WML-Script

WTAI

Etc.

HTTPWSP/WTP

WAP Architecture

Source: WAP Forum

WAP Architecture

• Another lookKey Components

• Origin/Web Server• WAP Gateway/Proxy• WAP Protocol Stack• Micro Browser• WML/WML Script• Transcoders• WTA

Source: WAP Forum

WTA –Wireless Telephony Application

WAP: Network Elementswireless networkfixed network

WAPproxy

WTAserver

filter/WAPproxyweb

server

filter

PSTN

Internet

Binary WML: binary file format for clientsPSTN: Public Switched Telephone Network

Binary WML

Binary WML

Binary WML

HTML

HTML

HTML WML

WMLHTML

Source: Schiller

WAP Specifies

• Wireless Application Environment

– WML Microbrowser– WMLScript Virtual Machine– WMLScript Standard Library– Wireless Telephony Application Interface (WTAI)– WAP content types

• Wireless Protocol Stack

– Wireless Session Protocol (WSP)– Wireless Transport Layer Security (WTLS)– Wireless Transaction Protocol (WTP)– Wireless Datagram Protocol (WDP)– Wireless network interface definitions

WAP Stack

MicroBrowser (WML, WMLScript, WTA, WTAI)

Runs on top of WDPProvided lightweight X-oriented service• Unreliable 1-way request• Reliable 1-way/2-way req./response

Lightweight SSLUses WIM/PKI-Cards

Datagram service on different bearersConvergence between bearer services

Different Wireless Tech.

Source: WAP Forum

WAP Stack• WAE (Wireless Application Environment):

– Architecture: application model, browser, gateway, server– WML: XML-Syntax, based on card stacks, variables, ...– WTA: telephone services, such as call control, phone book etc.

• WSP (Wireless Session Protocol):– Provides HTTP 1.1 functionality – Supports session management, security, etc.

• WTP (Wireless Transaction Protocol):– Provides reliable message transfer mechanisms– Based on ideas from TCP/RPC

• WTLS (Wireless Transport Layer Security):– Provides data integrity, privacy, authentication functions– Based on ideas from TLS/SSL

• WDP (Wireless Datagram Protocol):– Provides transport layer functions– Based on ideas from UDP

Content encoding, optimized for low-bandwidth channels, simple devices

Domain Name System (DNS)

DNS Server 130.182.125.66www.refer.com

• The Internet users use DNS to reference anything by name on the Internet• Resolves domain names to IP addresses and vice versa

Top-Level Domains

Simple Mail Transfer Protocol (SMTP)

• Governs the transmission of mail messages and attachments

• SMTP is used in the case of outgoing messages • More powerful protocols such as POP3 and

IMAP4 are needed and available to manage incoming messages

2: Application Layer38

Electronic Mail

• Three major components: user agents mail servers simple mail transfer protocol:

SMTP

User Agent a.k.a. “mail reader” composing, editing, reading mail

messages e.g., Eudora, Outlook, elm,

Mozilla Thunderbird outgoing, incoming messages

stored on server

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

2: Application Layer39

Electronic Mail: mail servers

• Mail Servers mailbox contains incoming

messages for user message queue of outgoing

(to be sent) mail messages SMTP protocol between mail

servers to send email messages client: sending mail server “server”: receiving mail

server

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

2: Application Layer40

Electronic Mail: SMTP [RFC 2821]

uses TCP to reliably transfer email message from client to server, Port 25

direct transfer: sending server to receiving server three phases of transfer

handshaking (greeting) transfer of messages closure

command/response interaction commands: ASCII text response: status code and phrase

messages must be in 7-bit ASCII

2: Application Layer41

Scenario: Alice sends message to Bob

• 1) Alice uses UA to compose message and “to” bob@someschool.edu

• 2) Alice’s UA sends message to her mail server; message placed in message queue

• 3) Client side of SMTP opens TCP connection with Bob’s mail server

• 4) SMTP client sends Alice’s message over the TCP connection

• 5) Bob’s mail server places the message in Bob’s mailbox

• 6) Bob invokes his user agent to read message

useragent

mailserver

mailserver user

agent

1

2 3 4 56

Mail message format

• SMTP: protocol for exchanging email msgs

header lines, e.g., To: From: Subject:

different from SMTP commands! body

the “message”, ASCII characters only

header

body

blankline

NVT – Network Virtual Terminal

MIME - Multipurpose Internet Mail Extensions

Mail access protocols

SMTP: delivery/storage to receiver’s server Mail access protocol: retrieval from server

POP: Post Office Protocol [RFC 1939]

• authorization (agent <-->server) and download IMAP: Internet Mail Access Protocol [RFC 1730]

• more features (more complex)

• manipulation of stored msgs on server HTTP: gmail, Hotmail, Yahoo! Mail, etc.

useragent

sender’s mail server

useragent

SMTP SMTP accessprotocol

receiver’s mail server

POP3 and SMTP

POP

• Post Office Protocol, a protocol used to retrieve e-mail from a mail server. Most e-mail applications (sometimes called an e-mail client) use the POP protocol, although some can use the newer IMAP (Internet Message Access Protocol).

• There are two versions of POP. The first, called POP2, became a standard in the mid-80's and requires SMTP to send messages. The newer version, POP3, can be used with or without SMTP. POP3 uses TCP/IP Port 110.

IMAPIMAP is an Internet Message Access Protocol. It is

a method of accessing electronic mail messages that are kept on a possibly shared mail server. In other words, it permits a "client" email program to access remote message stores as if they were local. For example, email stored on an IMAP server can be manipulated from a desktop computer at home, a workstation at the office, and a notebook computer while travelling, without the need to transfer messages or files back and forth between these computers. IMAP uses TCP/IP Port 143.

POP3 vs IMAP• With IMAP, all your mail stays on the server in multiple

folders, some of which you have created. This enables you to connect to any computer and see all your mail and mail folders. In general, IMAP is great if you have a dedicated connection to the Internet or you like to check your mail from various locations.

• With POP3 you only have one folder, the Inbox folder. When you open your mailbox, new mail is moved from the host server and saved on your computer. If you want to be able to see your old mail messages, you have to go back to the computer where you last opened your mail.

• With POP3 "leave mail on server" only your email messages are on the server, but with IMAP your email folders are also on the server.

Telnet – Remote Login

• Uses a client/server model to define a standard way in which to interact with a remote system.– The telnet protocol is the basis for many protocols

• FTP, HTTP, SMTP, NTTP just to name a few.– They don’t open a telnet connection, just use the protocol

Netprog: TELNET 50

TELNET vs. telnet• TELNET is a protocol that provides “a

general, bi-directional, eight-bit byte

oriented communications facility”.

• telnet is a program that supports the

TELNET protocol over TCP.

51

Figure 18.1 Local login

52

Figure 18.2 Remote login

53

Via a universal interface called the Network Virtual Terminal (NVT) character set, the TELNET client translates characters (data or commands) that come from the local terminal into NVT form and delivers them to the network. The TELNET server translates data and commands from NVT form into the form acceptable by the remote computer.

NETWORK VIRTUAL TERMINAL (NVT)

TCP/IP Protocol Suite 54

Concept of NVT

Hyper Text Transfer Protocol (HTTP)

• Protocol relating to web applications• Current version of HTTP 1.1 has additional

features– Upload information to the server

• Default Port number is 80

• RFC 959• File Transfer Protocol

– Used for downloading from most MP3 sites, for example• Designed for faster file transfer over the Internet compared to

using the HTTP protocol• uses two TCP Ports

– one for control– one for data transfers

• command-response protocol• control port uses telnet protocol to negotiate session

– US-ASCII– <crlf> is end-of-line character

• FTP default ports are 20 and 21

File Transfer Protocol (FTP)

File Transfer Protocol - Transmission Modes

• Mode is used to specify additional coding or sequencing performed on data

• independent of data type and file structure– Stream S stream of bytes– Block B file sent as sequence of blocks

preceded by header info– Compressed C data compressed using run length

encoding

HTTP and FTP

• File transfer under FTP is faster than file transfer under HTTP

• Choose an FTP site if there is one for downloading files etc.