You are on page 1of 71

-

. -

ISO/OSI

TCP/IP

OSI vs. TCP/IP

OSI vs. TCP/IP


(, ,
)
! (ISO/OSI TCP/IP
).

...

(Connection
Oriented)

(Connectionless)

4 ()

Request () (N+1)-
N- , ().

.
Indication ()
,

Response ()
, .
Confirm ()
o
Request.

?
?
?
?



LISTEN -
CONNECT -
RECEIVE -
SEND -
DISCONNECT -

Client Server




,
.




!

vs.

WEB HTTP
:

: HTML ,
java , , , ...
Web
HTML
.
URL
(Uniform Resource Locator)
URL
http://www.famis.edu.mk/sliki/bitola.jpg

HTTP (Hypertext Transfer Protocol)

Client-Server

equ
est
PC - Windows HT
TP
res
pon
se

: web
(web browser) ,

web HTML

WEB
(Apache, SunOne, Microsoft
IIS, Google GWS)

HT
TP
r

st
e
u
eq
r
se Server
P
n
T
o
p
running
HT
es
r
TP
Apache Web
T
H
server

PC - Linux

HTTP

TCP
TCP (
socket) 80
TCP

HTTP
web (HTTP ) web
(HTTP )
() TCP

HTTP

RTT Round Trip Time


RTT

RTT HTTP
request


Tt.
vk = 2*RTT + Tt

RTT


RTT

time

time to
transmit
File Tt

time

HTTP

HTTP
request ()
response ()

HT
TP
r

equ
est
PC - Windows HT
TP
res
pon
se

st
e
u
req
se Server
P
n
T
o
p
running
HT
es
r
P
T
Apache Web
HT
server

PC - Linux

HTTP request
request line
(GET, POST,
HEAD commands)

GET /somedir/page.html HTTP/1.1


Host: www.someschool.edu
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr

Carriage return,
line feed
indicates end
of message

(extra carriage return, line feed)

HTTP response
status line
(protocol
status code
status phrase)
header
lines

data, e.g.,
requested
HTML file

HTTP/1.1 200 OK
Connection close
Date: Mon, 09 March 2009 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 09 March 2009 ...
Content-Length: 6821
Content-Type: text/html
data data data data data ...

HTTP response
200 OK

request , ...

301 Moved Permanently


( redirecting) ...:)

400 Bad Request

404 Not Found

URL

505 HTTP Version Not Supported

HTTP
HTTP/1.0
GET
POST
HEAD

HTTP/1.1
GET, POST, HEAD
PUT
upload


URL

DELETE


URL

:
telnet yahoo.com 80
GET /autos/

Apache HTTP
Windows
Linux
XAMPP (Windows, Linux)
httpd.conf

HTTP

FTP (File Transfer Protocol)


FTP

FTP

file transfer

file
system

FTP

remote file
system


/ ()
(
)

/
(remote host)

FTP (File Transfer Protocol)

FTP
21,
TCP


21
,

,
21

,

20
,
.

TCP control connection


port 21

FTP
client

TCP data connection


port 20

FTP
server

TCP
(Data
Connection)

,
20
. out of band.
FTP

.

FTP ( )

: ASCII

ftp - starts an FTP session


open hostname - connects to the specified host
close - closes the connection (but not the FTP session!)
quit - terminates the FTP session
II. Browsing on a remote machine
dir - gives a full directory listing on the remote machine
dir test* - displays only files and directories whose name begins with "test..."
ls - same as dir, but provides a simplified listing of filenames
III. Directories in FTP
pwd - prints the name of the current remote directory
cd remote-directory - changes working directory on remote host
cd .. - moves up one level in the directory structure on the remote host
lcd directory - changes the default directory on


(FileZilla, CuteFTP, WiseFTP, Commander)

ftp

http://www.the-eggman.com/seminars/ftp_error_codes.html
http://www.ftpplanet.com/ftpresources/ftp_codes.htm
.
1xx ....
2xx ....
3xx - , ....
4xx .....
.....
.....
10xxx .....

331 Username OK, password required


125 data connection already open;
( ,
) transfer
starting
425 Cant open data connection (

)
452 Error writing file (
)


:

mail
simple mail transfer protocol:
SMTP

outgoing
message queue
user mailbox

user
agent
mail
server


email mail reader SMTP
,
email
mail
: Eudora, Outlook,
server
elm, Netscape Messenger
outgoing (), incoming
() server
user

agent

SMTP

SMTP
user
agent

user
agent
mail
server

user
agent

user
agent

Email

outgoing
message queue

Mail Servers -
mailbox email

message queue
mail
server

()
SMTP protocol -
email

SMTP
/
email
mail
client:
server
email !!!!
server: e
email !!!!
user
agent

user mailbox
user
agent

SMTP

SMTP
user
agent

user
agent
mail
server

user
agent

user
agent

SMTP (Simple Mail Transfer Protocol)

, TCP email
25
: (sending server to receiving server)

handshaking ( )


/
commands: ASCII
response:

7- ASCII

:
email
1)

2)

3)

4) SMTP
TCP
5) Email ja

(mailbox)
6)

email .


( )

email
goran@mailserver2


email email
. ()

mailServer1
SMTP
, TCP
email .

1
user
agent

?
2

mail
server1
3

SMTP

mail
server2

?
6

user
agent

SMTP

S
C -

S: 220 manu.edu.mk
C: HELO server1.mk
S: 250 Zdravo server1, OK
C: MAIL FROM: <korisnik@server1.mk>
S: 250 korisnik@server1.mk... Sender ok
C: RCPT TO: <xmail@manu.edu.mk>
S: 250 xmail@manu.edu.mk ... Recipient ok
C: DATA
S: 354 Daj mi go emailot, za kraj vnesi "." na krajnata linija
C: Zdravo kako si?
C: Sto ima novo?
C: .
S: 250 Porakata e primena za dostava
C: QUIT
S: 221 manu.edu.mk closing connection

email

SMTP: protocol
email
RFC 822:
:
header lines
To:
From:
Subject:
SMTP
!
body ()
, ASCII

header

body

blank
line


MIME

MIME: multimedia mail extension, RFC 2045, 2056


(header)
MIME
MIME version
method used
to encode data

multimedia data
type, subtype,
parameter declaration
encoded data

From: nikola@manu.edu.mk
To: nikola@yahoo.com
Subject: Slika.
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data

email

user
agent

SMTP

senders mail
server

user
agent

receivers mail
server

SMTP: email

POP: Post Office Protocol [RFC 1939] 110
/
IMAP: Internet Mail Access Protocol [RFC 1730] 143
()
...
HTTP: Hotmail , Yahoo! Mail,

POP3 protocol


:
user: username
pass:

+OK ( !)
-ERR (!)
, client:
list:

retr:

dele:
quit ()

S:
C:
S:
C:
S:

+OK POP3 server ready


user bob
+OK
pass hungry
+OK user successfully logged

C:
S:
S:
S:
C:
S:
S:
C:
C:
S:
S:
C:
C:
S:

list
1 498
2 912
.
retr 1
<message 1 contents>
.
dele 1
retr 2
<message 1 contents>
.
dele 2
quit
+OK POP3 server signing off

on

IMAP

( )



POP3
(stateless)
..

HTTP FTP
Windows Linux
Linux Server (SuSe Linux, Ubuntu Server)
Windows Server 2003 (IIS)
Apache Web Server (Windows, Linux)
FileZilla FTP Server (XAMPP)
XAMPP ( Windows Linux)
Vsftpd (Linux)
DynDNS?


(Transport Layers and Services)

application
transport
network
data link
physical

network
data link
physical

network
data link
physical

gi
lo

l
ca

network
data link
physical

en
den
d

tr

network
data link
physical

or
sp
an

network
data link
physical






:
send sid (
):


rcv side ( ):
()
,
.

:
Internet: TCP UDP

application
transport
network
data link
physical

:
?

:




:

:
12 -
12
-
=
=

=
transport protocol =


network-layer protocol =
()


(MUX/DMUX)
?
()
?
()

MUX/DEMUX

MUX :
,
(header)
()
DEMUX :
() ,
= socket
application
transport
network
link

= process
P3

P1
P1

application
transport
network

P2

P4

application
transport
network
link

link

physical

host 1

physical

host 2

physical

host 3

application
transport
network
link

P3

P1
P1

application
transport
network

P2

P4

application
transport
network
link

link

physical

host 1

physical

host 2

physical

host 3

UDP ,
DEMUX,

TCP

(, ) Reliable
Ordered (
/ )
Byte-Stream (
)
Full Duplex
.

(Flow and Congestion Controll)

UDP: User Datagram Protocol


[RFC 768]

handshaking
UDP




UDP ()

UDP

(lost)

(disordered)


.







header

DEMUX

UDP...

(streaming)
:

32 bits

UDP

Source port #

Dest port #

Length

Checksum

Application
data
()

:
DNS,

SNMP

UDP

UDP Checksum
:

(Sender):

16 bit

Checksum: ,

(Source Port,
Destination Port, Length)
Checksum
Checksum

(Receiver):

Checksum


Checksum
NO
YES
?

DNS (Domain Name System)


DNS?
DNS
DNS ( )
DNS ()

DNS?


IP ,
/ , IP

: http://yahoo.com
yahoo.com IP
IP .
Internet (ARPAnet)


IP
( Internet)

1972 IANA (Internet Assigned


Numbers Authority - www.iana.org)

DNS

1983 , TCP/IP

1984 DNS (Domain
Name System)
,

, IP


1991
Internet Service
Provider (ISP).
,

(1992)
InterNIC

DNS

,
NSF (National Science Foundation)
InterNIC, InterNIC 100.000 USD



,
!
1998 ICANN (International Corporation for
Assigned Names and Numbers - www.icann.org)

DNS , IP ,
,

!
ICANN ..


Shared
Registration System

DNS

DNS
,
IP

(hostname) -

.
()

(hostname)

(
)
DNS
. DNS DNS

Domain Name ( )


.
.
.
DNS
IP .
IP

(label)

63
.
-
:

A-Z a-z
0 9
- ( )

DNS
Root DNS

com DNS servers


yahoo.com
amazon.com
DNS servers DNS servers

org DNS servers


pbs.org
DNS servers

edu DNS servers


poly.edu
umass.edu
DNS serversDNS servers

DNS: Root name servers

ROOT
DNS
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also Los Angeles)
d U Maryland College Park, MD
g US DoD Vienna, VA
k RIPE London (also Amsterdam, Frankfurt)
h ARL Aberdeen, MD
i Autonomica, Stockholm (plus 3 other
j Verisign, ( 11 locations)
locations)
m WIDE Tokyo

e NASA Mt View, CA
f Internet Software C. Palo Alto, CA
(and 17 other locations)

b USC-ISI Marina del Rey, CA


l ICANN Los Angeles, CA

13 root name

TLD (Top Level Domain)


(Authoritative) DNS

TLD :

: ccTLD (country code TLD)


. 250
gTLD (generic TLD) 3

gTLD: .com, .net, .org, .biz, .info, .museum, .travel, .xxx
ccTLD: .mk, .us, .eu, .fr, .es, .de, .it, .jp, ...

Authoritative DNS DNS ,


. ()
. IP (subdomains), IP web email
.. ( ..)

DNS ( IP
)

DNS (resolver)
, DNS
.


(Recursive) DNS

DNS

(authoritative) DNS

IP
DNS

1.
2.


DNS
IP .


IP
- !

DNS

DNS ,

: IP
DNS
.


DNS

DNS

,
.

,
,

DNS
!
IP
DNS

, DNS

DNS


root DNS

53

3
7

6
TLD DNS

DNS server
dns.poly.edu

authoritative DNS server


dns.cs.umass.edu

cis.poly.edu
gaia.cs.umass.edu

DNS (DNS Records)


DNS: (RR) - Resource Records
RR : (name, value, type, ttl)

Type=A
name is hostname
value is IP address

Type=NS
name is domain (e.g. foo.com)
value is IP address of
authoritative name server for
Type=MX
this domain
value is name of mailserver
associated with name

Type=CNAME
name is alias name for some
cannonical (the real) name
www.ibm.com is really
servereast.backup2.ibm.com
value is cannonical name

Internet Layer ( )

(Internet Layer) TCP/IP




()
.
:
IP
ARP
ICMP
IGMP

IP (Internet Protocol)

IP

IP .
IP
(Portions).

Network Address Portion ( )


Host Address Portion ( )

Network Address Portion


.
( )
Host Address Portion

, IP


: 047.259.921 (047/ 259 921)

IPv4
IP
TCP/IP
IPv4.
V4

You might also like