Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Lecture 1: Data Communication Network Basis 5.

Encapsulation – process of adding header and


a tail to a data payload to form a new packet.
1970s or 1980s - Communication has been playing an
6. Decapsulation – process of removing the
increasingly important role especially since human
header and the tail from a packet to obtain the
society entered the information era.
data payload.
7. Gateway – network device that provides
functions such as protocols conversions, route
selections, and data exchange
8. Router – network device that a forwarding path
for packets.
9. Terminal Device – end device of a data
communication system, used as a sender or
receiver data.
Concept of the Data Communication Network
Concept of Network Communication
• Data communication network:
• Communication refers to the information Communication network that consists of
transfer and exchange between people, between routers, switches, firewalls, access controllers
people and things, and between things through (ACs), access points (APs), PCs, network
a certain medium and behavior. printers, and servers
• Network communication refers to • Function: To implement data communication
communication between terminal devices
through a computer network.
Examples:
1. Files are transferred between two
computers (terminals) through a network
cable.
2. Files are transferred among multiple
computers (terminals) through a router.
3. A computer (terminal) downloads files
through the Internet.
Information Transfer Process

• Virtual information transfer is similar to real


object transfer Switches

• Switch: a device closest to end users, used to


access the network and switch data frames
o Network access of terminals (such as
PCs and servers)
o Layer 2 switching

Common Terms
1. Data Payload – information conveyed.
2. Packet – data unit switched and transmitted on
the network.
3. Header – information segment added before
the data payload.
4. Tail – information segment added after the data
payload.
Routers o Implementing network address
translation
• Router: a network-layer device that forwards o Implementing other security functions
data packets on the Internet. Based on the
destination address in a received packet, a
router selects a path to send the packet to the
next router or destination. The last router on the
path is responsible for sending the packet to the
destination host.
o Implementing communication
between networks of
the same type or different types
o Isolating broadcast domains
o Maintaining the routing table and
running
routing protocols
o Selecting routes and forwarding IP
packets
o Implementing WAN access and
network
address translation
o Connecting Layer 2 networks
established through switches

Wireless Devices

Firewalls
LAN, MAN, and WAN
• Firewall: a network security device used to Local Area Networks (LANs)
ensure secure communication between two
networks. It monitors, restricts, and modifies • A LAN is a network that consists of computers,
data flows passing through it to shield servers, and network devices in a geographic
information, structure, and running status of area. The coverage of a LAN is generally within
internal networks from the public network. several thousand square meters.
o Isolating networks of different security • Typical LANs include a company's office
levels network, a cyber bar network, a home network.
o Implementing access control (using
security policies) Metropolitan Area Networks (MANs)
between networks of different security • A MAN is a computer communication network
levels established within a city.
o Implementing user identity • Typical MANs include broadband MANs,
authentication education MANs, and municipal or provincial
o Implementing remote access e-government private lines.
o Supporting data encryption and VPN
services
Wide Area Networks (WANs) Network Engineering

• A WAN generally covers a large geographical • Network engineering refers to planning and
area ranging from tens of square kilometers to designing feasible solutions based on network
thousands of square kilometers. It can connect application requirements and computer
networks of multiple cities or even networks of network system standards, specifications, and
countries (as an international large-scale technologies under the guidance of information
network) and provide long-distance system engineering methods and complete
communication. organizations, as well as integrating computer
• The Internet is a typical WAN. network hardware devices, software, and
technologies to form a cost-effective network
system that meets user requirements.
• Technical modules covered by network
engineering:

Network Topologies

• A network topology is a structured layout


presented using transmission media (such as
twisted pairs and optical fibers) to interconnect
various devices (such as computer terminals,
routers, and switches). • Network Engineer: Network engineers are
technology professionals who master
professional network technologies, have
professional skills, professionalism, and project
implementation experience in the network
engineering field, and are able to fully
communicate with customers or other project
stakeholders onsite. In addition, they can
develop implementation solutions and project
plans (recognized by project stakeholders)
based on customer requirements and
environment factors, fully mobilize resources
of all parties to ensure timely and high-quality
project implementation, and provide training
for stakeholders and deliver engineering
Network Topology Types documents after the project is implemented.
• Comprehensive capability models for network
• Network topologies are classified into star,
engineers
bus, ring, tree, full-mesh, and partial-mesh
network topologies
Network Engineer’s Technology system can be identified by the application
Development Path layer of another system.
7. Application Layer – Provides interfaces for
applications.
TCP/IP Reference Model

• The OSI protocol stack is complex, and the TCP


and IP protocols are widely used in the industry.
Therefore, the TCP/IP reference model
becomes the mainstream reference model of the
Internet.
• The TCP/IP model is similar to the OSI model
Lecture 2: Network Reference Model in structure and adopts a hierarchical
architecture. Adjacent TCP/IP layers are closely
Origin of the Story - Applications related.
• Applications are used to meet various • The standard TCP/IP model combines the data
requirements of people, such as web page link layer and physical layer in the OSI model
access, online gaming, and online video into the network access layer. This division
playback mode is contrary to the actual protocol
• Information is generated along with formulation. Therefore, the equivalent TCP/IP
applications. Texts, pictures, and videos are all model that integrates the TCP/IP standard
information presentation modes. model and the OSI model is proposed. Contents
in the following slides are based on the
Application Implementation – Data equivalent TCP/IP model.
• Data Generation – In computer field, data is
the carrier of all kinds of information.
• Data Transmission – Data generated by most
applications needs to be transmitted between
devices.
OSI Reference Model

• The Open Systems Interconnection Model Common TCP/IP Protocols


(OSI) was included in the ISO 7489 standard
and released in 1984. ISO stands for • The TCP/IP protocol stack defines a series
International Organization for Standardization. of standard protocols.
• The OSI reference model is also called the • Application Layer
seven-layer model. o Hypertext Transfer Protocol
1. Physical Layer - Transmits bitstreams over (HTTP): is used to access various
transmission media and defines electrical and pages on web servers.
physical specifications. o File Transfer Protocol (FTP):
2. Data Link Layer - Encapsulates packets into provides a method for transferring
frames, transmits frames in P2P or P2MP mode, files. It allows data to be
and implements error checking. transferred from one host to
3. Network Layer – Defines logical addresses another.
and transfers data from sources to destinations. o Domain name service (DNS):
4. Transport Layer – Establishes, maintains, and translates from host domain names
cancels an end-to-end data transmission to IP addresses.
process; controls transmission speeds and • Transport layer
adjusts data sequences. o Transmission Control Protocol
5. Session Layer – Establishes, manages, and (TCP): provides reliable
terminates sessions between communicating connection-oriented
parties. communication services for
6. Presentation layer – Translates data formats applications. Currently, TCP is
to ensure that the application-layer data of one used by many popular applications.
o User Datagram Protocol (UDP): promoting Internet protocols
provides connectionless (especially protocols that constitute the
communication and does not TCP/IP protocol suite), and releasing
guarantee the reliability of packet new or replacing old protocol standards
transmission. The reliability can be through RFCs.
ensured by the application layer.
⚫ Institute of Electrical and Electronics
• Network layer
Engineers (IEEE)
o Internet Protocol (IP):
encapsulates transport-layer data o IEEE has formulated about 30% of
into data packets and forwards standards in the electronics, electrical, and
packets from source sites to computer science fields worldwide. Those
destination sites. IP provides a standards include well-known IEEE802.3
connectionless and unreliable (Ethernet) and IEEE802.11 (Wi-Fi).
service.
o Internet Group Management ⚫ International Organization for
Protocol (IGMP): manages Standardization (ISO)
multicast group memberships. o ISO is an international organization that
Specifically, IGMP sets up and plays an important role in the formulation
maintains memberships between IP of computer network standards, such as the
hosts and their directly connected OSI model defined in ISO/IEC 7498-1.
multicast routers.
o Internet Control Message Application Layer
Protocol (ICMP): sends control
• The application layer provides interfaces
messages based on the IP protocol
for application software so that applications
and provides information about
can use network services. The application
various problems that may exist in
layer protocol designates transport layer
the communication environment.
protocols and ports.
Such information helps
• PDUs transmitted at the application layer
administrators diagnose problems
are called data.
and take proper measures to
resolve the problems.
• Data Link Layer
o Point-to-Point Protocol (PPP): is
a data link layer protocol that
works in point-to-point mode. PPP
is mainly used on wide area
networks (WANs).
o Ethernet: is a multi-access and
broadcast protocol at the data link Common Application Layer Protocols – FTP
layer, which is the most widely
• The File Transfer Protocol (FTP) transfers files
used local area network (LAN)
from one host to another to implement file
technology.
download and upload. This protocol adopts the
o Point-to-Point Protocol over
client/server (C/S) structure.
Ethernet (PPPoE): connects
multiple hosts on a network to a
remote access concentrator
through a simple bridge device
(access device). Common
applications include home
broadband dialup access.
Common Protocol Standardization Organizations
⚫ Internet Engineering Task Force (IETF) Common Application Layer Protocols – Telnet
o IETF is a voluntary organization • Telnet is a standard protocol that provides
responsible for developing and remote login services on a network. It provides
users with the ability to operate remote devices o Destination Port: identifies the application
through local PCs. that receives the segment. This field is 16
bits long.
o Sequence Number: Every byte of data sent
over a TCP connection has a sequence
number. The value of the Sequence Number
field equals the sequence number of the
first byte in a sent segment. This field is 32
bits long.
o Acknowledgment Number: indicates the
sequence number of the next segment's first
byte that the receiver is expecting to
receive. The value of this field is 1 plus the
sequence number of the last byte in the
• A user connects to a Telnet server through the
previous segment that is successfully
Telnet client program. The commands entered
received. This field is valid only when the
on the Telnet client are executed on the server,
ACK flag is set. This field is 32 bits long.
as if the commands were entered on the console
o Header Length: indicates the length of the
of the server.
TCP header. The unit is 32 bits (4 bytes). If
Common Application Layer Protocols – HTTP there is no option content, the value of this
field is 5, indicating that the header
• Hypertext Transfer Protocol (HTTP): is one of contains 20 bytes.
the most widely used network protocols on the o Reserved: This field is reserved and must
Internet. HTTP was originally designed to be set to 0. This field is 3 bits long.
provide a method for publishing and receiving o Control Bits: control bits, includes FIN,
HTML pages. ACK, and SYN flags, indicating TCP data
segments in different states.
o Window: used for TCP flow control. The
value is the maximum number of bytes that
are allowed by the receiver. The maximum
window size is 65535 bytes. This field is 16
bits long.
o Checksum: a mandatory field. It is
calculated and stored by the sender and
verified by the receiver. During checksum
computation, the TCP header and TCP data
are included, and a 12-byte pseudo header
Transport Layer is added before the TCP segment. This field
is 16 bits long.
• A transport layer protocol receives data from an
o Urgent: indicates the urgent pointer. The
application layer protocol, encapsulates the data
urgent pointer is valid only when the URG
with the corresponding transport layer protocol
flag is set. The Urgent field indicates that
header, and helps establish an end-to-end (port-
the sender transmits data in emergency
to-port) connection.
mode. The urgent pointer indicates the
• PDUs transmitted at the transport layer are number of urgent data bytes in a segment
called segments. (urgent data is placed at the beginning of
• Transport layer protocols: the segment). This field is 16 bits long.
o TCP: a connection-oriented reliable o Options: This field is optional. This field is
protocol defined by IETF in RFC 793. 0 to 40 bytes long.
o UDP: a simple connectionless protocol • UDP header:
defined by IETF in RFC 768. o Source Port: identifies the application that
TCP and UDP – Header Formats sends the segment. This field is 16 bits long.
o Destination Port: identifies the application
• TCP header: that receives the segment. This field is 16
o Source Port: identifies the application that bits long.
sends the segment. This field is 16 bits long.
o Length: specifies the total length of the no segment has ever been received
UDP header and data. The possible from PC2.
minimum length is 8 bytes because the o After receiving a valid TCP segment
UDP header already occupies 8 bytes. Due with the SYN flag being set, the
to the existence of this field, the total length receiver (PC2) replies with a TCP
of a UDP segment does not exceed 65535 segment with SYN and ACK being set.
bytes (including an 8-byte header and The initial sequence number b is a
65527-byte data). randomly generated number. Because
o Checksum: checksum of the UDP header the segment is a response one to PC1,
and UDP data. This field is 16 bits long. the acknowledgment number is a+1.
o After receiving the TCP segment in
which SYN and ACK are set, PC1
replies with a segment in which ACK is
set, the sequence number is a+1, and
the acknowledgment number is b+1.
After PC2 receives the segment, a TCP
connection is established.

TCP and UDP – Port Numbers

• Generally, the source port used by a client is


randomly allocated, and the destination port is
specified by the application of a server.
• The system generally selects a source port
number that is greater than 1023 and is not TCP Sequence Number and Acknowledgment
being used. Number
• The destination port number is the listening port
• TCP uses the Sequence Number and
of the application (service) enabled on the
Acknowledgment Number fields to implement
server. For example, the default port number for
reliable and ordered data transmission.
HTTP is 80.

TCP Connection Setup – Three-Way Handshake • Assume that PC1 needs to send segments of
data to PC2. The transmission process is as
• Before sending data, a TCP-based application follows:
needs to establish a connection through three- o PC1 numbers each byte to be sent by
way handshake. TCP. Assume that the number of the
• The TCP connection setup process is as first byte is a+1. Then, the number of
follows: the second byte is a+2, the number of
o The TCP connection initiator (PC1 in the third byte is a+3, and so on.
the figure) sends the first TCP segment o PC1 uses the number of the first byte of
with SYN being set. The initial each segment of data as the sequence
sequence number a is a randomly number and sends out the TCP
generated number. The segment.
acknowledgment number is 0 because
o After receiving the TCP segment from disconnect the TCP connection and release
PC1, PC2 needs to acknowledge the system resources.
segment and request the next segment
of data. How is the next segment of
data determined? Sequence number
(a+1) + Payload length = Sequence
number of the first byte of the next
segment (a+1+12)
o After receiving the TCP segment sent
by PC2, PC1 finds that the
acknowledgment number is a+1+12,
indicating that the segments from a+1
to a+12 have been received and the
sequence number of the upcoming • TCP supports data transmission in full-duplex
segment to be sent should be a+1+12. mode, which means that data can be transmitted
• To improve the sending efficiency, multiple in both directions at the same time. Before data
segments of data can be sent at a time by the is transmitted, TCP sets up a connection in both
sender and then acknowledged at a time by the directions through three-way handshake.
receiver. Therefore, after data transmission is complete,
the connection must be closed in both
TCP Window Sliding Mechanism directions. This is shown in the figure.
• TCP uses the sliding window mechanism to 1. PC1 sends a TCP segment with FIN
control the data transmission rate. being set. The segment does not carry
data.
2. After receiving the TCP segment from
PC1, PC2 replies with a TCP segment
with ACK being set.
3. PC2 checks whether data needs to be
sent. If so, PC2 sends the data, and then
a TCP segment with FIN being set to
close the connection. Otherwise, PC2
directly sends a TCP segment with FIN
• During the TCP three-way handshake, both being set.
ends notify each other of the maximum number 4. After receiving the TCP segment with
of bytes (buffer size) that can be received by the FIN being set, PC1 replies with an
local end through the Window field. ACK segment. The TCP connection is
• After the TCP connection is set up, the sender then torn down in both directions.
sends data of the specified number of bytes
based on the window size declared by the Network Layer
receiver.
• The transport layer is responsible for
• After receiving the data, the receiver stores the
establishing connections between processes on
data in the buffer and waits for the upper-layer
hosts, and the network layer is responsible for
application to obtain the buffered data. After the
transmitting data from one host to another.
data is obtained by the upper-layer application,
• PDUs transmitted at the network layer are
the corresponding buffer space is released.
called packets.
• The receiver notifies the current acceptable data
• The network layer is also called the Internet
size (window) according to its buffer size.
layer.
• The sender sends a certain amount of data based
o It sends packets from source hosts to
on the current window size of the receiver
destination hosts.
TCP Shutdown – Four-Way Handshake • Functions of the network layer:
o Provides logical addresses for network
• After data transmission is complete, TCP needs devices.
to use the four-way handshake mechanism to o Routes and forwards data packets.
o Common network layer protocols Data Link Layer
include IPv4, IPv6, ICMP, and IGMP.
• The data link layer is located between the
• Internet Protocol Version 4 (IPv4) is the most
network layer and the physical layer and
widely used network layer protocol.
provides services for protocols such as IP and
Working Process of a Network Layer Protocol IPv6 at the network layer. PDUs transmitted at
the data link layer are called frames.
• When IP is used as the network layer protocol,
• Ethernet is the most common data link layer
both communication parties are assigned a
protocol.
unique IP address to identify themselves. An IP
• The data link layer is located between the
address can be written as a 32-bit binary integer.
network layer and the physical layer.
To facilitate reading and analysis, an IP address
o The data link layer provides intra-
is usually represented in dot-decimal notation,
segment communication for the
consisting of four decimal numbers, each
network layer.
ranging from 0 to 255, separated by dots, such
o The functions of the data link layer
as, 192.168.1.1.
include framing, physical addressing,
• Encapsulation and forwarding of IP data
and error control.
packets:
o Common data link layer protocols
o When receiving data from an upper
include Ethernet, PPPoE, and PPP.
layer (such as the transport layer), the
network layer encapsulates an IP Ethernet and Source MAC Addresses
packet header and adds the source and
destination IP addresses to the header. • Ethernet:
o Each intermediate network device o Ethernet is a broadcast multiple access
(such as a router) maintains a routing protocol that works at the data link
table that guides IP packet forwarding layer protocol.
like a map. After receiving a packet, the o The network interfaces of PCs comply
intermediate network device reads the with the Ethernet standard.
destination address of the packet, o Generally, a broadcast domain
searches the local routing table for a corresponds to an IP network segment.
matching entry, and forwards the IP • Ethernet Source MAC Address
packet according to the instruction of o A media access control (MAC) address
the matching entry. uniquely identifies a NIC on a network.
o When the IP packet reaches the Each NIC requires and has a unique
destination host, the destination host MAC address.
determines whether to accept the o MAC addresses are used to locate
packet based on the destination IP specific physical devices in an IP
address and then processes the packet network segment.
accordingly. o A device that works at the data link
• When the IP protocol is running, routing layer, such as an Ethernet switch,
protocols such as OSPF, IS-IS, and BGP are maintains a MAC address table to
required to help routers build routing tables, and guide data frame forwarding.
ICMP is required to help control networks and • A MAC address is recognizable as six groups of
diagnose network status. two hexadecimal digits, separated by hyphens,
• The network layer header of a packet sent by a colons, or without a separator. Example: 48-A4-
source device carries the network layer 72-1C-8F-4F
addresses of the source and destination devices. Address Resolution Protocol (ARP)
• Each network device (such as a router) that has
the routing function maintains a routing table • Discovers the MAC address associated with a
(like a map of the network device). given IP address.
• After receiving a packet, the network device • The Address Resolution Protocol (ARP) is a
reads the network layer destination address of TCP/IP protocol that discovers the data link
the packet, searches the routing table for the layer address associated with a given IP
matching entry of the destination address, and address.
forwards the packet according to the instruction • ARP is an indispensable protocol in IPv4. It
of the matching entry. provides the following functions:
o Discovers the MAC address associated o In this step, Host 2 has discovered the
with a given IP address. MAC address of Host 1, so the ARP
o Maintains and caches the mapping reply is a unicast data frame.
between IP addresses and MAC • Step 6
addresses through ARP entries. o After receiving the unicast data frame,
o Detects duplicate IP addresses on a the switch forwards the frame.
network segment. • Step 7
o After receiving the ARP reply message,
Host 1 checks whether it is the
destination of the message based on the
carried destination IP address.
o If so, Host 1 records the carried sender's
MAC and IP addresses in its ARP table.

ARP Implementation Principles Physical Layer

• Generally, a network device has an ARP cache. • After data arrives at the physical layer, the
The ARP cache stores the mapping between IP physical layer converts a digital signal into an
addresses and MAC addresses. optical signal, an electrical signal, or an
• Step 1: electromagnetic wave signal based on the
o Before sending a datagram, a device physical media.
searches its ARP table for the • PDUs transmitted at the physical layer are
destination MAC address of the called bitstreams.
datagram. • The physical layer is at the bottom of the model.
o If the destination MAC address exists o This layer transmits bitstreams on
in the ARP table, the device media.
encapsulates the MAC address in the o It standardizes physical features such
frame and sends out the frame. If the as cables, pins, voltages, and interfaces.
destination MAC address does not exist o Common transmission media include
in the ARP table, the device sends an twisted pairs, optical fibers, and
ARP request to discover the MAC electromagnetic waves.
address.
Common Transmission Media
• Step 2:
o Host 1 sends an ARP request to • Twisted pairs: most common transmission
discover the MAC address of Host 2. media used on Ethernet networks. Twisted pairs
o The destination MAC address in the can be classified into the following types based
ARP request is 0 because the on their anti-electromagnetic interference
destination MAC address is unknown. capabilities:
o STP: shielded twisted pairs
o UTP: unshielded twisted pairs
• Step 3: • Optical fiber transmission can be classified into
o The ARP request message is a the following types based on functional
broadcast data frame. After receiving components:
the ARP request message, the switch o Fibers: optical transmission media,
floods it. which are glass fibers, used to restrict
• Step 4: optical transmission channels.
o After receiving the ARP request o Optical modules: convert electrical
message, each host checks whether it is signals into optical signals to generate
the destination of the message based on optical signals.
the carried destination IP address. • Serial cables are widely used on wide area
o Host 2 finds that it is the destination of networks (WANs). The types of interfaces
the message and then records the connected to serial cables vary according to
mapping between the sender's MAC WAN line types. The interfaces include
and IP addresses in its ARP table. synchronous/synchronous serial interfaces,
• Step 5 ATM interfaces, POS interfaces, and CE1/PRI
o Host 2 sends an ARP reply to Host 1. interfaces.
• Wireless signals may be transmitted by using into electrical signals, optical signals,
electromagnetic waves. For example, a wireless or electromagnetic (wireless) signals.
router modulates data and sends the data by
o The converted signals start to
using electromagnetic waves, and a wireless
be transmitted on the network.
network interface card of a mobile terminal
demodulates the electromagnetic waves to
obtain data. Data transmission from the
wireless router to the mobile terminal is then
complete.
Data Encapsulation on the Sender

• Assume that you are using a web browser to


access Huawei's official website. After you
enter the website address and press Enter, the
following events occur on your computer:
o The browser (application program) Data Transmission on the Intermediate Network
invokes HTTP (application layer
protocol) to encapsulate the application • Encapsulated data is transmitted on the
layer data. (The DATA in the figure network.
should also include the HTTP header,
which is not shown here.)
o HTTP uses TCP to ensure reliable data
transmission and transmits
encapsulated data to the TCP module.
o The TCP module adds the
corresponding TCP header information
(such as the source and destination port
numbers) to the data transmitted from
the application layer. At the transport
layer, the PDU is called a segment. • In most cases:
o On an IPv4 network, the TCP module o A Layer 2 device (such as an Ethernet
sends the encapsulated segment to the switch) only decapsulates the Layer 2
IPv4 module at the network layer. (On header of the data and performs the
an IPv6 network, the segment is sent to corresponding switching operation
the IPv6 module for processing.) according to the information in the
o After receiving the segment from the Layer 2 header.
TCP module, the IPv4 module o A Layer 3 device (such as a router)
encapsulates the IPv4 header. At this decapsulates the Layer 3 header and
layer, the PDU is called a packet. performs routing operations based on
o Ethernet is used as the data link layer the Layer 3 header information.
protocol. Therefore, after the IPv4
Data Decapsulation on the Receiver
module completes encapsulation, it
sends the packet to the Ethernet module • After being transmitted over the intermediate
(such as the Ethernet NIC) at the data network, the data finally reaches the destination
link layer for processing. server. Based on the information in different
o After receiving the packet from the protocol headers, the data is decapsulated layer
IPv4 module, the Ethernet module adds by layer, processed, transmitted, and finally
the corresponding Ethernet header and sent to the application on the web server for
FCS frame trailer to the packet. At this processing.
layer, the PDU is called a frame.
o After the Ethernet module completes
encapsulation, it sends the data to the
physical layer.
o Based on the physical media, the
physical layer converts digital signals
Engineering Task Force (IETF), IPv6 is
an upgraded version of IPv4.
Data Encapsulation

Lecture 4 – Network Layer Protocols and IP


Addressing

• Internet Protocol Version 4 (IPv4) is the core


protocol suite in the TCP/IP protocol suite. It
works at the network layer in the TCP/IP • Application data can be transmitted to the
protocol stack and this layer corresponds to the destination end over the network only after
network layer in the Open System being processed at each layer of the TCP/IP
Interconnection Reference Model (OSI RM). protocol suite. Each layer uses protocol data
• The network layer provides connectionless data units (PDUs) to exchange information with
transmission services. A network does not need another layer. PDUs at different layers contain
to establish a connection before sending data different information. Therefore, PDUs at each
packets. Each IP data packet is sent separately. layer have a particular name.

Network Layer Protocols IPv4 Packet Format

• The network layer is often called the IP layer. • The IP packet header contains the following
Network layer protocols include Internet information:
Control Message Protocol (ICMP) and Internet o Version: 4 bits long. Value 4 indicates
Packet Exchange (IPX), in addition to IP. IPv4. Value 6 indicates IPv6.
o Header Length: 4 bits long, indicating
Internet Protocol the size of a header. If the Option field
is not carried, the length is 20 bytes.
• IP is short for the Internet Protocol. IP is the
The maximum length is 60 bytes.
name of a protocol file with small content. It
o Type of Service: 8 bits long, indicating
defines and describes the format of IP packets.
a service type. This field takes effect
• The frequently mentioned IP refers to any
only when the QoS differentiated
content related directly or indirectly to the
service (DiffServ) is required.
Internet Protocol, instead of the Internet
o Total Length: 16 bits long. It indicates
Protocol itself.
the total length of an IP data packet.
• Function:
o Identification: 16 bits long. This field is
o Provides logical addresses for devices
used for fragment reassembly.
at the network layer.
o Flags: 3 bits long.
o Is responsible for addressing and o Fragment Offset: 13 bits long. This
forwarding data packets.
field is used for fragment reassembly.
• Versions: o Time to Live: 8 bits long.
o IPv4 - the core protocol in the TCP/IP
• Protocol: 8 bits long. It indicates a next-layer
protocol suite. It works at the network protocol. This field identifies the protocol used
layer in the TCP/IP protocol stack and
by the data carried in the data packet so that the
this layer corresponds to the network
IP layer of the destination host sends the data to
layer in the Open System
the process mapped to the Protocol field.
Interconnection Reference Model (OSI Common values are as follows:
RM).
o 1: ICMP, Internet Control Message
o IPv6 - also called IP Next Generation
Protocol
(IPng), is the second-generation
o 2: IGMP, Internet Group Management
standard protocol of network layer Protocol
protocols. Designed by the Internet
o 6: TCP, Transmission Control Protocol
o 17: UDP, User Datagram Protocol cyclically. As the number of such
• Header Checksum: 16 bits long. packets increases, network congestion
• Source IP Address: 32 bits long. It indicates a occurs.
source IP address. o To prevent network congestion induced
• Destination IP Address: 32 bits long. It by loops, a TTL field is added to the IP
indicates a destination IP address. packet header. The TTL value
• Options: a variable field. decreases by 1 each time a packet
• Padding: padded with all 0s. passes through a Layer 3 device. The
initial TTL value is set on the source
Data Packet Fragmentation device. After the TTL value of a packet
decreases to 0, the packet is discarded.
• The process of dividing a packet into multiple
In addition, the device that discards the
fragments is called fragmentation.
packet sends an ICMP error message to
• The sizes of IP packets forwarded on a
the source based on the source IP
network may be different. If the size of an IP
address in the packet header.
packet exceeds the maximum size supported
by a data link, the packet needs to be divided Protocol
into several smaller fragments before being
transmitted on the link. • The Protocol field in the IP packet header
identifies a protocol that will continue to
• Identification: 16 bits long. This field carries a
process the packet.
value assigned by a sender host and is used for
fragment reassembly. • This field identifies the protocol used by the
data carried in the data packet so that the IP
• Flags: 3 bits long.
layer of the destination host sends the data to
o Reserved Fragment: 0 (reserved).
the process mapped to the Protocol field.
o Don't Fragment: Value 1 indicates that
fragmentation is not allowed, and value • After receiving and processing the packet at the
0 indicates that fragmentation is network layer, the destination end needs to
allowed. determine which protocol is used to further
o More Fragment: Value 1 indicates that process the packet. The Protocol field in the IP
there are more segments following the packet header identifies the number of a
segment, and value 0 indicates that the protocol that will continue to process the
segment is the last data segment. packet.
• Fragment Offset: 13 bits long. This field is • The field may identify a network layer protocol
used for fragment reassembly. This field (for example, ICMP of value 0x01) or an upper-
indicates the relative position of a fragment in layer protocol (for example, Transmission
an original packet that is fragmented. This field Control Protocol [TCP] of value 0x06 or the
is used together with the More Fragment bit to User Datagram Protocol [UDP] of value 0x11).
help the receiver assemble the fragments. What is an IP Address?
Time to Live • An IP address identifies a node (or an interface
• The TTL field specifies the number of routers on a network device) on a network and is used
that a packet can pass through. to find the destination for data.
• Once a packet passes through a router, the TTL • IP addresses are used to forward IP packets on
is reduced by 1. If the TTL value is reduced to the network.
0, a data packet is discarded. • An IP address is an attribute of a network device
• Time to Live: 8 bits long. It specifies the interface, not an attribute of the network device
maximum number of routers that a packet can itself. To assign an IP address to a device is to
pass through on a network. assign an IP address to an interface on the
o When packets are forwarded between device. If a device has multiple interfaces, each
network segments, loops may occur if interface needs at least one IP address.
routes are not properly planned on IP Address Notation
network devices. As a result, packets
are infinitely looped on the network • IP address notation
and cannot reach the destination. If a o An IP address is 32 bits long and
loop occurs, all packets destined for consists of 4 bytes. It is in dotted
this destination are forwarded
decimal notation, which is convenient IP Addressing
for reading and writing.
• Network part (network ID): indicates the
• Dotted decimal notation
network where a host is located, which is
o The IP address format helps us better
similar to the function of "Community A in
use and configure a network. However,
district B of City X in province Y."
a communication device uses the
binary mode to operate an IP address. • Host part: identifies a specific host interface
Therefore, it is necessary to be familiar within a network segment defined by the
with the decimal and binary network ID. The function of host ID is like a
conversion. host location "No. A Street B".
• IPv4 address range • Network addressing:
o 00000000.00000000.00000000.00000 o Layer 2 network addressing: A host
000– interface can be found based on an IP
11111111.11111111.11111111.1111111 address.
1, that is, 0.0.0.0–255.255.255.255 o Layer 3 network addressing: A gateway
is used to forward data packets between
IP Address Structure network segments.
• Gateway:
• An IPv4 address is divided into two parts:
o During packet forwarding, a device
o Network part (network ID): identifies determines a forwarding path and an
a network. interface connected to a destination
▪ IP addresses do not show any network segment. If the destination
geographical information. The host and source host are on different
network ID represents the network segments, packets are
network to which a host forwarded to the gateway and then the
belongs. gateway forwards the packets to the
▪ Network devices with the same destination network segment.
network ID are located on the o A gateway receives and processes
same network, regardless of packets sent by hosts on a local
their physical locations. network segment and forwards the
o Host part: identifies a host and is used packets to the destination network
to differentiate hosts on a network. segment. To implement this function,
• A network mask is also called a subnet mask: the gateway must know the route of the
o A network mask is 32 bits long, which destination network segment. The IP
is also represented in dotted decimal address of the interface on the gateway
notation, like bits in an IP address. connected to the local network segment
o The network mask is not an IP address. is the gateway address of the network
The network mask consists of segment.
consecutive 1s followed by
IP Address Classification
consecutive 0s in binary notation.
o Generally, the number of 1s indicates • Class A
the length of a network mask. For o 0.0.0.0 – 127.255.255.255
example, the length of mask 0.0.0.0 is o Assigned to hosts
0, and the length of mask 252.0.0.0 is o 8 bits
6. • Class B
o The network mask is generally used o 128.0.0.0 – 191.255.255.255
together with the IP address. Bits of 0 o Assigned to hosts
correspond to host bits in the IP o 16 bits
address. In other words, in an IP • Class C
address, the number of 1s in a network o 192.0.0.0 – 223.255.255.255
mask is the number of bits of the o Assigned to hosts
network ID, and the number of 0s is the o 24 bits
number of bits in the host ID. • Class D
o 224.0.0.0 – 239.255.255.255
o Used for multicast
• Class E Internet. Such an IP address is a public IP
o 240.0.0.0–255.255.255.255 address.
o Used for Research • Private IP address: In practice, some networks
• A host refers to a router or a computer. In do not need to connect to the Internet. For
addition, the IP address of an interface on a host example, on a network of a lab in a college, IP
is called a host IP address. addresses of devices need to avoid conflicting
• Multicast address: is used to implement one-to- with each other only within the same network.
multiple message transmission. In the IP address space, some IP addresses of
class A, B, and C addresses are reserved for the
IP Address Types preceding situations. These IP addresses are
• A network range defined by a network ID is called private IP addresses.
called a network segment o Class A: 10.0.0.0–10.255.255.255
o Class B: 172.16.0.0–172.31.255.255
• Network address
o Class C: 192.168.0.0–192.168.255.255
o Identifies a network.
o The network ID is X, and each bit in the • Network Address Translation (NAT) is used to
host ID is 0. translate addresses between private and public
o It cannot be assigned to a host interface. IP address realms.
• Broadcast address Special IP Addresses
o A special address used to send data to
all hosts on a network. 1. Limited Broadcast Address
o The network ID is X, and each bit in the o Address Scope: 255.255.255.255
host ID is 1. o Function: It can be used as a
o It cannot be assigned to a host interface. destination address and traffic destined
• Available address for it is sent to all hosts on the network
o IP addresses that can be allocated to segment to which the address belongs.
device interfaces on a network (Its usage is restricted by a gateway).
o It is also called a host address. It can be 2. Any IP Address
assigned to a host interface. o Address Scope: 0.0.0.0
• The number of available IP addresses on a o Function: It is an address of any
network segment is calculated using the network. Addresses in this block refer
following method: to source hosts on "this" network.
o Given that the host part of a network 3. Loopback Address
segment is n bits, the number of IP o Address Scope: 127.0.0.0/8
addresses is 2n, and the number of o Function: It is used to test the software
available IP addresses is 2n – 2 (one system of a test device.
network address and one broadcast 4. Link-local Address
address). o Address Scope: 169.254.0.0/24
o Function: If a host fails to
IP Address Calculation automatically obtain an IP address, the
host can use an IP address in this
address block for temporary
communication
IPv4 vs IPv6

• IPv4 addresses managed by the IANA were


exhausted in 2011. As the last public IPv4
address was allocated and more and more users
and devices access the public network, IPv4
addresses were exhausted. This is the biggest
Private IP Addresses driving force for IPv6 to replace IPv4.
• Public IP address: An IP address is assigned • IPv4
by the Internet Assigned Numbers Authority o Address length: 32 bits
(IANA), and this address allocation mode o Address types: unicast address,
ensures that each IP address is unique on the broadcast address, and multicast
address
o Characteristics:
▪ IPv4 address depletion
▪ Inappropriate packet header
design
▪ ARP dependency-induced
flooding
• IPv6
o Address length: 128 bits
o Address types: unicast address,
multicast address, and anycast address
o Characteristics: ICMP Redirection
▪ Unlimited number of
addresses • ICMP Redirect messages are a type of ICMP
▪ Simplified packet header control message. When a router detects that a
▪ Automatic IPv6 address host uses a non-optimal route in a specific
allocation scenario, the router sends an ICMP Redirect
message to the host, requesting the host to
Why Subnetting? change the route.
• ICMP redirection process:
• Classful addressing is too rigid and the
1. Host A wants to send packets to server A.
granularity of address division is too large. As a
Host A sends packets to the default gateway
result, a large number of host IDs cannot be
address that is assigned to the gateway
fully used, wasting IP addresses.
RTB.
• Therefore, subnetting can be used to reduce
2. After receiving the packet, RTB checks
address waste through the variable length
packet information and finds that the packet
subnet mask (VLSM) technology. A large
should be forwarded to RTA. RTA is the
classful network is divided into several small
other gateway on the same network
subnets, which makes the use of IP addresses
segment as the source host. This forwarding
more scientific.
path through RTA is better than that through
• A class B address is used for a broadcast RTB. Therefore, RTB sends an ICMP
domain, wasting addresses.
Redirect message to the host, instructing
• The broadcast domain is too large. Once the host to send the packet to RTA.
broadcast occurs, an internal network is 3. After receiving the ICMP Redirect
overloaded. message, the host sends a packet to RTA.
• A network number is divided into multiple Then RTA forwards the packet to server A.
subnets, and each subnet is allocated to a
separate broadcast domain. ICMP Error Detection
• In this way, the broadcast domain is smaller,
• ICMP Echo messages are used to check
and the network planning is more reasonable.
network connectivity between the source and
• IP addresses are properly used.
destination and provide other information,
Internet Control Message Protocol (ICMP) such as the round-trip time.
• Function: ping
• An auxiliary protocol of the IP protocol. o Ping is a command used on network
• ICMP is used to transmit error and control devices, Windows OS, Unix OS, and
information between network devices. It plays Linux OS. Ping is a small and useful
an important role in collecting network application based on the ICMP
information, diagnosing and rectifying network protocol.
faults. o A ping tests the reachability of a
destination node.
ICMP Error Report

• ICMP defines various error messages for


diagnosing network connectivity problems.
The source can determine the cause for a data
transmission failure based on the received
error messages. For example, after a network
device receives a packet, it cannot access the summarization reduces the size of the
network where the destination device resides, routing table and speeds up route
the network device automatically sends an calculation and route convergence.
ICMP Destination Unreachable message to the o Scalability: Addresses need to be
source. properly reserved at each layer,
• Function: tracert ensuring the contiguous address space
o Tracert checks the reachability of each for route summarization when the
hop on a forwarding path based on the network is expanded. Re-planning of
TTL value carried in the packet header. addresses and routes induced by
o Tracert is an effective method to detect network expansion is therefore
packet loss and delay on a network and prevented.
helps administrators discover routing o Combination of topology and services:
loops on the network. Address planning is combined with the
network topology and network
Basic IP Addressing Configuration Commands transport service to facilitate route
1. Enter the interface view planning and quality of service (QoS)
o [Huawei] interface interface-type deployment. Appropriate IP address
interface-number planning helps you easily determine the
▪ interface-type interface- positions of devices and types of
number: specifies the type and services once you read the IP addresses.
number of an interface. The
interface type and number can
be closely next to each other or NOTE!!!
separated by a space character.
Pages that were not included in this notes:
2. Configure an IP address for the interface
o [Huawei-GigabitEthernet0/0/1] ip ▪ P27 – Subnetting – Analyzing the original
address ip-address { mask | mask- Network Segment
length } ▪ P28 – Subnetting – Taking bits from the host
▪ ip-address: specifies the IP part
address of an interface. The ▪ P29 - Subnetting - Calculating the Subnet
value is in dotted decimal Network Address
notation. ▪ P30 - Subnetting - Calculating the Subnet
▪ mask: specifies a subnet mask. Broadcast Address
The value is in dotted decimal ▪ P31 - Practice: Computing Subnets (1)
notation. ▪ P32 - Practice: Computing Subnets (2)
▪ mask-length: specifies a mask ▪ P40 - Case:
length. The value is an integer Configuring an IP address for an Interface
ranging from 0 to 32.
Network IP Address Planning

• IP address planning must be considered


together with the network structure, routing
protocols, traffic planning, and service rules.
In addition, IP address planning should be
corresponding to the network hierarchy and
performed in a top-bottom way.
• In conclusion, IP address planning objectives
are to achieve easy management, easy
scalability, and high utilization.
• Planning rules:
o Uniqueness: Each host on an IP
network must have a unique IP address.
o Continuity: Contiguous addresses can
be summarized easily in the
hierarchical networking. Route

You might also like