You are on page 1of 143

17/4/2014

I
/
krantos@teikav.edu.gr
1

 TCP/IP
 IP .
 IP

 ( IP),
.
 TCP/UDP
 (IPv4, IPv6)
 TCP/IP (ICMP, ARP, RARP)

1
17/4/2014

TCP/IP

Internet



.


 ARPANET
ARPA (Advanced
Research Projects Agency)
DARPA (Defense Advanced Research Projects Agency).
 ARPA:

.
4

2
17/4/2014

Internet


Internet.

.
 TCP/IP .
 2
( 6,8 )
 2000 361.000.
 2000-2010: 444%
 5 .
11 .

: The opte
Project

3
17/4/2014

Internet





.
 Internet
;




;
7

Internet


Internet Internet Architecture
Board (IAB).

(task forces)
Internet Engineering Task Force (IETF).
 IETF


,

Internet.

4
17/4/2014

Internet





.

http://www.ietf.org/rfc.html

 RFC 5000

Internet
RFCs


:
 Hubs
 Switches
 Bridges
 Routers
 Gateways

10

5
17/4/2014

 Hub ():


.


( hub ).

11

 Switch ():


(
switches hubs) .


MAC

12

6
17/4/2014

 Bridge ():




.

13

 Router ():



.

.
14

7
17/4/2014

 Gateway ():



().

 .. Residential gateway
15

16

8
17/4/2014

TCP/IP


Internet
 de facto
.
 :
 TCP (Transmission Control Protocol):
TCP/IP
 IP (Internet Protocol): Internet
TCP/IP.
 OSI
. TCP/IP
OSI .

17

TCP/IP

 4 :
 (Application):
Bytes, Message Stream
 (Transport):
 (Internet):
 (Network Access
Layer):

18

9
17/4/2014

OSI

 OSI:
 (Application):
.
 (Presentation):
.
 (Session):

.
 (Transport): ,
, , .
 (Network): , ,
.
 (Data Link):
, .
 (Physical):

19

OSI TCP/IP

20

10
17/4/2014

TCP/IP OSI


:
 .

.
 .
 :

(..
Bluetooth).
 .

21

TCP/IP

22

11
17/4/2014

TCP/IP:


:
 (HTTP)
 (Telnet)
 (FTP)
 (SMTP, IMAP, POP)
 (NNTP)
 (LDAP)

23

TCP/IP:



.





.


.

24

12
17/4/2014

 .
 .
 ()

.


.

,

.

25

 :
 TCP (Transmission
Control Protocol):
:

.
TCP
.

.
,
(
)
.
26

13
17/4/2014

 TCP (Transmission Control Protocol):


 :
.

.

. .. Email,
FTP.

27

 TCP :

(16bit)

(16bit)




(

)


28

14
17/4/2014

 UDP (User Datagram Protocol):


 ,
.
TCP,

.
 datagram
64kbytes
1500bytes.

29

 UDP (User Datagram Protocol):




, .. Streaming Video
( ), .
 : (16bits),
(16bits), (16bits),
(16bits),

30

15
17/4/2014


.


.








.
31

32

16
17/4/2014

33

34

17
17/4/2014

35

36

18
17/4/2014



.

Application Application

Transport Transport
RFC1122 Stallings
Tanenbaum Comer
Internet Internet

Network Access
Link
Physical

37

IP

38

19
17/4/2014

IP



.
 MAC
 ,
 .
 TCP/IP IP
.
 IP
32bits IPv4 (128bits
IPv6).

39

IPv4

 3 : IP ,
3 bits.
 x.x.x.x (x=byte)
 :
 Class A: bit : 0
(1.0.0.0 127.255.255.255)
 Class B: bits : 10
(128.0.0.0 191.255.255.255)
 Class C: bits : 110
(192.0.0.0 223.255.255.255)
 Class D: multicasting (1110)
 Class E: (1111)

40

20
17/4/2014

IPv4




 (host)
.
0 7 15 23 31

Class 0 Net -id Host-id

Class B 10 Net -id Host-id

Class C 110 Net -id Host-id

Class D 1110 Multicast Address

Class E 1111 Reserved

41

IPv4

 Class A: 27 , 216(65,536) hosts


7 bits netid 24bits hostid.
0 7 15 23 31
Class 0 Net -id Host-id

 Class B: 214 , 28(256) 216(65,536) hosts


14 bits netid 16bits hostid.
0 7 15 23 31
Class B 10 Net -id Host-id

 Class C: 221 , 28(256) hosts


21 bits netid 8bits hostid.
0 7 15 23 31
Class C 110 Net -id Host-id

42

21
17/4/2014

IPv4

0 7 15 23 31

Class 0 Net -id Host-id

Class B 10 Net -id Host-id

Class C 110 Net -id Host-id

Class D 1110 Multicast Address

Class E 1111 Reserved

43


IP .
 :
0: host .
Netid 0: host .
Hostid 0: host .
1: (broadcasting)
Hostid 1: .
Netid.
Netid 127: (loopback).
 ,
1 ,
0 .
44

22
17/4/2014


.
 host
.


.

.
 .. C
78
20 .

45



.



.

.
 IP
.

46

23
17/4/2014

128.10.1.0

128.10.1.1 128.10.1.2
1 2
Internet G


128.10.0.0
128.10.2.0

128.10.2.1 128.10.2.2
3 4

47

 G
128.10.0.0
byte .

:
 32bit
host
host.



48

24
17/4/2014




.
 IP :

Host

Host

49



:
.

.
() host
.

50

25
17/4/2014

 :
broadcast domains


. domain
.






51


:

hosts .

bits, host
,
bits
hosts .
TCP/IP .

52

26
17/4/2014

 :
1.

WAN
2. hosts
host
interface router
3.


hosts

53


host
:

 32-bit 1 0,
 1


 0
host


54

27
17/4/2014

 ..: 32-bit
11111111 11111111 11111111 00000000
bytes
host.
 BOOLEAN AND

host
.
 :
Class : 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

55

 bits
8.

255.255.255.128 /25
255.255.255.192 /26
255.255.255.224 /27
255.255.255.240 /28
255.255.255.248 /29
255.255.255.252 /30

56

28
17/4/2014

 = 2x , x 1

 hosts = 2y-2 , y 0
 Broadcast address: subnet 1
 hosts: subnets
0 1

57

Class C: 1

 192.168.10.0
255.255.255.192
 : 22 = 4
 hosts : 26-2 = 62
 : 0, 64, 128, 192
 Broadcast address : 63, 127, 191, 255
 host : 1-62, 65-126, 129-
190, 193-254

58

29
17/4/2014

Class C: 2

 192.168.10.0
255.255.255.224
 :;
 hosts : ;
 : ;

 Broadcast address : ;

 host : ;

59

Class C: 2

 192.168.10.0
255.255.255.224
 : 23 = 8
 hosts : 25-2 = 30
 : 192.168.10.0, 192.168.10.32, .64, .96, .128, .160,
.192, .224
 Broadcast address : 31, 63, 95, 127,
159, 191, 223, 255
 host : 1-30, 33-62, 65-94,
97-126, 129-158, 161-190, 193-222, 225-254

60

30
17/4/2014

Class C: 3

 : 192.168.10.41,
192.168.10.131 192.168.10.154

255.255.255.128;
 255.255.255.224;

 192.168.10.32 192.168.15.42

255.255.255.18;

61

 bits
16.

255.255.128.0 /17 255.255.255.0 /24
255.255.192.0 /18 255.255.255.128 /25
255.255.224.0 /19 255.255.255.192 /26
255.255.240.0 /20 255.255.255.224 /27
255.255.248.0 /21 255.255.255.240 /28
255.255.252.0 /22 255.255.255.248 /29
255.255.254.0 /23 255.255.255.252 /30

62

31
17/4/2014

Class B: 1

 154.12.0.0
255.255.192.0
 : ;
 hosts : ;
 : ;
 Broadcast address : ;

 host : ;

63

Class B: 1

 154.12.0.0
255.255.192.0
 : 22 = 4
 hosts : 214-2 = 16382
 : 0.0, 64.0, 128.0, 192.0
 Broadcast address : 63.255, 127.255,
191.255, 255.255
 host :
0.1-63.254,
64.1-127.254,
128.1-191.254,
192.1-255.254

64

32
17/4/2014

Class B: 2

 154.12.0.0
255.255.240.0
 : ;
 hosts : ;
 : ;
 Broadcast address : ;

 host : ;

65

Class B: 2

 154.12.0.0
255.255.240.0
 : 24 = 16
 hosts : 212-2 = 4094
 : 0.0, 16.0, 32.0, 48.0, 64.0, , 240.0
 Broadcast address : 15.255, 31.255,
47.255, 63.255,
 host :
0.1-15.254,
16.1-31.254,
32.1-47.254,
48.1-63.254,

66

33
17/4/2014

Class B: 3

 154.12.0.0
255.255.255.192
 : ;
 hosts : ;
 : ;
 Broadcast address : ;

 host : ;

67

Class B: 3

 154.12.0.0
255.255.255.192
 : 210 = 1024
 hosts : 26-2 = 62
 : 0.0, 0.64, 0.128, 0.192, 1.0, 1.64, 1.128, 1.192
 Broadcast address : 0.63, 0.127, 0.191,
0.255, 1.63, 1.127, 1.191, 1.255
 host :
0.1-0.62,
0.65-0.126,
0.129-0.190,
0.193-0.254,
1.1-1.62

68

34
17/4/2014

 bits
24.

255.128.0.0 (/9) 255.255.240.0 (/20)
255.192.0.0 (/10) 255.255.248.0 (/21)
255.224.0.0 (/11) 255.255.252.0 (/22)
255.240.0.0 (/12) 255.255.254.0 (/23)
255.248.0.0 (/13) 255.255.255.0 (/24)
255.252.0.0 (/14) 255.255.255.128 (/25)
255.254.0.0 (/15) 255.255.255.192 (/26)
255.255.0.0 (/16) 255.255.255.224 (/27)
255.255.128.0 (/17) 255.255.255.240 (/28)
255.255.192.0 (/18) 255.255.255.248 (/29)
255.255.224.0 (/19) 255.255.255.252 (/30)

69

 :

Network address: 192.168.15.35


Subnet mask: 255.255.255.248

 ;
 host ;
 host ;
 broadcast ;
 ;

70

35
17/4/2014

1. byte :
35 = 00100011
2. byte :
248 = 11111000
3. bits
00100011
11111000
4. bits
: 00100000
host : 00100001
host : 00100110
broadcast: 00100111
: 00101000
71


:


;

host ;

host ;
 broadcast
;
 ;
 DNS
;

72

36
17/4/2014

1. :
212.92.233 = 11010100.01011100.11101001
2. :
255.255.0 = 11111111.11111111.00000000
3. bits
11010100.01011100.11101001
11111111.11111111.00000000
4. bits
: 11010100.01011100.00000000
host : 11010100.01011100.00000001
host : 11010100.01011100.11111110
broadcast: 11010100.01011100.11111111
: 11010100.01011101.00000000
73

 hosts
:
 195.12.32.192/26
 195.12.32.192/27
 195.12.32.192/28
 192.15.36.160/27
 192.15.36.160/28
 83.17.128.0/18

74

37
17/4/2014


178.46.0.0. 19

2046 hosts.
.


B
176 . hosts
;

75


192.168.10.0
:
 : 20 hosts
 B: 2 hosts
 D: 30 hosts
 E: 12 hosts
 F: 30 hosts

76

38
17/4/2014





Net A 15 hosts


192.168.10.0

Net C 22 hosts

Net B 20 hosts

77

Net E 2 hosts
192.168.10.160
255.255.255.224
Net A 15 hosts
192.168.10.128
255.255.255.224

Net D 2 hosts
192.168.10.96
255.255.255.224

Net F 2 hosts
192.168.10.192
255.255.255.224
Net C 22 hosts
192.168.10.64
Net B 20 hosts 255.255.255.224
192.168.10.0
255.255.255.224

78

39
17/4/2014

Variable Length Subnet Mask



Variable Length Subnet Mask
subnet masks
.


.


.

79


200.17.5.0

hosts:
82 hosts
55 hosts
C 30 hosts
D 10 hosts
E 8 hosts

hosts

80

40
17/4/2014

: bits
63
hosts .
2
255.255.255.128 ( bit) (
) ,
bits
3
.
35 hosts
2 ( 1 bit),
C D 1 bit
2 , C D.

81

Variable Length Subnet Mask

 192.168.10.0.
,
.
Net
30 hosts
Net A
14 hosts

Net D
Net C
6 hosts
20 hosts

82

41
17/4/2014

Variable Length Subnet Mask

Net 30 hosts
192.168.10.32/27
Net A 14 hosts Net 2 hosts
192.168.10.16/28 192.168.10.0/30

Net F 2 hosts
192.168.10.4/30 Net H 2 hosts
192.168.10.12/30

Net G 2 hosts
192.168.10.8/30 Net D 6 hosts
Net C 20 hosts
192.168.10.96/29
192.168.10.64/27

83

Variable Length Subnet Mask

 192.168.10.0/24.
,
.
Net B Net C
10 hosts 12 hosts

Net A Net G
30 hosts Net D 12 hosts

Net E Net F
Net K
8 hosts

Net H Net J
Net I
60 hosts 60 hosts
14 hosts

84

42
17/4/2014

IP

85

IP

 (Internet Protocol)

.



,
(best effort delivery)

86

43
17/4/2014

IP


().

.
 .
( 20 bytes
+ )
.

87

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)
20
Time to Live (8) Protocol (8) Header Checksum (16) bytes

Source IP Address (32)

Destination IP Address (32)

Options (0 or 32 if any)

Data (varies if any)

88

44
17/4/2014

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)
 (Version) (4 bits):
Time to Live (8)
Protocol (8) Header Checksum (16)
.
4 6.
Source IP Address (32)
 (Header Length
Field) (4 bits):
Destination IP Address (32)
32-bits.
Options (0 or 32 if any)

Data (varies if any)

89

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)

 Flags Type) (8bits):


(Service
Identification (16) Fragment offset (13)
(3)
.

Time to Live (8) (8)
Protocol (16)
Header Checksum
. :
 Bits 0-2: Precedence.
Source IP Address (32)
 Bit 3: 0 = Normal Delay, 1 = Low Delay.
 Bits 4: 0 = Destination
NormalIP Throughput,
Address (32) 1 = High
Throughput.
 Bits Options (0 orReliability,
5: 0 = Normal 32 if any) 1 = High
Reliability.
Data (varies if any)
 Bit 6-7: Reserved for Future Use.

90

45
17/4/2014

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8)
(Total Length)
Protocol (8)
(16bits):
Header Checksum (16)

Source
IP Address (32)
.

Destination
IP Address (32)

(65,535 bytes).
Options (0 or 32 if any)

Data (varies if any)

91

(MTU)

 (Maximum Transfer
Unit, MTU):


. .. Ethernet (1500bytes), FDDI (
4470bytes). MTU
(.. 127bytes IEEE802.15.4 WPAN).
 (
MTU
)
MTU.

.

92

46
17/4/2014

(MTU)

 : TCP/IP

(,
fragments)
MTU.
fragmentation.

.

.

.

93

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8) Protocol (8) Header Checksum (16)

 :
Source IP Address (32)
 (Identification) (16bits):
16-bit
Destination IP Address (32)
.
fragmentation
Options (0 or 32 if any)

.
Data (varies if any)

94

47
17/4/2014

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8) Protocol (8) Header Checksum (16)


 :
 Flags : Source IP Address (32)

Bit 0: 0
Destination IP Address (32)
Bit 1: 0=May fragment, 1=Dont fragment
Bit 2: 0=Last Fragment, 1=More Fragments
Options (0 or 32 if any)

Data (varies if any)

95

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8) Protocol (8) Header Checksum (16)


 :
 Source IP
Address (32) Offset) (13bits):
(Fragment

.
Destination
IP Address (32) 8bytes. To
offset 0.
Options (0 or 32 if any)

Data (varies if any)

96

48
17/4/2014

IPv4

0 15 31
Version Header 
Priority
and Type of Total(Time
length (16)to live)
(4) length (4) Service (8)
(8 bits):
Flags
Identification (16) .
Fragment offset (13)
(3)

Time to Live (8)
Protocol (8)
Header Checksum (16)
.
Source
(32)
IP Address 1
0

Destination IP Address (32) .

Options (0 or 32 if any)

Data (varies if any)

97

IPv4

0 15 31
Version Header Priority and Type of
Total length (16)
(4) length (4) Service (8)
Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8) Protocol (8) Header Checksum (16)

Source IP Address (32)


 (Protocol) (16bits):
(..Destination
TCP, UDP) (32)
IP Address
.
. Options (0 or 32 if any)

Data (varies if any)

98

49
17/4/2014

IPv4

0 15 31

Version
Header Priority and Type of
Total length (16)

(4) length (4)(Header Service (8)
Checksum) (16 bits): Flags
Identification (16) Fragment offset (13)
(3)

Time to Live (8)
. Protocol (8) Header Checksum (16)

Source16-
IP Address (32)
bit ,
Destination IP Address (32)
,
(0 or 32 if any)
Options
.
Data (varies if any)
0.

99

IPv4

0 15 31

 Version Header Priority
and Type of
Total
length (16)
(4) length (4) Service (8)
(Source Address and Destination Address) (32bits
Flags

):Identification (16)
(3)
Fragment offset (13)
.
Time to Live (8) Protocol (8) Header Checksum (16)

Source IP Address (32)

Destination IP Address (32)

Options (0 or 32 if any)

Data (varies if any)

100

50
17/4/2014

Frame 1 (1506 bytes on wire, 1506 bytes captured)


Ethernet II, Src: Intracom_26:ac:be (00:05:59:26:ac:be), Dst: IntelCor_35:6f:69 (00:1f:3c:35:6f:69)
Internet Protocol, Src: 94.75.220.129 (94.75.220.129), Dst: 192.168.2.3 (192.168.2.3)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
0000 00.. = Differentiated Services Codepoint: Default (0x00)
.... ..0. = ECN-Capable Transport (ECT): 0 ECN: Explicit Congestion Notification
.... ...0 = ECN-CE: 0
Total Length: 1492
Identification: 0x708f (28815)
Flags: 0x02 (Don't Fragment)
0.. = Reserved bit: Not Set
.1. = Don't fragment: Set
..0 = More fragments: Not Set
IP captured packet
Fragment offset: 0
Time to live: 114
Protocol: TCP (0x06)
Header checksum: 0x951c [correct]
[Good: True]
[Bad : False]
Source: 94.75.220.129 (94.75.220.129)
Destination: 192.168.2.3 (192.168.2.3)
Transmission Control Protocol, Src Port: http (80), Dst Port: 50513 (50513), Seq: 1, Ack: 1, Len: 1452
Hypertext Transfer Protocol

101


IPv6

102

51
17/4/2014

NAT protocol

 NAT (Network Address Translation)



v4:

Internet

.


,
( ..
).

103

NAT protocol



.

,
,

.



,
.

104

52
17/4/2014

NAT protocol


.

.

 .
 10.0.0.0 10.255.255.255 (10.0.0.0/8)
 172.16.0.0 172.31.255.255 (172.16.0.0/12)
 192.168.0.0 192.168.255.255 (192.168.0.0/16)

105

NAT protocol

.. ( )
IP
IP
(172.17.1.5)
(165.69.210.246).
165.69.210.246

.

106

53
17/4/2014

NAT protocol



IP

.

. ,

IP.

107

IPv6

 2011,
ICANN (Internet
Corporation for Assigned Names and Numbers)

,
,
IPv4.
 IPv4
ICAN

(RIR).

108

54
17/4/2014

IPv6

 IPv6 (RFC 2460):


 .

(
IPv4).
 .
 ,
(real-time
services).

109

IPv6

 IPv6:



IP (

).

.

110

55
17/4/2014

IPv6

 128 bits.
 ~3,4x1038

340.282.366.920.938.463.463.374.607.431.768.211.456
 IPv4.

8 16-bit .
 ..
2001:0ba0:01e0:d001:0000:0000:d0f0:0010

111

IPv6

 :
.. 2001 : 0db8 : 3c4d : 0015 : 0000 : 0000 : abcd : ef12
global prefix subnet Interface ID

 To global prefix ISP Regional


Internet Registry. Subnet Interface ID
.
 IPv6 blocks 0
( ) :
 .. 2001 : 0db8 : 3c4d : 0015 : 0 : 0 : abcd : ef12
2001 : 0db8 : 3c4d : 0015 : : abcd : ef12
 Localhost: ::1
112

56
17/4/2014

IPv6 IPv4

 IPv4 unicast, broadcast multicast


.
 IPv6 unicast, multicast anycast
.
 broadcast multicast.

113

IPv6 Unicast

 Global unicast addresses:


IPv4.
 Link-local addresses:
IPv4. (
),
(.. Conference).
 Unique local addresses: link-local


.
 Special addresses: Loopback addresses
IPv4
IPv6.
114

57
17/4/2014

Link IPv6

 Link IPv6 (RFC 4862):



.
Ethernet; PPP links; X.25, Frame
Relay, ATM ; (tunnels)
( ).

115

IPv6 Unicast

 unicast
:
bits >=48 <=16 64

routing prefix subnet id interface identifier

64-bit interface identifier


 MAC
interface EUI-64 format
 DHCPv6 server
 (),


116

58
17/4/2014

Modified EUI-64

 MAC link local IPv6


EUI-64:
 FF:FE MAC
,
 bit Universal/Local ( 7
bit) 1

 :
 MAC
00:1C:BF:2F:C8:19
02:1C:BF:FF:FE:2F:C8:19

117

Multicast

 multicast
.
 broadcasting
.

(
broadcasting IPv4).

118

59
17/4/2014

Anycast


.
 anycast

.
 load balancing
failover.

119

IPv6

 IPv4 IPv6:
 (dual stack):

.
 (tunneling):
IPv6
IPv4 IPv4 IPv6.

120

60
17/4/2014

IPv6 over IPv4 Tunneling

IPv4 Header IPv6 Header IPv6 Data

Dual Stack Dual Stack


Router
IPv4 Network
IPv6 over IPv4 tunnel Router

IPv6 IPv6
Net Net

121

IPv6

0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

Payload Length (16) Next Header (8) Hop Limit (8)

Source IP Address (128)

Destination IP Address (128)

122

61
17/4/2014

IPv6
0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

 Payload
(Version) 4bits:
Length (16) Next Hop Limit(6).
Header (8) (8)

 (Traffic Class) 8bits:



Source IP
Address
(128)

. 0 7

. 8 15
Destination
IP
Address (128)
(.. ,
). Type of Service IPv4.

123

IPv6
0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

Payload Length (16) Next Header (8) Hop Limit (8)

 (Flow Label) (20 bits):



Source IP Address (128)
-
.

o.
Destination IP Address (128)

124

62
17/4/2014

IPv6
0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

Payload Length (16) Next Header (8) Hop Limit (8)


Source IP Address (128) (Payload
Length) (16-bit):
( bytes)
( IPv4
Total Length
Destination IP Address (128)
).

125

IPv6
0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

Payload Length (16) Next Header (8) Hop Limit (8)

 (Next Header) (8
bits): IPv6
Source IP Address (128)
(
IPv4)
.
fragmentation,
, IP.
Destination Address (128)
.

126

63
17/4/2014

IPv6
0 15 31
Version
Traffic Class (8) Flow Label (20)
(4)

Payload Length (16) Next Header (8) Hop Limit (8)

 (Hop Limit) (8bits):


Time-To-Live
Source IP Address (128) IPv4.

IPv4 time-
to-live
, IPv6
Destination

IP Address (128)
.

127

IPv6
0 15 31
Version

Traffic Class (8) (Source Address)
Flow Label (20)
(4)
(Destination Address)
(128bits
PayloadLength
):
(16) (8) .
Next Header Hop Limit (8)

Source IP Address (128)

Destination IP Address (128)

128

64
17/4/2014

Fragment extension

 (Fragment
Extension Header) (8 bytes):
.
 IPv6
(
IPv4

MTU )

MTU (MTU Path
Discovery) MTU
.
IPv6
.

129

Fragment extension

 (Fragment
Extension Header) (8 bytes):
IPv4
, more fragments,
.
 (MTU Path
Discovery):
+

.
Internet

. MTU
. IPv6

130

65
17/4/2014

MTU Path Discovery


MTU Path
Discovery: IPv6

(tunnelling) IPv6
IPv6.


,
.

131

IPv6 Tunneling




(encapsulation).


.

132

66
17/4/2014

IPv6 over IPv6 Tunneling

IPv6 Header IPv6 Header IPv6 Data

IPv6 Network
IPv6 over IPv6 tunnel

IPv6 IPv6
Net Net

133



195.152.8.0/24.
. VLSM.

Router A PC C1
Net A PC A1
42 Net C 24
Router C
hosts hosts

PC A2
PC C2

Router B
Router D
PC B1
PC D1 Net D
Net B 8 hosts
30 PC E1
hosts PC B2
Net E PC D2

PC E2 31
hosts 134

67
17/4/2014

&

135




.
.
 ;


.
 .

136

68
17/4/2014


.
 :
(.. )
.
 :

( )
.

137

 ,
,
.
 hosts
:



 hosts

.

138

69
17/4/2014

 :
 (host)
 .

139

 :
 .




( )
 :
.
 : .

140

70
17/4/2014

 :
 (Non-adaptive)

 (Adaptive)

141

Non-adaptive



(.. ,
..).

.

142

71
17/4/2014

Adaptive



(,
). :
 (
,
)
 ( x sec,
, )
 (,
, ).

143

 :
+
+ .
(

)
 :
+ .
+ .
.

144

72
17/4/2014

 ;
 ;
 ;
 ;


.
 : J

,
J
.
145


(shortest path)


.
.
 Dijkstra.
.
 :
 .
 .
 .
 .

146

73
17/4/2014

Dijkstra

 ,
,


.
 ,
.

.

147


(flow based routing)

 ,

,


.

.
 :
.

148

74
17/4/2014

(selective flooding)



.
 .

(
).

.

149


(Distance Vector Routing)

 ()
,
,
.

.


.

.

150

75
17/4/2014


(Distance Vector Routing)


. .

1 A
2 C
C 1 C
D 3 C
 ,
( )
(
).
151


(Distance Vector Routing)


,
 ,
 ,


152

76
17/4/2014


(Distance Vector Routing)
 .. :

1
D 1 D
C 8 D
H 2 A
E 7 D
F 3 D
:

1
C 3
H 7
E 7
G 4

153


(Distance Vector Routing)
 O :


1
D 1 D
C 4 A
H 8
7 D
F 3 D
G 5

154

77
17/4/2014


(Distance Vector Routing)

 :
? :


.

155


(Distance Vector Routing)

 :
C D E





4 .

156

78
17/4/2014


(Distance Vector Routing)

 :
B, C, D
1, 2, 3 4

.
;
C D E

157

Count to infinity

 .
 C
2
.
 3
C.
 C B
3
4.


(
).

158

79
17/4/2014



:

.
 .. ,

 C .


 C.
.

159

 ;


1
C 8
D 2 C
E 7 F
F 3 D

160

80
17/4/2014


.



.
.
1.
C
D

E

F


o .

161


D ;

162

81
17/4/2014

163



.

.




(link state routing)

164

82
17/4/2014


(Link State Routing)

 :

,

,

,
 ,

(
Dijkstra).

165

 :
 HELLO

.
 :
 ECHO


.
,
.

166

83
17/4/2014


;

167

 :

:
 ,
 ,
 ,

.


.

168

84
17/4/2014

169

 :
 .

.
.

170

85
17/4/2014

 .

:

.


.

.

171

 :

Dijkstra

.

.

172

86
17/4/2014


Distance Vector Routing:

(
)
 Link
State Routing ( Shortest Path
First):
,

173




111.2.24.0/23. Net 63 hosts

, hosts Net A Router A
PC B
routers 45 hosts
Router B
.
PC A

Net D
. 49 hosts
Router C

hosts PC C
Router D

Net C PC D

62 hosts
. Net E
PC E
17 hosts

174

87
17/4/2014

TCP/IP

175

TCP/IP

 :
:


 INTERNET
.

.


.

176

88
17/4/2014

TCP/IP



,
.
IGPs: RIP,
EIGRP, OSPF

EGPs: BGP

177

TCP/IP

 Interior Gateway Protocols:




 Routing Information Protocol (RIPv1, RIPv2)
 Enhanced Interior Gateway Routing Protocol (EIGRP)
 Open Shortest Path First (OSPF)
 Exterior Gateway Protocols:

 Border Gateway Protocol (BGPv4)

IANA (Internet Assigned Numbers
Authority www.iana.org)

178

89
17/4/2014


(Border Gateway Protocol BGP)




(path vector routing).
 .



.

179

 BGP
:
 (stub networks):
(
).

.
 (multiconnected
networks):
.
 (transit networks):

, .

180

90
17/4/2014

BGP



.


.


.
 BGP
TCP
.
181

BGP




AS.



.

182

91
17/4/2014

BGP

 BGP Internet;
 BGP
,
.

()
.
.

ASs ASs
AS
AS.

183

Interior Gateway Protocol OSPF

 :


, , .


184

92
17/4/2014

Interior Gateway Protocol OSPF

 AS
(areas).
.
 AS

(backbone) ( 0)

.


backbone.



backbone.

185

Interior Gateway Protocol OSPF



.


.



.

186

93
17/4/2014

Interior Gateway Protocol OSPF


.


.

(designated router)

.


.

187

Interior Gateway Protocol OSPF

 OSPF

:
 .

.
 .

.

:


 AS.

188

94
17/4/2014

Interior Gateway Protocol OSPF

:

.

(
). .


.


.

.

189

Interior Gateway Protocol RIP

 Routing Information Protocol RIP:


:




.


190

95
17/4/2014

Classless Routing

191

Classless Interdomain Routing


:

Internet (
).
 IPv4.

(
A, C). , 2
C.
.

192

96
17/4/2014

CIDR

 C 255 hosts

C .
 C



.
 .., 16 C

16 .

16x255 = 4080 65,536
host.
193

CIDR

 To Classless InterDomain Routing CIDR (


supernetting)


.



.

.

bits .

194

97
17/4/2014

Classful, Classless Routing Protocols

 Classful Routing:
 RIPv1 IGRP subnetting (.. VLSM)
supernetting CIDR.
 Classless Routing:
 RIPv2, IGRP OSPF, BGP-4 subnetting (..
VLSM) supernetting CIDR.

195

CIDR

 16
C. 16
, 16
C.
 192.4.16.0 192.4.31.0.
20 bits .


C.
 ,
C


.
196

98
17/4/2014

CIDR


C
.

C 2.

.

197

CIDR

 CIDR

.

,

.
 ..
171.69.0.0/16 171.69.10.0/24.

171.69.10.5 .

198

99
17/4/2014

CIDR



(longest prefix).
 171.69.10.5
171.69.10.0/24.
 171.69.20.5 171.69.0.0/16

.

199


classless routing
.

:
 136.79.55.65

 136.79.55.137
136.79.55.0/25 R0
 176.79.45.40
136.79.55.128/26 R1
 176.79.45.194
176.79.45.128/26 R2
 193.5.12.130
193.5.12.192/27 R3
 193.5.12.225
Default R4

200

100
17/4/2014


400 hosts.
 hosts

?

207.21.51.0
207.21.60.0.
.

201


1400 hosts
192.12.7.0-192.12.23.255.

.
 1400 hosts
400 ?

16 .

202

101
17/4/2014


1300 hosts
192.12.160.0/20.

.

 CIDR

180.128.0.0/12
180.131.0.0 180.136.255.255
180.142.0.0 180.146.255.255
.


;
203


154.12.0.0/24.
Net E Router B (
interface router A) ,
, hosts,
routers.
. hosts

204

102
17/4/2014

205

 CIDR

145.224.0.0/12
145.220.0.0 145.226.255.255
145.230.0.0 145.242.255.255
.


;

206

103
17/4/2014


User Datagram Protocol
Transmission Control Protocol

207

User Datagram Protocol UDP


 TCP
.
 .
 (ports)
.

 16-bit ( )
 0-1023:
 1024-49151:
 49152-65535:

208

104
17/4/2014

Ports

 7: echo
 21: FTP
 22: SSH
 23: Telnet
 25: SMTP
 80: WWW Http
 110: POP3
 143: IMAP
 119: Network News Transfer Protocol
 443: https
http://www.iana.org/assignments/port-numbers

209

UDP

 IP
.
 :
 .


.

.
 :
 .
 .

.

210

105
17/4/2014

UDP

 :
 (4 16bits
) .
 :
: .
0 ( ).

: 8 bytes

. IPv4,
IPv6. 0.

211

UDP

0 15 31

Source Port Destination Port

Length Checksum

65535
bytes

Data

212

106
17/4/2014

Transmission Control Protocol TCP


.
 ;


.

,
, .

,
, .

213

TCP

 :
 Stream Orientation:

.
 Virtual Circuit Connection:

.

(Buffered Transfer):

.

214

107
17/4/2014

TCP

 :


.

.


215

TCP

 :
:

.

.

.
.

.

216

108
17/4/2014

TCP





.

.

.


.

217

TCP




.

:
 : (, )
 TCP
. ..,

(109.1.2.3, 1112), (224.1.2.3, 26)
(115.3.2.1, 2112), (224.1.2.3, 26)

218

109
17/4/2014

TCP


.

segment ().
IP .

219

TCP

0 15 31

Source Port Destination Port

Sequence Number

Acknowledgement Number

Data C E U A P R S F
Reserved W C R C S S Y I Window Size
offset R E G K H T N N

Checksum Urgent Pointer

Options (optional)

Data (optional)

220

110
17/4/2014

TCP

0 15 31

Source Port Destination Port

Sequence Number

Acknowledgement Number

Data C E U A P R S F
Reserved
W C R C S S Y I
Window Size
offset
 R E
G K
H T N N

 (32 bits):
Checksum Urgent Pointer
byte
.
Options (optional)
 (32 bits):
byte .
Data (optional)
.

221

TCP

0 15 31
 Data offset: 32-bit words
Source Port Destination Port
 Code Bits (6 bits):
.
Sequence Number
:
CWR, ECE:
Acknowledgement
Number

C E U A P R S F
Data
Reserved W C R C S S Y I Window Size
offset R E G K H T N N

URG:Checksum
Urgent Pointer
ACK: .
PSH (PUSH): Options

(optional)
.
RST:
SYN: Data (optional)
.
FIN: .

222

111
17/4/2014

TCP

0 15 31
 Window Size:

Source Port bytes
Destination Port
.
 Checksum:
Sequence
Number

 Urgent Pointer: (offset)


Acknowledgement
segment Number
urgent data (
URG 1)
C E U A P R S F
Data
Reserved W C R C S S Y I Window Size
offset R E G K H T N N

Checksum Urgent Pointer

Options (optional)

Data (optional)

223

TCP

0 15 31

Source Port Destination Port

Sequence Number

 Options:
Acknowledgement
Number
,
Data UMaximum
C E A P R S FSegment Size Window Scale
Reserved W C R C S S Y I Window Size
offset R E G K H T N N

Checksum Urgent Pointer

Options (optional)

Data (optional)

224

112
17/4/2014

Maximum Segment Size


.
 ,
.
 OPTIONS
(maximum segment size MSS)
.

225

TCP MSS

 MSS

.

MSS IP
MTU .
MSS = MTU - sizeof(TCPHDR) - sizeof(IPHDR)


MTU
MSS 536 (
default IP ).

;

226

113
17/4/2014

TCP MSS


MSS
.
 MSS

bytes .
 MSS
IP .
(fragmentation).
(IP fragment)
.
IP
.

227

TCP MSS

 , MSS
IP

.
 MSS :
 TCP
.

.

228

114
17/4/2014

TCP

 (handshake) .
 segment
(synchronisation): SYN bit 1.


.
 SYN ACK bits 1.
SYN
.


.

229

TCP

Host A Host B
Send SYN seq=x

Receive SYN

Send SYN seq=y,


ACK = x+1

Receive SYN, ACK

Send ACK = y+1

Receive ACK

230

115
17/4/2014

TCP

 :

bytes.
Host A Host B

Send SYN seq=x


Receive SYN

Send SYN seq=y,
ACK = x+1

Receive SYN, ACK

Send ACK = y+1

Receive ACK

231

232

116
17/4/2014

233

234

117
17/4/2014

TCP

 :
.
.
 :
 TCP segment bit FIN
1.

.

.

.

235

TCP

Host A Host B
Send FIN seq=x

Receive FIN

Send ACK = x+1

Receive ACK Send FIN seq=y,


ACK = x+1

Receive FIN+ACK

Send ACK = y+1

Receive ACK

236

118
17/4/2014

TCP


FIN .

.

.

237

TCP

 .
.

.
.
.
 1 2
.
 2
1 .
 2 1
.
 1
.

238

119
17/4/2014

TCP


:


, .
 o TCP
:
 FIN

. ,

.

239

TCP

 TCP:

.
 TCP bytes
segments.
 TCP
WINDOW
bytes
.
.

.
0
.
240

120
17/4/2014


(silly window syndrome)
 :

.

( 0).
 bytes ( )


bytes.
 TCP
bytes .

TCP .

.
241


(silly window syndrome)

 :
 :

.
 TCP

bytes
.
 :
.

242

121
17/4/2014

TCP UDP

TCP UDP

, (ACKs)
(ACKs)
. .

: .


.

243

TCP UDP

TCP UDP


.


.


email video streaming
DNS.



. TCP.

244

122
17/4/2014



( TCP).
C=100bps.
P=50ms
T=60seconds.
 bits Window
Sequence Number ;

245

 TCP
65,535 byte 1Gbps
10msec.
;
?

246

123
17/4/2014

 TCP

;


(
);

247


;

248

124
17/4/2014



;

249

 TCP
.
.

,
;

250

125
17/4/2014


2 n
;
;

251



;

252

126
17/4/2014

DNS
ARP
RARP
ICMP
DHCP
FTP

253

DNS

 Domain Name System:



IP (
).


.

( )
 ftp, email,
http
.
254

127
17/4/2014

 x.y.z:


 :
 (
site)
 (
site)


 .com  .mil sites


 .edu  .org

 .gov sites
 .net
255


:
 .gr site

 .fr
 .uk
 ...

.
 .edu .ac , ..
www.teikav.edu.gr
www.rhul.ac.uk
 sites ... ..
www.sony.co.uk
www.ypes.gov.gr

256

128
17/4/2014

DNS Servers

 DNS

IP .

.


(
)

257

DNS


DNS

.


(Reverse DNS).

258

129
17/4/2014

DNS



nslookup ( UDP 53).
 ..
$ nslookup www.ieee.org
Server: philippos.teikav.edu.gr
Address: 195.130.92.35

Non-authoritative answer:
Name: e1630.c.akamaiedge.net
Address: 95.100.182.198
Aliases: www.ieee.org
www.ieee.org.edgekey.net

259

Authoritative and non-authoritative answers



authoritative
response ( )

non-
authoritative response ( ).


.

.

260

130
17/4/2014

DNS:

261

Address Resolution Protocol

 IP

.
 .

( ). .. ethernet.
 IP
.
 IP


.

262

131
17/4/2014

Address Resolution Protocol

 IP

.
 ARP

Ethernet Token
Ring.

263

264

132
17/4/2014

Address Resolution Protocol -

 IP
,
ARP cache .

ARP .
IP
.
 ,

.
 IP

.

265

Reverse Address Resolution Protocol

 IP
.


IP .
 (dummy
terminal) IP
RARP .
 ROM

.

266

133
17/4/2014

Internet Control Message Protocol



IP , ..
 IP
(host unreachable),
 ,
 TTL 0,
 IP .


.

267

Dynamic Host Configuration Protocol DHCP



(
)

.


.
 server
.

server
.

268

134
17/4/2014

File Transfer Protocol



 :


.

(binary ascii)
 :

( password)

.

269

File Transfer Protocol


server
.


.

 (
) 21 .

.
;

270

135
17/4/2014

File Transfer Protocol



. :

20
.

271

Email

272

136
17/4/2014

Email


 RFC 822 and MIME
 ,
emails?
 MUAs, MTAs
 SMTP, POP3, IMAP

273

RFC 822

 e-mail
ASCII
RFC 822.

:
 : sender, recipient, date, subject, delivery
path,
 (body)
 ASCII
-ASCII , ..
.

274

137
17/4/2014

RFC 822

From: krantos@teikav.edu.gr
To: noc@teikav.edu.gr
Cc: library@teikav.edu.gr
Subject: RFC 822 example
Date: Tue, 16 Nov 2010 12:15:32

This is an RFC 822 email example.

275

Multipurpose Internet Mail Extensions MIME

 RFC 822
e-mail
ASCII
, .

RFC 822
(extensions).
 .
 RFCs 2045-2049.

276

138
17/4/2014

MIME

5 :

MIME-Version
Content-Type
Content-Disposition
Content-Transfer-Encoding
Content-ID -
Content-Description -

277

Content-Type


.
 text/plain
 Multipart/mixed, email
.
 MIME

MIME .

(boundary string)
Content-Type.

278

139
17/4/2014

Content-Disposition


.
 Inline:


 Attachment:
(
)

.

279

Content-Transfer-Encoding

 RFC 822 e-mails ASCII


.
 MIME .
 Content-Transfer-Encoding field
(raw
data) ASCII.
 base64 :
 24 bits (3 bytes) 4 ASCII .
 .

280

140
17/4/2014

Message-ID: <4CDCFD3E.2000903@teikav.edu.gr>
Date: Fri, 12 Nov 2010 10:39:26 +0200
From: Konstantinos Rantos <krantos@teikav.edu.gr>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12)
Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6
MIME-Version: 1.0
To: ioannis papadopoulos <papadopoulos@gmail.com>
Subject: Re: test
Content-Type: multipart/mixed;
boundary="------------080009000908090002030108"

This is a multi-part message in MIME format.

281

--------------080009000908090002030108
Content-Type: text/plain; charset=ISO-8859-7;
Content-Transfer-Encoding: 8bit

...

--------------080009000908090002030108
Content-Type: application/msword;
name="test.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="test.doc"

0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAXgAAAAAA
...
--------------080009000908090002030108--

282

141
17/4/2014

emails

 Mail Server: Mail Transfer Agent MTA


 Mail Client: Mail User Agent MUA

283

 Mail client:
.. Microsoft Outlook Thunderbird.
 email RFC 822
Mail Server.
 Mail Server SMTP
(Simple Mail Transfer Protocol)
RFC 822 .
 SMTP: RFC 821, MUA-
MTA MTA-MTA . 25
TCP. email
587.

284

142
17/4/2014

 O Mail Server
Mail Server SMTP
RFC 822 .

Mail Servers.
 O Mail Server
Mail Client

.

285

e-mail

 mail server
mail client:
 POP=Post Office Protocol (RFC 1939, v3).
 IMAP=Internet Message Access Protocol (RFC 2060,
v4rev1).
 ...
 Web
 mail client

286

143

You might also like