Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified...

44
Introduction to Computer Science Lecture 7 Networking – part 1 of 2 Bartłomiej Przybylski, PhD, MBA Department of Algorithmics and Numerical Methods Faculty of Mathematics and Computer Science Adam Mickiewicz University in Poznań, Poland

Transcript of Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified...

Page 1: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Introduction to Computer Science

Lecture 7Networking – part 1 of 2

Bartłomiej Przybylski, PhD, MBA

Department of Algorithmics and Numerical MethodsFaculty of Mathematics and Computer ScienceAdam Mickiewicz University in Poznań, Poland

Page 2: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Introduction

• Sometimes we want to transfer data from one device to another, but this process is not that easy.• How would you organize traditional postal service between:

• the residents of a single house,• houses in a single city,• houses in the whole world?

• How would you transfer a letter from a specific person to another person living on the other side of the world?

• Modern computer networks have evolved for last 60 years (starting with ARPA, 1961).

Page 3: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Networking protocols

• When we think about computer networks, we rapidly understand that it is not possible to build even a small network without a set of rules that need to be followed by all the parts of the communication process.

• Network protocols define rules and conventions that let devices communicate. They include mechanisms for:• device recognition and identification,• establishing and maintaining connections,• preparation (encoding and decoding) of transferred data.

Page 4: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP model

Page 5: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP model

• In the TCP/IP model we divide the process of communication into five layers.

• The TCP/IP is not the only model in use (comp. ISO/OSI). However, it is the most convenient for us now.

• All the networking models reflect and fit the physical and logical (algorithmic) solutions applied in real life.

Page 6: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP model

• Physical layer• How do we physically transfer sequences of bytes between two (or

more) directly connected devices?

• Data link layer• How do we manage data transfer to a known device in a local network?

• Network layer• How do we transfer data between unknown devices?

• Transportation layer• How do we make sure that the data is transported correctly?

• Application layer• How do we interpret the data?

Page 7: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP modelPhysical layer

Page 8: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Physical layer

• A sequence of bits can be directly transferred from one device to another using:• electric signal,• light,• radio waves.

• In order to do so, we need a Network Interface Controller, either integrated or in a form of a card, able to convert (1) a sequence of bits into an outcoming signal and (2) an incoming signal into a sequence of bits.

Page 9: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: GameGavel.comA Network Interface Controller in a form of a card (Ethernet + Coaxial)

Page 10: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: summitsource.comEthernet cable

Page 11: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: esmacat.comAn 8-wire RJ45 connector

Page 12: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: computercablestore.comFiber cable

Page 13: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: fibertronics.comA switch with both RJ45 and optical ports

Page 14: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: pcmag.comWireless card/USB dongle

Page 15: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Physical layer

• In case of an electrical system, sequences of bits can be broadcasted to a number of devices connected to a single backbone (bus topology) or a single hub (star topology).

A backbone (coaxial cable)

Page 16: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

A hub (Ethernet cable)

Page 17: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP modelData link layer

Page 18: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Data link layer

• Each device (network interface) is identified by a unique MAC (Media Access Control) address.

• A MAC address is a 48-bit number, so we can produce up to281 474 976 710 656 network devices.

• In a local network, a data frame is sent from one device to another, based on a source and destination MAC address.

• Switches are second-layer multi-NI devices that transfer frames between computers in the same network. In case of wireless networks, the role of switches is taken over by access points.

Page 19: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: gatevidyalay.comAn Ethernet frame header, staring with10101010 10101010 10101010 10101010 10101010 10101010 10101010 10101011

Page 20: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

MAC: 00:F2 MAC: 00:E4 MAC: 02:E3

Switch

Page 21: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

MAC: 00:F4 MAC: 00:E4 MAC: 02:E3

SwitchAP

Page 22: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

MAC: 00:F2 MAC: 00:E4 MAC: 02:E3

Switch

MAC: 02:F2

MAC: 70:E4

MAC: 02:A3

Switch

Page 23: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Data link layer

• One can build quite a large network based on a number of switches. Such networks have a star or an extended star topology.

• How does a device know the MAC address of a destination node?• How does a switch know where to send a data frame?

Page 24: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP modelNetwork layer

Page 25: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• Each network device can be identified by a 32-bit IPv4 address. Such an address is divided into two parts: first identifies a network, and the second identifies a particular device.

IP 01001001001010001011111011111101MASK 11111111000000000000000000000000

IP 0100100100101000101111101111110173.40.190.253

MASK 255.0.0.0 (8 bits)

Page 26: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

IP: 150.254.77.120/24

Router

IP: 150.254.77.124/24

IP: 150.254.77.125/24

IP: 150.254.77.1/24 IP: 185.200.0.1/16 IP: 185.200.23.1/16

IP: 185.200.23.16/16

IP: 185.200.3.18/16

Page 27: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• A network address is an IP address in which the host part contains only zeros.

• A broadcast address is an IP address in which the host part contains only ones.

• Neither network, nor broadcast address can be assigned to a device.

Page 28: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network classes

Class 1st octet value Default mask Number of networks Hosts per network

A 1-126 8 bits 27 − 2 = 126 224 − 2 = 16777214

127 Loopback and diagnostics

B 128-191 16 bits 214 = 16384 216 − 2 = 65534

C 192-223 24 bits 221 = 2097152 28 − 2 = 254

D 224-239 Multicasting

E 240-254 Research

Page 29: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• One can easily divide networks into smaller ones.

NET IP 10010110111111100000000000000000MASK 11111111111111110000000000000000

• How can we divide this network into 4 parts? We extend the network part by two bits.

Network address Mask Hosts per network

150.254.0.0 16 bits 255.255.0.0 216 − 2 = 65534

Page 30: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• NET IP 10010110111111100000000000000000MASK 11111111111111111100000000000000

Network address Mask Hosts per network

150.254.0.0 18 bits 255.255.192.0 214 − 2 = 16382

150.254.64.0 18 bits 255.255.192.0 214 − 2 = 16382

150.254.128.0 18 bits 255.255.192.0 214 − 2 = 16382

150.254.192.0 18 bits 255.255.192.0 214 − 2 = 16382

Σ = 65528 < 65534

Page 31: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• Two or more different networks can be connected with each other using a router.

• If a device wants to send a packet to another device, then:• If the destination device is in the same network, then a proper MAC

address is looked up.• If the destination device is in another network, then the package is sent

to the router (using its MAC address).

• Why don’t we use MAC addresses to identify devices among different networks?

Page 32: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: telescript.denayer.wenk.beAn IPv4 header

Page 33: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Network layer

• As an IPv4 address is a 32-bit number, we can use 4 294 967 296distinct addresses:• Is that enough?• How do we deal with that?

• In 1995, a new standard of IPv6 was introduced by proper RFC documents. Here, the address is a back-compatible 128-bit number.

Page 34: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

LAN vs. WAN

• Sometimes, we want to distinct between small local networks and wide networks that cover a wide area or a large number of subnetworks/devices.

• By LAN (Local Area Network), we understand a small network that is limited to a small area and/or a limited number of devices.

• By WAN (Wide Are Network) is larger (or wider) than LAN, yet there are no direct classification methods that help us decide whether a network is Local or Wide.

Page 35: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP modelTransportation layer

Page 36: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Transportation layer

• Sometimes we do really care if the data is successfully received by a receiver (e.g. when we send a file), and sometimes we do not (e.g. when we stream a video).

• On the level of transportation layer, IP packets are packed into TCP or UDP packets.

• In case of UDP (User Datagram Protocol) it is not guaranteed that a packet will be successfully received by a receiver.

• In case of TCP (Transmission Control Protocol) it is guaranteed that a packet will be received or an error will be handled.

Page 37: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Transportation layer

• A single device can stay in connection with different devices around the world. In order to distinct among packets received from different sources, an artificial notion of ports is introduced.

• A TCP/UDP packet includes information about the source and destination ports. A port is a 16-bit number (in range of 0-65535).

Page 38: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: gatevidyalay.comAn UDP header

Page 39: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Source: gatevidyalay.comA TCP header

Page 40: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

The TCP/IP modelApplication layer

Page 41: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Application layer

• Application layer covers all the protocols supported by computer programs. They include:• mail, i.e. IMAP, POP3, SMTP,• web, i.e. HTTP, HTTPS,• network, i.e. DNS,• remote access and file transfer, i.e. Telnet, FTP, RDP,• secure remote access, i.e. SSH,• and many more...

Page 42: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Application layer

Example. Below, we can see how the data sent to a client by a google.com server in response to a HTTP request looks like.

HTTP/1.1 301 Moved Permanently

Location: http://www.google.com/

Content-Type: text/html; charset=UTF-8

Date: Sun, 17 Nov 2019 08:43:32 GMT

Expires: Tue, 17 Dec 2019 08:43:32 GMT

Cache-Control: public, max-age=2592000

Server: gws

Content-Length: 219

X-XSS-Protection: 0

X-Frame-Options: SAMEORIGIN

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">

<TITLE>301 Moved</TITLE></HEAD><BODY>

<H1>301 Moved</H1>

The document has moved

<A HREF="http://www.google.com/">here</A>.

</BODY></HTML>

Page 43: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Graphical summary

Data frame

IP packet

TCP/UDP packet

Application data that is a part of communicationdetermined by an application protocol, i.e. a webpage content

together with proper status headers

Page 44: Prezentacja programu PowerPoint · Data link layer •Each device (network interface) is identified by a unique MAC (Media Access Control) address. •A MAC address is a 48-bit number,

Summary

You should now be able to:• present the role of network protocols in modern networking;• discuss the place of five layers of the TCP/IP model;• recognize and divide IPv4 networks;• recognize some of the most popular application protocols.