network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

74
Ministry Of higher Education & Scientific Research Presidency of Slemani Polytechnic University Kalar Technical Institute Information Technology Department - Khanaqin Computer Networks Assistant Lecture Mohammad Hassan Husain 2015 - 2016

Upload: polytechnic-sulaimania-universitykala-instituteit-dept

Post on 11-Apr-2017

45 views

Category:

Science


0 download

TRANSCRIPT

Page 1: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Ministry Of higher Education & Scientific Research

Presidency of Slemani Polytechnic University

Kalar Technical Institute

Information Technology Department - Khanaqin

Computer Networks

Assistant Lecture

Mohammad Hassan Husain

2015 - 2016

Page 2: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

I

Syllabus

Chapter One: Overview

1. Introduction to Computer Networks ……..…………………….…. …… 1

1.1 Network Applications …..…………………………………….………. 1

1.2 The advantages of computer networks ….…………………….………. 3

1.3 Disadvantages of Computer Networks ………………………... ……… 4

2. Network Components ………………………………………………….. 5

3. Data Communication ………………………………………..………….. 6

3.1 Data Communication Components ……………………………….…… 7

3.2 Data Flow ………………………………………………………….…... 8

4. Network Criteria ……………………………………………………….. 10

5. Network Criteria ……………………………………………………….. 12

Chapter Two: Network Categories

2.1 Network ….…………………………………………….………..….. 13

2.2 Network Categories ……………………………………………….… 13

2.2. A: [Depending on Architecture of the network operating system Software] …....13

1- Peer-to-Peer Networks ………………………………………….. 13

2- Client-Server Networks ………………….………………..…….. 13

Page 3: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

II

2.2. B: [Depending on the Size (Area)] ………………………………...... 15

1- Local Area Network (LAN) ………………..…………….……….. 16

2- Metropolitan Area Networks (MAN) ……………..…….………… 17

3- Wide Area Network (WAN) ………………………..…….………. 18

2.3 Network Topologies ……………………………………….….………. 20

2.3.1 Type of Connection ……………………………………..……….. 20

2.3.2 Basic Network Topology Types …………………….….….. .….. 21

2.3.2 .A Physical Topology ………………………………………….. 21

2.3.2. A.1 Mesh Topology ……………..………………………. 21

2.3.2. A.2 Star Topology ……………….………………….…… 23

2.3.2. A.3 Bus Topology …………………………………..…… 24

2.3.2. A.4 Ring Topology ………………………………….….. 24

2.3.2. A.5 Hybrid Topology ……………………………………. 25

2.3.2. B. Logical topology …………………………………………… 26

2.3.2. B.1- Shared Media ……………………………………….. 26

2.3.2. B.2- Token Based ………………………………………… 27

Chapter Three: Transmission Media

3.1 Transmission Media …………………………………………..……….. 29

Page 4: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

III

3.1.1 Unguided Media ……………………………………………..….. 29

3.1.2 Guided Media …………………………….………………………. 30

3.1.2.1. Twisted-Pair Cable ...……………………………………… 30

3.1.2.2. Coaxial Cable ……………………………………………...32

3.1.2.3. Fiber-Optic Cable ………………..……………………..… 33

Chapter Four: The OSI and TCP/IP Models

4.1. The OSI Reference Model ………..…………………………………36

4.1.1 Data encapsulation ………………….……………………..….. 37

4.1.2 Layers in the OSI Model ………………………..……………. 39

4.1.2.1The Application Layer (layer 7) ……..…………….….... 39

4.1.2.2 The Presentation Layer (layer 6) …………..……….…. 39

4.1.2.3 The Session Layer (layer 5) ………………………..…. 40

4.1.2.4 The Transport Layer (layer 4) ……………….…….….. 40

4.1.2.5 The Network Layer (layer 3) …………………..….….. 40

4.1.2.6 The Data-Link Layer (layer 2) …………….…………. 41

4.1.2.7 The Physical Layer (layer 1) ………………….………42

4.2 The TCP/IP Reference Model …………………………………….. 44

4.2.1 Layers in the TCP/IP Model ………………………..……….. 46

Page 5: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

IV

4.2.1.1 The Application Layer (layer 4) ……………..……….. 46

4.2.1.2 The Transport Layer (layer 3) ………………..………. 47

4.2.1.3 The Internet Layer (layer 2) ……………………..…… 48

4.2.1.4 The Network Access Layer (layer 1) …………………. 50

4.2.2 Header Formats of the Protocols …………………………….. 51

4.2.2.1 Ethernet Frame Format ………………………………. 51

4.2.2.2 IP Header Format …………………………………….. 52

A. TCP Header Format ………………………………….. 53

B. UDP Header Format ……………………………..…… 55

Chapter Five: The Addressing of TCP/IP Protocols

5.1. IPv4 Addresses ……………………………………………………57

5.1.1 IPv4 addresses Classes …………………………………..…. 58

Class A ……………………………………….…..………… 60

Class B ………………………………………..….………… 61

Class C ……………………………………………………... 61

Class D …………………………………………………….. 62

Class E ……………………………………….…………… .. 63

5.1.2 Classless Addressing ……………………………..………. . 63

Page 6: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

V

5.2 IPv6 Addresses ……………………………………..………..… 64

5.3. Hardware Address ………………………….…..……………… 65

5.4. Subnet Masks ………………………….…………..…………... 66

References

1- Behrouz A. Forouzan, “ TCP/IP Protocol Suite “, Fourth Edition

2- Sharam Hekmat, “Communication Networks”

3- Andrew S. Tanenbaum, “Computer Networks”, Fourth Edition

4- Behrouz A. Forouzan, “Data Communications and Networking”,

Fourth Edition

Page 7: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 1

Chapter One

Network Introduction

1. Introduction to Computer Networks

Computer networks are defined as: “Interconnected collection of

autonomous computers. Two computers are said to be interconnected if they are

able to exchange information”. Or: a network is simply a collection of

intercommunicating computers and peripherals possibly having access to remote

hosts and other computer networks. A network consists of a set of computers:

hosts, connected via a communication subnet, the word “host” refers to an

individual computer connected to the computer, which can communicate with

other hosts via the network.

A network is a set of devices (often referred to as nodes) connected by

communication links. A node can be a computer, printer, or any other device

capable of sending and/or receiving data generated by other nodes on the network.

A network is a combination of hardware and software that sends data from

one location to another. The hardware consists of the physical equipment that

carries signals from one point of the network to another. The software consists of

instruction sets that make possible the services that we expect from a network.

When we communicate, we are sharing information. This sharing can be

local or remote. Between individuals, local communication usually occurs face to

face, while remote communication takes place over distance.

Page 8: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 2

1.1 Network Applications

Marketing and sales (booking hotel, buying airplane ticket)

Financial services (Auto Teller Machine (ATM), Exchanging money)

Manufacturing (multi user work on project simultaneously)

Electronic messaging (email)

Directory services (list of files stored in central location to speed up www

search)

Information services (a www site offering technical specifications for a

product).

Electronic Data Interchange (EDI) like (purchase order without using paper)

Teleconferencing (text, voice, video conferencing)

Cellular telephone (wireless phone connection)

Displaying weather to decide what to wear using online current weather

conditions.

Find the least congested route to your destination, displaying traffic video from

webcams.

Check your bank balance and pay bills electronically.

Receive and send e-mail, or make an Internet phone call, at an Internet cafe

over lunch.

Obtain health information and advice from experts all over the world, and post

to a forum to share related health or treatment information.

Download and upload files.

Post and share your photographs, home videos, and experiences with friends or

with the world.

Page 9: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 3

1.2 The advantages of computer networks

File Sharing: The major advantage of a computer network is that is allows

file sharing and remote file access. A person sitting at one workstation of a

network can easily see the files present on the other workstation, provided he

is authorized to do so. It saves the time which is wasted in copying a file from

one system to another, by using a storage device.

Resource Sharing: Resource sharing is also an important benefit of a

computer network. For example, if there are four people in a family, each

having their own computer, they will require four modems (for the Internet

connection) and four printers, if they want to use the resources at the same

time. A computer network, on the other hand, provides a cheaper alternative

by the provision of resource sharing. In this way, all the four computers can be

interconnected, using a network, and just one modem and printer can

efficiently provide the services to all four members. The facility of shared

folders can also be availed by family members.

Increased Storage Capacity: As there is more than one computer on a

network which can easily share files, the issue of storage capacity gets

resolved to a great extent. A standalone computer might fall short of storage

memory, but when many computers are on a network, memory of different

computers can be used in such case. One can also design a storage server on

the network in order to have a huge storage capacity.

Increased Cost Efficiency: There are many software available in the

market which are costly and take time for installation. Computer networks

resolve this issue as the software can be stored or installed on a system or a

server and can be used by the different workstations.

Page 10: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 4

Figure 1: Modern networks can contain several components for allowing data

and resource sharing.

1.3 Disadvantages of Computer Networks

Following are some of the major disadvantages of computer networks.

Security Issues: One of the major drawbacks of computer networks is the

security issues involved. If a computer is a standalone, physical access

becomes necessary for any kind of data theft. However, if a computer is on a

network, a computer hacker can get unauthorized access by using different

tools. In case of big organizations, various network security software are used

to prevent the theft of any confidential and classified data.

Rapid Spread of Computer Viruses: If any computer system in a

network gets affected by computer virus, there is a possible threat of other

systems getting affected too. Viruses get spread on a network easily because

Page 11: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 5

of the interconnectivity of workstations. Such spread can be dangerous if the

computers have important database which can get corrupted by the virus.

Expensive Set Up: The initial set up cost of a computer network can be

high depending on the number of computers to be connected. Costly devices

like routers, switches, hubs, etc., can add up to the bills of a person trying to

install a computer network. He will also have to buy NICs (Network Interface

Cards) for each of the workstations, in case they are not inbuilt.

Dependency on the Main File Server: In case the main File Server of

a computer network breaks down, the system becomes useless. In case of big

networks, the File Server should be a powerful computer, which often makes

it expensive.

2- Network Components:

Network components are used to connect devices on different networks,

to create and connect multiple networks or subnets. The components include:

NIC: (Network Interface Card) is used to enable a network device, such as

a computer or other network equipment, to connect to a network.

Repeater: A repeater is an inexpensive solution that is at the OSI physical

layer and enables a network to reach users in distant portions of a building.A

repeater connects two or more cable segments and retransmits any incoming

signal to all other segments.

Hubs or Switches: A hub is a central network device that connects

network nodes such as workstation and servers in a star topology. A hub

may also be referred to as a concentrator, which is a device that can have

multiple inputs and outputs all active at one time.

Page 12: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 6

Bridge: A bridge is a network device that sends information between two

LANs.

Router: Routers are devices that direct traffic between hosts.

Servers: A computer or device on a network that manages network

resources. There are many different types of servers such as File server,

Print server, Database server.

3- Data Communication

Data communication is the exchange of data (in the form of 0s and 1s)

between two devices via some form of transmission medium (wire or wireless).

The effectiveness of a data communication system depends on three fundamental

characteristics, as illustrated in below:

1- Delivery: the system must deliver data to the correct destination.

2- Accuracy: the system must deliver data accurately.

3- Timeliness: the system must deliver data in a timely manner. Data delivered

late are useless. In case of video, audio and voice data, timely delivery mean

delivering data as they are produced.

Page 13: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 7

3.1 Data Communication Components

A data communication system is made up of five components, they are:

Message, sender, receiver, medium, protocols

Message: the message is the information (data) to be communicated. It can

consist of text, numbers, pictures, sound, or video, etc…

Sender: the sender is the device that sends the data message. It can be

computer, workstation, telephone handset, video camera, and so on.

Receiver: the receiver is the device that receives the data message. It can be

computer, workstation, telephone handset, television, and so on.

Medium: the transmission medium is the physical path by which a message

travels from sender to receiver. It can consist of twisted pair wire, coaxial

cable, fiber optic cable, laser, or radio waves (satellite micro wave).

Protocol: is a set of rules that govern data communication. It represents an

agreement between the communicating devices. Without a protocol, two

devices may be connected but not communicating.

Page 14: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 8

3.2 Data Flow

Communication between two devices can be simplex, half-duplex, or full-

duplex as shown in Figure

Figure 2: Data flow (A-Simplex, B-Half-Duplex, C-Full-Duplex)

A- Simplex:

In simplex mode, the communication is unidirectional, as on a one-way street.

Only one of the two devices on a link can transmit; the other can only receive.

Keyboards and traditional monitors are examples of simplex devices. The

keyboard can only introduce input; the monitor can only accept output.

Page 15: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 9

B- Half-Duplex

In half-duplex mode, each station can both transmit and receive, but not at the

same time. When one device is sending, the other can only receive, and vice versa.

C- Full-Duplex

In full-duplex (called duplex), both stations can transmit and receive

simultaneously. The full-duplex mode is like a two-way street with traffic flowing

in both directions at the same time. One common example of full-duplex

communication is the telephone network. When two people are communicating by

a telephone line, both can talk and listen at the same time. The capacity of the

channel, however, must be divided between the two directions.

Page 16: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 10

Network Bandwidth and Throughput

Bandwidth: Number of bits per second that can be sent by a device across a

particular transmission medium.

Throughput is how many bits are actually transferred between two computers in a

given time.

Two points to consider when comparing throughput to bandwidth:

- Throughput rate may vary over time due to network conditions; bandwidth

does not vary over time.

- Bandwidth defines the speed of a single link; throughput measures the speed

of the end-to-end connection.

- Examples of Throughput

Page 17: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 11

Factors that affect Throughput

1- Speed and current workload of the computers.

2- Analog limitation.

2- Multi-User considerations.

3- Congestion level in the network.

Calculating Data Transfer Time: Two Methods

Calculating Data Transfer Time: Four Examples from the “Examples of

Throughput” figure

Page 18: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter One: Network Introduction Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 12

4- Network Criteria

A network must be able to meet a certain number of criteria. The most

important of these are performance, reliability, and security.

1- Performance

Can be measured in many ways, including transit time and response time.

Transit time is the amount of time required for a message to travel from one

device to another. Response time is the time between inquiry and a response. The

performance of a network depends on a number of factors, including:

* Number of users: having a large number of concurrent users can slow

response time in a network not designed to coordinate heavy traffic loads.

* Type of transmission medium: the medium defines the speed at which data

can travel through a connection (the data rate). (i.e. 10 mbps, 100 mbps, 1000

mbps, 10000 mbps).

* Hardware: the types of hardware included in a network affect both the speed

and capacity of transmission.

* Software: the software used to process data at the sender, receiver, and

intermediate nodes also affects network performance.

2- Reliability

Measured by frequency of failure, the time it takes a link to recover from a

failure, and the network’s robustness in catastrophe.

3- Security

Network security issues include protecting data from unauthorized access,

protecting data from damage and development, and implementing policies and

procedures for recovery from breaches and data losses.

Page 19: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 13

Chapter Two

Networking Basics

2.1 Network

A network is a set of devices (often referred to as nodes) connected by

communication links. A node can be a computer, printer, or any other devices

capable of sending and/or receiving data generated by other nodes on the network.

2.2 Network Categories

All networks consist of the same three basic elements, as follows:

• Protocols: A protocol is a set of rules or standards designed to enable

computers to connect with one another and to exchange information with

as little error as possible.

• Transmission media: media that enable all networking elements to

interconnect.

• Network services: resources that are shared with all network users.

2.2. A: [Depending on Architecture of the network operating system software]

There are two main types of network are:

• Peer-to-Peer Networks

• Client-Server Networks

In a peer-to-peer network, the connected computers have no centralized

authority. From an authority viewpoint, all of these computers are equal. In other

words, they are peers. If a user of one computer wants access to a resource on

another computer, the security check for access rights is the responsibility of the

computer holding the resource.

Page 20: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 14

Each computer in a peer-to-peer network can be both a client that requests

resources and a server that provides resources. This is a great arrangement,

provided the following conditions are met:

Each user is responsible for local backup.

Security considerations are minimal.

A limited number of computers are involved.

Peer-to-peer networks present some challenges. For example, if you have a

large business with hundreds of computers, it could take a long time to locate the

file you need. Also, it can be difficult to remember where you stored a file. Finally,

because security is not centralized, users and passwords must be maintained

separately on each machine. Passwords may be different for the same users on

different machines.

This type of network is usually associated with smaller businesses where

security is not an issue.

Figure 1: A peer-to-peer network

In a Client-Server Networks, uses a network operating system designed to

manage the entire network from a centralized point, which is the server. Clients

make requests of the server, and the server responds with the information or access

to a resource.

Page 21: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 15

Client/server networks have some definite advantages over peer-to-peer

networks. For one thing, the network is much more organized. It is easier to find

files and resources because they are stored on the server. Also, client/server

networks generally have much tighter security. All usernames and passwords are

stored in the same database (on the server). You would not have to enter a separate

password for each document that you want to access – making much more efficient

use of your time. Finally, client/server networks have better performance than a

peer to peer network.

Client-server networks are usually found in larger businesses where security is

an issue. However, a client-server network can also work for your small business.

Figure 2: A Client-Server Network

2.2. B: [Depending on the Size (Area)]

One way to characterize networks is according to their size (Area). Two well

Known examples are LANs (Local Area Networks) and WANs (Wide Area

Networks). Other networks are classified as MANs (Metropolitan Area Networks).

Page 22: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 16

Figure 3: Network classification according to type of size or area

1-Local Area Network (LAN)

A local area network (LAN) is usually privately owned and links the devices

in a single office, building, or campus (see Figure 4). Depending on the needs of an

organization and the type of technology used, a LAN can be as simple as two PCs

and a printer in someone's home office; or it can extend throughout a company and

include audio and video peripherals. Currently, LAN size is limited to a few

kilometers.

The first LAN was limited to a range (from a central point to the most distant

computer) of 185 meters (about 600 feet) and no more than 30 computers. Today’s

technology allows a larger LAN, but practical administration limitations require

dividing it into small, logical areas called workgroups. A workgroup is a collection

of individuals (a sales department, for example) who share the same files and

databases over the LAN.

Page 23: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 17

Figure 4: A small LAN network

2-Metropolitan Area Networks (MAN)

A metropolitan area network (MAN) is a network with a size between a LAN

and a WAN. It normally covers the area inside a town or a city.. It may be a single

network such as a cable television network, or it may be a means of connecting a

number of LAN into a larger network so that resources may be shared LAN-to-

LAN as well as device-to-device. For example, a company can use a MAN to

connect the LANs in all of its offices throughout a city. Another example is the

cable TV network that originally was designed for cable TV.

Page 24: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 18

Figure 5: Metropolitan area network (MAN)

3- Wide Area Network (WAN)

A wide area network (WAN) provides long-distance transmission of data,

image, audio, and video information over large geographic areas that may

comprise a country, a continent, or even the whole world.

A WAN is any network that crosses metropolitan, regional, or national

boundaries. Most networking professionals define a WAN as any network that uses

routers and public network links. The Internet is actually a specific type of WAN.

The Internet is a collection of networks that are interconnected and, therefore, is

technically an internetwork (Internet is short for the word 'International network').

A WAN can be centralized or distributed. A centralized WAN consists of a central

computer (at a central site) to which other computers and dumb terminals connect.

The Internet, on the other hand, consists of many interconnected computers in

many locations. Thus, it is a distributed WAN.

Page 25: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 19

Figure 6: Wide Area Network (WAN)

WANs differ from LANs in the following ways:

WANs cover greater distances.

WAN speeds are slower.

WANs can use public or private network transports; LAN primarily use

private network transports.

Page 26: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 20

2.3- Network Topologies

Network topology is the layout pattern of interconnections of the various

elements (links, nodes, etc.) of a computer network. Network topologies may be

physical or logical.

Physical topology means the physical design of a network including the

devices, location and cable installation.

Logical topology is the way that the signals act on the network media, or the

way that the data passes through the network from one device to the next without

regard to the physical interconnection of the devices.

2.3.1 Type of Connection

A network is two or more devices connected through links. A link is a

communications pathway that transfers data from one device to another. For

communication to occur, two devices must be connected in some way to the same

link at the same time. There are two possible types of connections: point-to-point

and multipoint.

1. Point-to-Point

A point-to-point connection provides a dedicated link between two devices.

Point-to-point networks consist of many connections between individual pairs of

machines. To go from the source to the destination, a data on this type of network

may have to first visit one or more intermediate machines.

2. Multipoint (Broadcast)

A multipoint (Broadcast) has a single communication channel that is shared

by all the machines on the network. In Broadcast, the data sent by any machine is

received by all the others.

Page 27: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 21

2.3.2 Basic Network Topology Types

2.3.2. A- Physical Topology

A topology is basically a map of a network. The physical topology of a

network describes the layout of the cables and workstations and the location of all

network components.

There are four basic topologies possible: mesh, star, bus, and ring. Each

topology has its advantages and drawbacks. You should balance the following

considerations when choosing a physical topology for your network:

Cost.

Ease of installation.

Ease of maintenance.

Cable fault tolerance.

Figure 7: Category of network topology

2.3.2. A.1- Mesh Topology

In a mesh topology, every device has a dedicated point-to-point link to every

other device. The term dedicated means that the link carries traffic only between

the two devices it connects. To find the number of physical links in a fully

connected mesh network with n nodes, we first consider that each node must be

Page 28: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 22

connected to every other node. Node 1 must be connected to n – 1 nodes, node 2

must be connected to n – 1 nodes, and finally node n must be connected to n - 1

nodes. We need n(n - 1) physical links. However, if each physical link allows

communication in both directions (Full Duplex mode), we can divide the number

of links by 2. In other words, we can say that in a mesh topology, we need

n(n -1) /2

duplex-mode links.

To accommodate that many links, every device on the network must have n – 1

input/output (IO) ports (see Figure 8) to be connected to the other n - 1 stations.

Figure 8: A fully connected mesh topology

A mesh offers several advantages over other network topologies:

The use of dedicated links guarantees that each connection can carry its own data

load, robust, privacy or security, fault identification and fault isolation easy.

The main disadvantages of a mesh are related to the amount of cabling and

the number of I/O ports required.

Page 29: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 23

One practical example of a mesh topology is the connection of telephone

regional offices in which each regional office needs to be connected to every other

regional office.

2.3.2. A.2- Star Topology

In a star topology, each device has a dedicated point-to-point link only to a

central controller, usually called a hub. The devices are not directly linked to one

another. Unlike a mesh topology, a star topology does not allow direct traffic

between devices. The controller acts as an exchange: If one device wants to send

data to another, it sends the data to the controller, which then relays the data to the

other connected device (see Figure 9).

Figure 9: A star topology connecting

Advantages of this topology:

1- A star topology is less expensive than a mesh topology.

2- It easy to install and reconfigure.

3- Include robustness. If one link fails, only that link is affected. All other links

remain active.

4- Easy fault identification and fault isolation.

Disadvantages: If the hub (or centralized connection point) malfunctions, the

entire network can fail.

Page 30: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 24

2.3.2. A.3- Bus Topology

The preceding examples all describe point-to-point connections. A bus

topology, on the other hand, is multipoint. Bus topology networks require that all

computers, or nodes, connect to the same cable. When a computer sends data, that

data is broadcast to all nodes on the network. (see Figure 10).

Figure 10: A bus topology connecting

Advantages of a bus topology include ease of installation. It uses less cabling

than mesh or star topologies.

Disadvantages: It can therefore be difficult to add new devices. In addition, a

fault or break in the bus cable stops all transmission.

2.3.2. A.4- Ring Topology

Ring topologies do not have a central connection point. Instead, a cable

connects one node to another. When a node sends a message, the message is

processed by each computer in the ring. If a computer is not the destination node, it

will pass the message to the next node, until the message arrives at its destination.

If the message is not accepted by any node on the network, it will travel around the

entire ring and return to the sender (see Figure 11).

Page 31: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 25

Figure 11: A ring topology connecting

The advantages of this topology:

1. easy to install and reconfigure.

2. To add or delete a device requires changing only two connections.

3. Fault isolation is simplified.

The disadvantages of this topology

Unidirectional traffic can be a disadvantage. In a simple ring, a break in the

ring (such as a disabled station) can disable the entire network. This weakness can

be solved by using a dual ring or a switch capable of closing off the break.

2.3.2. A.5- Hybrid Topology

Larger networks combine the bus, star and ring topologies. This combination

allows expansion even in enterprise networks. Two common examples are star ring

and star bus.

Page 32: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 26

2.3.2. B. Logical topology (also referred to as signal topology)

A logical topology defines the logical layout of a network. This specifies how

the elements in the network communicate with each other and how information is

transmitted. Logical topologies are bound to network protocols and describe how

data is moved across the network.

The two main logical topologies are Shared Media and Token Passing

topology. These are each associated with different types of media-access methods,

which determine how a node gets to transmit information along the network.

2.3.2. B.1- Shared Media

In a shared media topology, all the systems have the ability to access the

physical layout whenever they need it. The main advantage in a shared media

topology is that the systems have unrestricted access to the physical media. But,

the main disadvantage to this topology is collisions. If two systems send

information out on the wire at the same time, the packets collide and kill both

packets. Ethernet is an example of a shared media topology. To help avoid the

collision problem, Ethernet uses a protocol called Carrier Sense Multiple

Access/Collision Detection (CSMA/CD). CSMA/CD is the method used in

Ethernet networks for controlling access to the physical media by network nodes.

CSMA/CD process can be described as follows: Listen to see whether the wire is

being used.

• If the wire is busy, wait.

• If the wire is quiet, send.

• If a collision occurs while sending, stop wait a specific amount of time, and

send again.

Page 33: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 27

Figure 13: CSMA/CD Process

2.3.2. B.2- Token Passing

The Token Passing topology works by using a token to provide access to the

physical media. In a Token Passing network, there is a token that travels around

the network. When a system needs to send out packets, it grabs يمسك( \)يستولي the

token off of the wire, attaches it to the packets that are sent, and sends it back out

on the wire. As the token travels around the network, each system examines the

token. When the packets arrive at the destination systems, those systems copy the

information off of the wire and the token continues its journey until it gets back to

the sender. When the sender receives the token back, it pulls )يسكب( the token off

of the wire and sends out a new empty token to be used by the next machine.

Token Passing networks do not have the same collision problems that Ethernet-

based networks do because of the need to have possession )تسكتبو( of the token to

communicate. However, one problem that does occur with Token Passing

networks is latency االنتظكر( \)التأخير . Because each machine has to wait until it can

use the token, there is often a delay in when communications actually occur. Token

Page 34: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Two: Networking Basics Computer Networks

Assistant lecturer Mohammad Hassan Husain Page 28

Passing network are typically configured in physical ring topology because the

token needs to be delivered back to the originating machine for it to release. The

ring topology best facilitates this requirement.

Figure 14: Token Ring Network

Page 35: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 29

Chapter Three

Transmission Media

3.1 Transmission Media

To transmit data, a medium must exist, usually in the form of cables or

wireless methods. A transmission medium can be broadly defined as anything

that can carry information from a source to a destination. The transmission medium

is usually free space, metallic cable, or fiber-optic cable. The information is usually

a signal that is the result of a conversion of data from another form. In

telecommunications, transmission media can be divided into two broad categories:

guided and unguided. Guided media include twisted-pair cable, coaxial cable, and

fiber-optic cable. Unguided medium is free space.

3.1.1 Unguided Media

Unguided media (free space) transport electromagnetic waves without the use

of a physical conductor. Wireless waves can be classified as radio waves,

microwaves, or infrared waves. Radio waves are omnidirectional; microwaves

are unidirectional. Microwaves are used for cellular phone, satellite, and wireless

LAN communications. Infrared waves are used for short-range communications

such as those between a PC and a peripheral device.

Page 36: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 30

3.1.2 Guided Media

Guided media, which are those that provide a conduit from one device to

another, include twisted-pair cable, coaxial cable, and fiber-optic cable. The type

of cable chosen for a network is related to the network's location, data rate, cost

and distance. A signal traveling along any of these media is directed and contained

by the physical limits of the medium. Twisted-pair and coaxial cable use metallic

(copper) conductors that accept and transport signals in the form of electric current.

Optical fiber is a cable that accepts and transports signals in the form of light.

3.1.2.1. Twisted-Pair Cable

This cable type is the most common today. It is popular for several reasons:

It’s cheaper than other types of cabling.

It’s easy to work with.

Twisted-pair cable is available in two basic types:

1. Shielded twisted-pair (STP): Shielded twisted-pair copper wire is

protected from external electromagnetic interference by a metal sheath

wrapped around the wires; STP is harder to install and maintain than UTP.

Page 37: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 31

2. Unshielded twisted-pair (UTP): Unshielded twisted-pair cable is the most

common type of twisted-pair wiring; it is less expensive than STP, but it is

less secure and is prone to electromagnetic interference.

The most common UTP connector is Registered Jack-45. RJ-45 connectors

are commonly used on certain types of Ethernet and token-ring networks. The

connector holds up to eight wires, and is used with twisted-pair wire. To attach an

RJ-45 connector to a cable, the connector must be crimped using a tool called a

crimper.

Most telephones connect with an RJ-11 connector. The RJ-11 has four wires

or two pairs).

Page 38: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 32

The EIA/TIA (Electronic Industry Association/Telecommunication Industry

Association) has established standards of UTP and rated six categories of wire

3.1.2.2. Coaxial Cable

Coaxial cable, known as coax (pronounced "co-axe"), is a high-capacity cable

used for video and communication networks. Coaxial cable has remained in

common networking use because cable companies are often a preferred choice for

high-speed Internet access. Coaxial cable contains a signal wire at the center,

surrounded by a metallic shield that serves as a ground. The shield is either braided

or solid, and is wrapped in plastic.

Coaxial cables are categorized by their Radio Guide (RG) ratings. Each RG

number denotes a unique set of physical specifications.

Page 39: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 33

To connect coaxial cable to devices, we need coaxial connectors. The most

common type of connector used today is the Bayonet Neil-Concelman (BNC).

3.1.2.3. Fiber-Optic Cable

Fiber optic cables consist of two small glass strands: One strand sends and one

receives. These strands are called the core. Each core is surrounded by glass

cladding. Each core and cladding element is wrapped with a plastic reinforced with

Kevlar fibers. Laser transmitters send the modulated light pulses and optical

receivers receive them.

Fiber optic cable can accommodate data transmissions much faster than

coaxial or twisted-pair cable. Fiber optic lines can transmit data in the gigabits per

second range. Because they send data as pulses of light over threads of glass, the

transmissions can travel for miles without a signal degradation. No electrical

signals are carried over the fiber optic line, so the lines are free of electromagnetic

interference and are extremely difficult to tap.

Page 40: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 34

Following are the two major types of fiber optic cable:

Single-mode: uses a specific light wavelength. The cable's core diameter

is 8 to 10 microns. It permits signal transmission at extremely high bandwidth and

allows very long transmission distances (up to 70 km, or 43 miles). Single mode

fiber is often used for intercity telephone trunks and video applications.

Multi-mode: uses a large number of frequencies (or modes). The cable's

core is larger than that of single-mode fiber, usually 50 microns to 100 microns,

and it allows for the use of inexpensive light sources. It is used for short to medium

distances (less than 200 m, or 656 feet). Multi-mode fiber is the type usually

specified for LANs and WANs.

Page 41: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Three: Transmission Media Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 35

Fiber optic cable is expensive, and installation can be tedious and costly.

Attaching connectors to fibers used to involve a tedious process of cutting and

polishing the ends of the glass strands, and then mounting them into the

connectors. Modern tools and newer connectors cut and polish in one step.

Page 42: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 36

Chapter Four

The OSI and TCP/IP Models

Reference Model

We have discussed layered networks; it is time to look at some examples. In

the next two sections we will discuss two important network architectures, the OSI

reference model and the TCP/IP reference model.

4.1. The OSI Reference Model

In the last 1970s the International Standards Organization (ISO) adopted

the Open System Interconnection (OSI) model. The OSI model breaks down the

many tasks involved in moving data from one host to another. The OSI are divided

into seven smaller group, the seven groups are called layers.

Figure 4.1: The OSI model

An open system is a set of protocols that allows any two different systems to

communicate regardless of their underlying architecture. The purpose of the OSI

model is to show how to facilitate communication between different systems

without requiring changes to the logic of the underlying hardware and software.

The OSI model is not a protocol; it is a model for understanding and designing a

network architecture that is flexible, robust, and interoperable.

Page 43: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 37

4.1.1 Data encapsulation

When the source host sends data to destination host, the application data is

sent down by source host through the layers in protocol stack. Each layer adds a

control information as a header to the data and may be add a trailer to the data.

This control information added to the data called Protocol Data Unit (PDU), and

the process of adding the PDU to the data (encoding data with PDU) called

encapsulation. On other hand, the process of extracting the data from PDU by the

destination host (decoding data from PDU) in the specific layer that corresponds to

the same layer in source host is called de-encapsulation. Figure 4.2 shows us the

data encapsulation for OSI layers.

Page 44: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 38

Figure 4.2: Data Encapsulation

The above figure shows the data encapsulation for physical layer is called

Bits, the data encapsulation in data-link layer is called Frame, whereas the data

encapsulation in network layer is called Packet or Datagram, and the data

encapsulation for Transport layer is called Segment.

Page 45: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 39

4.1.2 Layers in the OSI Model

In this section we briefly describe the functions of each layer in the OSI model.

4.1.2.1The Application Layer (layer 7)

The application layer enables the user, whether human or software, to access

the network. It provides user interfaces and support for services such as electronic

mail, remote file access and transfer, shared database management, and other types

of distributed information services. Specific services provided by the application

layer include the following:

File transfer, access, and management (FTAM): This application allows a

user to access files in a remote host (to make changes or read data), to retrieve

files from a remote computer for use in the local computer, and to manage or

control files in a remote computer locally.

E-mail services: This application provides the basis for e-mail forwarding

and storage.

4.1.2.2 The Presentation Layer (layer 6)

The presentation layer is concerned with the syntax and semantics of the

information exchanged between two systems. The primary job of the Presentation

layer is to ensure that the message gets transmitted in a language or syntax that the

receiving computer can understand. Specific responsibilities of the presentation

layer include the following:

Encryption: To carry sensitive information a system must be able to assure

privacy. Encryption means that the sender transforms the original

information to another form and sends the resulting message out over the

Page 46: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 40

network. Decryption reverses the original process to transform the message

back to its original form.

Compression: Data compression reduces the number of bits contained in the

information. Data compression becomes particularly important in the

transmission of multimedia such as text, audio, and video.

4.1.2.3 The Session Layer (layer 5)

The session layer allows users on different machines to establish sessions

between them, that’s mean the session layer allows two systems to enter into a

dialog. The session layer can allow traffic to go in both directions at the same time

(Full-Duplex), or in only one direction at a time (Half-Duplex).

4.1.2.4 The Transport Layer (layer 4)

The basic function of the transport layer is to accept data from the session

layer, split it up into smaller units if need be, pass these to the network layer, and

ensure that the pieces all arrive correctly at the other end. The transport layer

ensures that the whole message arrives intact and in order, overseeing both error

control and flow control at the source-to-destination level.

4.1.2.5 The Network Layer (layer 3)

The Network layer is responsible for the source-to-destination delivery of a

packet, possibly across multiple networks (links). It ensures that each packet gets

from its point of origin to its final destination. In other word, the Network layer is

responsible for routing the packet based on its logical address.

Page 47: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 41

4.1.2.6 The Data-Link Layer (layer 2)

The main task of the data link layer is to take a raw transmission facility and

transform it into a line that appears free of undetected transmission errors to the

network layer. The packet is encapsulated into a frame. The data link layer is

responsible for moving frames from one node to the next. And other

responsibilities of the data link layer include the following:

Framing: The data link layer divides the stream of bits received from the

network layer into manageable data units called frames.

Physical addressing: If frames are to be distributed to different systems on

the network, the data link layer adds a header to the frame to define the

sender and/or receiver of the frame. If the frame is intended for a system

outside the sender's network, the receiver address is the address of the device

that connects the network to the next one.

Flow control: If the rate at which the data are absorbed by the receiver is less

than the rate at which data are produced in the sender, the data link layer

imposes a flow control mechanism to avoid overwhelming the receiver.

Error control: The data link layer adds reliability to the physical layer by

adding mechanisms to detect and retransmit damaged or lost frames. It also

uses a mechanism to recognize duplicate frames. Error control is normally

achieved through a trailer added to the end of the frame.

Access control: When two or more devices are connected to the same link,

data link layer protocols are necessary to determine which device has control

over the link at any given time.

Protocols at this layer aid in the addressing and error detection of data being

transferred. The Data-Link layer is made up of two sublayers: the Logical Link

Control (LLC) sublayer and the Media Access Control (MAC) sublayer. Each

Page 48: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 42

sublayer provides its own services. The LLC sublayer is the interface between

Network layer protocols and the media access method, for example, Ethernet or

Token Ring. The MAC sublayer handles the connection to the physical media,

such as twisted-pair or coaxial cabling.

4.1.2.7 The Physical Layer (layer 1)

The physical layer coordinates the functions required to carry a bit stream

over a physical medium. It deals with the mechanical and electrical specifications

of the interface and transmission media. It also defines the procedures and

functions that physical devices and interfaces have to perform for transmission to

occur. The physical layer is also concerned with the following:

Physical characteristics of interfaces and media: The physical layer

defines the characteristics of the interface between the devices and the

transmission media. It also defines the type of transmission media (see

Chapter 3).

Representation of bits: The physical layer data consists of a stream of bits

(sequence of 0s or 1s) with no interpretation. To be transmitted, bits must be

encoded into signals (electrical or optical). The physical layer defines the

type of encoding (how 0s and 1s are changed to signals).

Data Rate: The transmission rate (the number of bits sent each second) is

also defined by the physical layer. In other words, the physical layer defines

the duration of a bit, which is how long it lasts.

Line Configuration: The physical layer is concerned with the connection of

devices to the media. In a point-to-point configuration, two devices are

connected together through a dedicated link. In a multipoint configuration, a

link is shared between several devices.

Page 49: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 43

Physical Topology: The physical topology defines how devices are

connected to make a network. Devices can be connected using a mesh

topology (every device connected to every other device), a star topology

(devices are connected through a central device), a ring topology (each

device is connected to the next, forming a ring), or a bus topology (every

device on a common link).

Transmission Mode: The physical layer also defines the direction of

transmission between two devices: simplex, half-duplex, or full-duplex.

Page 50: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 44

4.2. The TCP/IP Reference Model

TCP/IP is a set of protocols that enable communication between computers.

The TCP/IP protocol is the most widely used. Part of the reason is that TCP/IP is

the protocol of choice on the Internet. Another reason for TCP/IP’s popularity is

that it is compatible with almost every computer in the world. The TCP/IP stack is

supported by current versions of all the major operating systems and network

operating systems.

TCP/IP was developed using the Department of Defense (DoD) reference

model.

Figure (4.3) TCP/IP and OSI model

Page 51: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 45

Figure (4.4): The TCP/IP Protocols

Figure (4.5): The TCP/IP Addressing

Page 52: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 46

4.2.1 Layers in the TCP/IP Model

In this section we briefly describe the protocols of each layer in the TCP/IP model.

4.2.1.1 The Application Layer (layer 4)

The application layer generates the data to be sent over the network and

processes the corresponding data received over the network. It contains all the

higher-level protocols such as virtual terminal (TELNET), File Transfer Protocol

(FTP), Simple Mail Transfer Protocol (SMTP), Dynamic Host Configuration

Protocol (DHCP), Domain Name System (DNS) and Hypertext Transfer Protocol

(HTTP).

The TELNET Protocol allows a user on one machine to log into a distant

machine and work there.

The FTP is the protocol that defines how a file can be transferred from one

host to another.

The SMTP protocol is used to send mail across the internet.

The DHCP protocol enables host systems in a TCP/IP network to be

configured automatically for the network as they boot.

The DNS protocol is the Internet’s mechanism for linking all the host names

and IP addresses on the Internet. All the URLs (Uniform Resource Locator)

that you need to get resolution for on the Internet are in a DNS database

somewhere.

Page 53: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 47

The HTTP protocol is a set of rules for exchanging files on the Internet. This

is the protocol that your Web browser uses when surfing (تتصفح) the Internet.

4.2.1.2 The Transport Layer (layer 3)

The protocols at the Transport layer deliver data to and receive data from the

Transport layer protocols of other hosts. The Transport layer of the TCP/IP

protocol suite consists of only two protocols, Transmission Control Protocol (TCP)

and User Datagram Protocol (UDP).

Transmission Control Protocol (TCP)

TCP protocol provides connection-oriented, reliable communication.

Connection-oriented means that allow a data stream originating on one machine

to be delivered without error on any other machine in the internet. Reliable means

that an acknowledgment will be sent back to the sending host throughout the

communication to verify receipt of the packets.

TCP is slower and typically used for transferring large amounts of data to

ensure that the data won’t have to be sent again.

TCP is used for many applications such as FTP, HTTP, and SMTP etc.

Page 54: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 48

User Datagram Protocol (UDP)

User Datagram Protocol (UDP) is the protocol used at the Transport layer for

connectionless, non-guaranteed communication. Connectionless means that the

communication that occurs without a connection first being set up. Unlike TCP,

UDP do not set up a connection and do not use acknowledgments.

UDP is an unreliable, "unreliable" merely means that there are no techniques

in the protocol for verifying that the data reached the other end of the network

correctly.

UDP is faster and typically used for transferring small amounts of data.

4.2.1.3 The Internet Layer (layer 2)

The Internet layer contains the protocols that are responsible for addressing

and routing of packets (The process of determining which is the next path to send a

packet so that it gets to its destination is called routing). The Internet layer contains

several protocols, including:

Internet Protocol (IP)

The Internet Protocol (IP) is the primary protocol at the Internet layer of the

TCP/IP stack. IP is responsible for:

IP addressing: The IP addressing conventions are part of the IP protocol.

Host-to-Host communications: IP determines the path a packet must take,

based on the receiving host’s IP address.

Packet formatting: IP assembles data into units known as IP datagrams or

packets.

Fragmentation: If a datagram is too large for transmission over the network

media, IP on the sending host breaks the datagram into smaller fragments

Page 55: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 49

(packets). IP on the receiving host then reconstructs the fragments (packets)

into the original datagram.

Address Resolution Protocol (ARP).

Address Resolution Protocol (ARP) is a protocol used for resolution of

network layer addresses into data-link layer address, that’s mean it’s used to

convert an IP address to a physical address (mac address). ARP protocol

assists IP in directing packet to the appropriate receiving host by mapping

MAC addresses (48 bits long) to known IP addresses (32 bits long).

Reverse Address Resolution Protocol (RARP).

The protocol which asks for translation from an IP address to a hardware

address is called an ARP, while the reversal protocol for translating

hardware addresses to IP addresses is called Reverse Address Resolution

Protocol (RARP).

Internet Control Message Protocol (ICMP)

This protocol is part of the Internet Layer and uses the IP datagram

delivery facility to send its messages. It is used for checking remote hosts.

The ping and traceroute commands use this message.

Internet Group Message Protocol (IGMP)

IGMP is a protocol that enables one host to send one stream of data to

many hosts at the same time.

Page 56: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 50

4.2.1.4 The Network Access Layer (layer 1)

The Network Access layer, also called the network interface layer, is the

lowest layer of the TCP/IP protocol hierarchy. The protocols in this layer provide

the means for the system to deliver data to the other devices on a directly attached

network. The access layer is also responsible for retransmissions of packets

received in error over the link.

Figure (4.6): Communication at the networks

Page 57: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 51

4.2.2 Header Formats of the Protocols

The PDU for each layer in TCP/IP is explained in the data encapsulation. This

section explains the related headers for each layer used in the proposed project.

4.2.2.1 Ethernet Frame Format

The Ethernet frame size is 1518 bytes. The Ethernet frame consist of three

parts as shown in Figure (4.7), which are the header, payload, and trailer

Figure (4.7): Ethernet frame format

The first six bytes are a destination MAC address, while the next six bytes

represent the source MAC address, and the frame type that determines the layer 3

protocol, it is represented by the next 2 bytes. After these frame header fields, the

frame payload has a size between 46 bytes to a maximum size for the frame

header, which is 1500 bytes. Finally the frame trailer that contains the cyclic

redundancy check (CRC) field is used for error detection.

Page 58: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 52

4.2.2.2 IP Header Format

The IP header is the first part from the frame payload, if the frame type has

value 0x0800 which represents the IP protocol. The IP header has size 20 bytes if

no option is present. Figure (4.8) shows the IP header format.

Figure (4.8): IP header

The IP header fields are explained below:

VER: The version of IP used, for example 4 for IPV4, 6 for IPV6.

HLEN: Represent the header length in 32-bit words.

Service type: contains an 8-bit binary value that is used to determine the

priority of each packet.

Total Length: contains the total length of the IP datagram in bytes. Because

this entry only has two bytes, the maximum IP datagram length is 65,535 bytes.

Identification: Contains an integer that identifies the current packet.

Page 59: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 53

Flags: Specifies whether fragmentation should occur.

Fragmentation Offset: Indicates the position of the fragment’s data relative to

the beginning of the data in the original datagram. It allows the destination IP

process to properly reconstruct the original packet.

Time to Live: A counter that is decremented by one each time the packet is

forwarded. A packet with 0 in this field is discarded.

Protocol: The upper layer protocol that is the source or destination of the data.

For example, value 1 represents ICMP, 2 for IGMP, 6 for TCP, and 17 for

UDP.

Header Checksum: This field is used to verify the IP header correctness.

Source IP Address: The IP address of the sending host.

Destination IP Address: The IP address of the receiving host.

Options: Used for network testing, debugging, security, and more.

A. TCP Header Format

If the protocol type in IP header has value 6, then the packet is a TCP packet.

TCP header has size 20 bytes or 24 with options field. Figure (4.9) shows the TCP

header that comes after IP header

Page 60: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 54

Figure (4.9): TCP header

The TCP header fields are explained below:

Source Port Number: The port number of the source process.

Destination Port Number: The port number of the process running in the

destination host.

Sequence Number: Identifies the byte in the stream of data from the sending

TCP to the receiving TCP. It is the sequence number of the first byte of data in

this segment represents.

Acknowledgement Number: Contains the next sequence number that the

destination host wants to receive.

Hdr Len: The length of the header in 32-bit words.

Reserved: Reserved for future use.

Flags: There are 6 bits for flags in the TCP header, each is used as follows.

URG: If the first bit is set, an urgent message is being carried.

ACK: If the second bit is set, the acknowledgement number is valid.

Page 61: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 55

PSH: If the third bit is set, it is a notification from the sender to the

receiver that the receiver should pass all the data received to the

application as soon as possible.

RST: If the fourth bit is set, it signals a request to reset the TCP

connection.

SYN: The fifth bit of the flag field of the packet is set when initiating a

connection.

FIN: The sixth bit is set to terminate a connection.

Window Size: The maximum number of bytes that a receiver can accept.

TCP Checksum: Covers both the TCP header and TCP data.

Urgent Pointer: This pointer is valid only if the URG flag is set.

B. UDP Header Format

If the protocol type in IP header has value 17, then the packet is a UDP

packet. UDP header has size 8 bytes. Figure (4.10) shows the UDP header that

comes after IP header.

Figure (4.10): UDP header

Page 62: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Four: The OSI and TCP/IP Models Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 56

The UDP header fields are explained below:

Source Port Number: The port number of the source process.

Destination Port Number: The port number of the process running in the

destination host.

Length: Length of UDP header and UDP data.

Checksum: Checksum of both the UDP header and UDP data fields.

Figure (4.11): TCP segment and IP header

HW: Draw the figure of UDP segment and IP header?

Page 63: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 57

Chapter Five

The Addressing of TCP/IP Protocols

Introduction

The identifier used in the IP layer of the TCP/IP protocol suite to identify each

device connected to the Internet is called the Internet address or IP address.

There are two versions of IP the TCP/IP protocol: IP version 4 and IP version 6.

IP version 6 is much more complicated than IP version 4 and is much newer. First, we

will be working with IP version 4 which is the address format of the four digits

separated by full-stops.

5.1. IPv4 Addresses

An IPv4 address is a 32-bit number, usually represented as a four-part decimal

number with each of the four parts separated by a period or decimal point, which

means that the address space is 232

or 4,294,967,296 (more than 4 billion). This

means that, theoretically, if there were no restrictions, more than 4 billion devices

could be connected to the Internet.

There are two prevalent notations to show an IPv4 address: Binary Notation

and Dotted Decimal Notation:

Binary Notation: In binary notation, the IPv4 address is displayed as 32 bits.

Each octet is often referred to as a byte. So it is common to hear an IPv4

address referred to as a 32-bit address or a 4-byte address. The following is an

example of an IPv4 address in binary notation:

01110101 10010101 00011101 00000010

Page 64: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 58

Dotted-Decimal Notation: To make the IPv4 address more compact and easier

to read, Internet addresses are usually written in decimal form with a decimal

point (dot) separating the bytes. The following is the Dotted-Decimal notation

of the above address:

An IP address has two parts:

Network

Host (also known as local or node)

Each network has an Internet address. Each network also must know the

address of every other network with which it communicates.

After the network is identified, the specific host or node must be specified. A

unique host address for the particular network is added to the end of the IP address.

5.1.1 IPv4 addresses Classes

The address class determines which part of the address represents the network

bits (N) and which part represents the host bits (H). IP addresses are divided into

five classes:

Class A: Large networks.

Class B: Medium-sized networks.

Class C: Small networks with less than 256 devices.

Class D: Multicasting.

Class E: Reserved.

Page 65: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 59

Only Class A, B, and C addresses are used for addressing devices; Class D is

used for multicast groups, and Class E is reserved for experimental use. All

addresses are placed in a particular class based on the decimal values of their first

octets. In the first octet, an IP address can start with a decimal value between 1 and

255. The system of class addresses has been set up to help ensure assignment of

unique IP addresses. Only classes A, B, and C are available for commercial use.

Figure (5.1): IP Datagram Classes

Table (5.1): IP Address Classes A, B, C, D and E Are Available for Addressing Devices

Class Format Identifiers Range Network Bits Networks Available

Host bits Hosts Available

A N.H.H.H 0 1 to 126 8 [7 bits (first byte)] 126 (27-2) 24 bits (last three bytes) 16,777,214 (224-2)

B N.N.H.H 10 128 to 191 16 [14 bits (first two bytes)] 16,384 (214

) 16 bits (last two bytes) 65,534 (216

-2)

C N.N.N.H 110 192 to 223 24 [21 bits (first three bytes)] 2,079,152 (221) 8 bits (last byte) 254 (28-2)

D - 1110 224 to 239 Ranges from 224.0.0.0 to 239.255.255.255 → (268,435,456)

E - 1111 240 to 255 Reserved → (268,435.456)

All addresses in IPv4 → 4,294,967,296

Addresses in class A → 2,113,928,964

Addresses in class B → 1,073,709,056

Addresses in class C → 528,104,608

Page 66: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 60

Class A

Class A was designed for very large networks only. Since only 1 byte in class A

defines the Netid and the leftmost bit should be 0, the next 7 bits can be changed to

find the number of blocks in this class. The class A range of network blocks will be

found:

00000000 = 0

01111111 = 127

Therefore, class A is divided into 126 (27 minus 2) blocks (because some

blocks were reserved as special blocks). However, each block in this class contains

16,777,214 (16,777,216 minus 2) addresses. Many addresses are wasted in this

class. Figure (5.2) shows the block in class A.

Figure (5.2): Blocks in class A

In a Class A network address, the first byte is assigned to the network address

and the three remaining bytes are used for the node addresses. The Class A format

is:

Network.Host.Host.Host

For example, in the IP address 49.22.102.70, the 49 is the network address,

and 22.102.70 is the host address. Every machine on this particular network would

have the distinctive network address of 49.

Page 67: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 61

Class B

Class B was designed for medium-sized networks. Since 2 bytes in class B

define the class and the two leftmost bit should be 10 (fixed), the next 14 bits can

be changed to find the number of blocks in this class. The range of class B network

will be found:

10000000 = 128

10111111 = 191

Therefore, class B is divided into 16,384 (214

) blocks. However, each block in

this class contains 65,534 (65,534 minus 2) addresses. Many addresses are wasted

in this class. Figure (5.4) shows the blocks in class B.

Figure (5.4): Blocks in class B

In a class B network address, the first 2 bytes are assigned to the network

address, and the remaining 2 bytes are used for host addresses. The format is:

Network.Network.Host.Host

For example, in the IP address 172.16.30.56, the network address portion is

172.16, and the host address portion is 30.56.

Class C

Class C was designed for smaller networks. Since 3 bytes in class C define the

class and the three leftmost bits should be 110 (fixed), the next 21 bits can be

changed to find the number of blocks in this class. Here’s the range for a class C

network:

11000000 = 192

11011111 = 223

Page 68: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 62

Therefore, class C is divided into 2,097,152 (221

) blocks, in which each block

contains 254 (256 minus 2) addresses. However, not so many organizations were

so small as to be satisfied with a class C block. Figure (5.5) shows the blocks in

class C.

Figure (5.5): Blocks in class C

The first 3 bytes of a class C network address are dedicated to the network

portion of the address, with only one measly byte remaining for the node address.

The format is:

Network.Network.Network.Host

Using the example IP address 192.168.100.102, the network address is

192.168.100, and the node address is 102.

Class D

Class D is the multicast address range and cannot be used for networks. There

is no network/host structure to these addresses. They are taken as a complete

address and used as destination addresses only, just like broadcast addresses.

Figure (5.6) shows the block.

Figure (5.6): Blocks in class D

Page 69: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 63

The first 4 bits of a class D address must be 1110. The range for a class D

network:

11100000 = 224

11101111 = 239

Thus, class D multicast group addresses are from 224.0.0.0 to

239.255.255.255.

Class E

Class E is reserved for experimental purposes. There is just one block of class E

addresses. It was designed for use as reserved addresses, as shown in Figure (5.7).

Figure (5.7): Blocks in class E

The first 4 bits of a class E address must be 1111. The range for a class E

network:

11110000 = 240

11111111 = 255

Thus, class E ranged is from 240.0.0.0 to 255.255.255.255.

5.1.2 Classless Addressing

To overcome address depletion and give more organizations access to the

Internet, classless addressing was designed and implemented. In this scheme, there

are no classes, but the addresses are still granted in blocks.

Page 70: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 64

Classless Inter-Domain Routing (CIDR) is an IP addressing scheme that was

developed after the class system of A, B, C, D, and E [uses a slash followed by a

number to highlight the network portion of an address instead of using a subnet

mask]. For example:

10.11.3.0/8 Class A

172.16.0.0/16 Class B

192.168.3.8/24 Class C

Other example:

192.168.3.15/26

172.21.165.1/19

The number after the slash is the number of bits that represent the network

portion of the IP address. CIDR was developed to increase the efficiency of

address allocation and to alleviate overloaded Internet routers.

5.2 IPv6 Addresses

IPv6 uses 128-bit or 16 byte addresses, which are exponentially larger than the

address size of IPv4. Therefore, IPv6 supports a number of addresses that is 4

billion times the 4 billion addresses of the IPv4 address space. This works out to

be:

IPv4 addresses (232

): 4,294,967,296

IPv6 addresses (2128

): 40,282,366,920,938,463,463,374,607,431,768,211,456

IPv6 addresses are written in hexadecimal form, it uses A, B, C, D, E, and F to

represent 10, 11, 12, 13, 14, and 15. The decimal 16 is represented in hexadecimal

as 10. The address below is an example of an IPv6 address:

EFDC: BA62:7654:3201: EFDC: BA72:7654:3210

Page 71: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 65

Each section of hex characters represents 2 byte (or 16 bits) of the address. The

concept of class was never used in IPv6.

5.3. Hardware Address

Within every frame of data is a header that contains addressing information.

This header enables the packet to arrive at the correct location. This addressing

information comes from a physical address that is burned into every Network

Interface Card (NIC). NIC is a piece of hardware that is used to connect a host to a

network. When the card is manufactured, this address will not change for the life of

the card. This burned-in address can be called any of the following:

Hardware address

Media Access Control (MAC) address

Ethernet address

Physical address

Network Interface Card (NIC) address

The hardware address is unique to all the network cards ever manufactured. It

is a 12-character hexadecimal address. A hardware address looks similar to this:

00:A0:C9:0F:92:A5

The first six of these hexadecimal characters represent the manufacturer and are

unique to the network card’s manufacturer. The last six characters form a unique

serial number that the card’s manufacturer has assigned to it.

Page 72: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 66

5.4. Subnet Masks

A subnet mask is a 32-bit binary number that can be expressed in either

dotted-decimal or dotted-binary form. A subnet mask is allows the recipient of IP

packets to distinguish the network ID portion of the IP address from the host ID

portion of the IP address. The network administrator creates a 32 bit subnet mask

composed of 1s and 0s. The 1s in the subnet mask represent the positions that refer

to the network or subnet addresses.

Table (5.2) shows concept of a dotted-binary and dotted-decimal equivalents of

subnet masks for the various classes of IP addresses.

Table (5.2) Default Subnet Masks

Address

Class Format

Dotted-Decimal

Form Dotted-Binary Form

Class A N.H.H.H 255.0.0.0 11111111.00000000.00000000.00000000

Class B N.N.H.H 255.255.0.0 11111111.11111111.00000000.00000000

Class C N.N.N.H 255.255.255.0 11111111.11111111.11111111.00000000

Class A, B, and C addresses can be divided into smaller networks, called

subnetworks or subnets, resulting in a larger number of possible networks, each

with fewer host addresses available than the original network. The addresses used

for the subnets are created by borrowing bits from the host field and using them as

subnet bits. A subnet mask indicates which bits have been borrowed.

In other words, the router does not determine the network portion of the

address by looking at the value of the first octet; rather, it looks at the subnet mask

that is associated with the address. In this way, subnet masks let you extend the

usage of an IP address. This is one way of making an IP address a three-level

hierarchy, as shown in Figure (5.8).

Page 73: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 67

Figure (5.8): A Subnet Mask Determines How an IP Address Is Interpreted

Table (5.3) shows the dotted-decimal and dotted-binary forms of subnet masks

that are permissible when it subnet a Class C address. The borrowed bits are

indicated in bold.

Table (5.3) Subnet Masks for C class

Borrowed

Bits IP Address

Dotted-Binary Form Subnet Mask

after subnetting

0 192.168.0.1/24 11111111.11111111.11111111.00000000 255.255.255.0

2 192.168.0.1/26 11111111.11111111.11111111.11000000

255.255.255.192

3 192.168.0.1/27 11111111.11111111.11111111.11100000

255.255.255.224

4 192.168.0.1/28 11111111.11111111.11111111.11110000

255.255.255.240

5 192.168.0.1/29 11111111.11111111.11111111.11111000

255.255.255.248

6 192.168.0.1/30 11111111.11111111.11111111.11111100

255.255.255.252

Page 74: Network lectures mohammad hassan husain محاظرات الشبكات_محمد حسن حسين

Chapter Five: The Addressing of TCP/IP Protocols Computer Networks

Assistant Lecture Mohammad Hassan Husain Page 68

Example: What is the subnet mask of the IP: 128.138.243.0/26 and what is the

range of host?

Solution:

No. of Network bits: 11111111.11111111.11111111.11000000

Subnet mask: 255.255.255.192

No. of host: 1) 256-192=64

2) 26=64

HW: What is the default subnet mask and subnet mask after subnetting of the IP ?

192.168.112.0/21

10.1.1.0/27