04 Network Layer Protocolsand IPAddressing
04 Network Layer Protocolsand IPAddressing
and IP Addressing
Contents
3 Subnetting
4 ICMP
Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Network Layer Protocols
The network layer is often called the IP layer.
Application Layer
Transport layer
IP addressing and
Network…………………………………………….
layer ICMP IPX
routing
IP
Data link layer
Physical Layer
Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Internet Protocol
IP Internet Protocol
Internet Protocol is the name of a protocol file with small content. It defines and describes the format of
IP packets.
The frequently mentioned IP refers to any content related directly or indirectly to the Internet Protocol,
instead of the Internet Protocol itself.
Function Version
Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Data Encapsulation
Application Layer Data PDU
Ethernet IP TCP
User data Ethernet tail
header header header
Page 6 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IPv4 Packet Format
Ethernet IP TCP
User data Ethernet tail
header header header
Header Type of
Version Total Length
Length Service
Identification Flags Fragment Offset
Fixed size:
20 bytes TTL Protocol Header Checksum
Source IP Address
Destination IP Address
Optional size:
0–40 bytes Options Padding
Page 7 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Data Packet Fragmentation
Fragmentation The process of dividing a packet into multiple fragments.
The sizes of IP packets forwarded on a network may be different. If the size of an IP packet exceeds the
maximum size supported by a data link, the packet needs to be divided into several smaller fragments
before being transmitted on the link.
Header Type of
Version Total Length
Length Service
Identification Flags Fragment Offset
Host A Host B
TTL Protocol Header Checksum Data
Source IP Address Data fragment
Destination IP Address
Options Padding
Page 9 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Time to Live
The TTL field specifies the number of routers that a packet can pass through.
Once a packet passes through a router, the TTL is reduced by 1. If the TTL value is reduced to 0, a data
packet is discarded.
TTL=255 TTL=254 TTL=253
Header Type of
Version Total Length
Length Service
Identification Flags Fragment Offset
Host A Host B
TTL Protocol Header Checksum
Source IP Address
Destination IP Address
Options Padding
Page 10 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Protocol
The Protocol field in the IP packet header identifies a protocol that will continue to process the packet.
This field identifies the protocol used by the data carried in the data packet so that the IP layer of the
destination host sends the data to the process mapped to the Protocol field.
Page 11 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
• Address Classification
3 Subnetting
4 ICMP
Page 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
What Is an IP Address?
An IP address identifies a node (or an interface on a network device) on a network.
IP Address
IP 1 IP 5 An IP address identifies a
node on a network and is
IP 2 IP 4
used to find the destination
IP 3 for data.
DATA
Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP address Notation
An IPv4 address is 32 bits long.
Power
27 26 25 24 23 22 21 20
Conversion between 128 64 32 16 8 4 2 1
decimal and binary
systems Bit 1 1 0 0 0 0 0 0
= 128 + 64 = 192
Page 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP Address Structure
Network part Identifies a network.
Host part Identifies a host and is used to differentiate hosts on a network.
Network part Host part
Network mask Is used to distinguish the network part from the host part in an IP address.
192. 168. 10. 1
192.168.10.1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 IP address
Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP Addressing
Network part (network ID) Identifies a network.
Host part Identifies a host and is used to differentiate hosts on a network.
Network
part
No. X, Street Y,
Community A
John
10.0.1.0/24 10.0.2.0/24
10.0.1.1/24 10.0.2.1/24
• Address Classification
3 Subnetting
4 ICMP
Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP Address Classification (Classful Addressing)
To facilitate IP address management and networking, IP addresses are classified into the following classes:
Class A 0NNNNNNN NNNNNNNN NNNNNNNN NNNNNNNN 0.0.0.0~127.255.255.255
Assigned to
Class B 10NNNNNN NNNNNNNN NNNNNNNN NNNNNNNN 128.0.0.0~191.255.255.255
hosts
Page 18 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP Address Types
A network range defined by a network ID is called a network segment.
Network address: Identifies a network.
Example: 192.168.10.0/24
192. 168. 10. 00000000
Note
Broadcast address:a special address used to send data to • Network and broadcast
all hosts on a network. addresses cannot be directly
Example: 192.168.10.255/24 used by devices or their
interfaces.
192. 168. 10. 11111111
• Number of available addresses
on a network segment is 2n – 2
Available addresses:IP addresses that can be allocated to (n is the number of bits in the
host part).
device interfaces on a network
Example: 192.168.10.1/24
192. 168. 10. 00000001
Page 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
IP Address Calculation
Example: What are the network address, broadcast address, and number of available addresses of class B address
172.16.10.1/16?
172. 16. 00001010. 00000001
IP address
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1
Network mask
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The network address is
obtained, with all host bits set
Network
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 to 0s.
0 0 0 0 0 0 0 0 172.16.0.0/16
address
The broadcast address is
obtained, with all host bits set to
Broadcast address 1s.
1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 172.16.255.255/16
Number of IP
216=65536 Quiz
addresses
Example: What are the network
Number of available
addresses
216-2=65534 address, broadcast address, and
Range of available number of available addresses of
172.16.0.1/16~172.16.255.254/16
addresses class A address 10.128.20.10/8?
Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Private IP Addresses
Public IP address An IP address is assigned by the Internet Assigned Numbers Authority (IANA), and this
address allocation mode ensures that each IP address is unique on the Internet.
Private IP address In practice, some networks do not need to connect to the Internet. For example, on a network of
a lab in a college, IP addresses of devices need to avoid conflicting with each other only within the same network. In
the IP address space, some IP addresses of class A, B, and C addresses are reserved for the preceding situations.
These IP addresses are called private IP addresses.
192.168.1.0/24
▫ Class A: 10.0.0.0–10.255.255.255
10.0.0.0/8
▫ Class B: 172.16.0.0–172.31.255.255 Implemented using
Internet network address
▫ Class C: 192.168.0.0–192.168.255.255 translation (NAT)
10.0.0.0/8 192.168.1.0/24
Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Special IP Addresses
Some IP addresses in the IP address space are of special meanings and functions.
For example:
Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
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 driving force for IPv6 to replace IPv4.
IPv4 IPv6
• Address length: 32 bits • Address length: 128 bits
• Address types: unicast address, broadcast • Address types: unicast address, multicast
address, and multicast address address, and anycast address
• Characteristics: • Characteristics:
▫ IPv4 address depletion ▫ Unlimited number of addresses
▫ Inappropriate packet header design ▫ Simplified packet header
▫ ARP dependency-induced flooding ▫ Automatic IPv6 address allocation
▫ ... ▫ ...
Page 24 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
3 Subnetting
• Subnetting
4 ICMP
Page 25 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Why Subnetting?
172.16.1.0
172.16.4.0
172.16.3.0
172.16.0.1 172.16.0.2 172.16.0.253 172.16.0.254
……
172.16.0.0
172.16.2.0
216 = 65536 IP addresses A network number is divided into multiple subnets, and
each subnet is allocated to a separate broadcast domain.
A class B address is used for a broadcast domain,
wasting addresses.
In this way, the broadcast domain is smaller, and the
The broadcast domain is too large. Once broadcast network planning is more reasonable.
occurs, an internal network is overloaded.
IP addresses are properly used.
Page 26 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Subnetting - Analyzing the Original Network
Segment
Example: 192.168.10.0/24
192.168.10.1
IP address 192. 168. 10. 0 0 0 0 0 0 0 1
Default 255. 255. 255. 0 0 0 0 0 0 0 0 One class C network:
subnet mask
192.168.10.0/24
……
192.168.10.255 Default subnet mask:
IP address 192. 168. 10. 1 1 1 1 1 1 1 1 255.255.255.0
Default 255. 255. 255. 0 0 0 0 0 0 0 0
subnet mask
Page 27 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Subnetting - Taking Bits from the Host Part
Bits can be taken from the host part to create subnets.
Take 1 bit from the host part.
Subnet bits
Total IP addresses: 27 = 128
Variable length subnet mask (VLSM)
Available IP addresses: 27 – 2 = 126
Page 28 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Subnetting - Calculating the Subnet Network
Address
The network address is obtained, with all host bits set to 0s.
Page 29 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Subnetting - Calculating the Subnet Broadcast
Address
The broadcast address is obtained, with all host bits set to 1s.
Subnet 2's
broadcast address 192. 168. 10. 1 1 1 1 1 1 1 1 192.168.10.255/25
Page 30 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Practice: Computing Subnets (1)
Question: An existing class C network segment is
192.168.1.0/24. Use the VLSM to allocate IP
10 hosts addresses to three subnets.
…… 30 hosts
Answer: (Use a network with 10 hosts as an example.)
Step 1: Calculate the number of host bits to be taken.
2n – 2 ≥ 10
n ≥ 4, host bits
Step 2: Take bits from the host part.
……
Take 4 bits from the host part.
……
IP address 192. 168. 1. 0 0 0 0 0 0 0 0
10 hosts
Subnet mask 255. 255. 255. 1 1 1 1 0 0 0 0
Number of subnets:
Subnet bits 24 = 16 subnets
Page 31 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Practice: Computing Subnets (2)
Question: An existing class C network
192.168.1.0/28
segment is 192.168.1.0/24. Use the VLSM to
10 hosts
allocate IP addresses to three subnets.
…… 30 hosts
Answer: (Use a network with 10 hosts as an example.)
Step 3: Calculate subnet network addresses.
……
…… Subnet 1 192. 168. 1. 0 0 0 0 0 0 0 0 192.168.1.0/28
…
Subnet 16 192. 168. 1. 1 1 1 1 0 0 0 0 192.168.1.240/28
Page 32 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
3 Subnetting
4 ICMP
• ICMP协议定义及功能
Page 33 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
ICMP
I C M P Internet Control Message Protocol
ICMP is an auxiliary protocol of the IP protocol. ICMP is used to transmit error and control information between
network devices.
Ethernet header IP header ICMP message Ethernet tail
3 3 Port Unreachable
5 0 Redirect
8 0 Echo Request
Page 34 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
ICMP Redirection
ICMP Redirect messages are a type of ICMP control message.
Server A Internet
20.0.0.1/24
20.0.0.2/24
RTA RTB
10.0.0.200/24 10.0.0.100/24
3 1
IP address: 10.0.0.1/24
Host A Default gateway: 10.0.0.100
Page 35 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
ICMP Error Detection
ICMP Echo messages are used to check network connectivity between the source and destination and
provide other information, such as the round-trip time.
Page 36 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
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.
Function:Tracert 2 20.0.0.2 30 ms 30 ms 20 ms
Tracert checks the reachability of each hop on a
forwarding path based on the TTL value carried in the
packet header.
Page 37 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
3 Subnetting
4 ICMP
Page 38 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Basic IP Address Configuration Commands
1. Enter the interface view.
Page 39 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Case:
Configuring an IP address for an Interface
Configure an IP address for a physical
192.168.1.1/24 192.168.1.2/24 interface.
GE0/0/1 GE0/0/1 [RTA] interface gigabitethernet 0/0/1
[RTA-GigabitEthernet0/0/1] ip address 192.168.1.1 255.255.255.0
RTA RTB Or
Loopback 0 Loopback 0
1.1.1.1/32 2.2.2.2/32 [RTA-GigabitEthernet0/0/1] ip address 192.168.1.1 24
Page 40 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
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.
Reference Planning Rules
In conclusion, IP address planning objectives are to achieve easy management,
easy scalability, and high utilization. Uniqueness, continuity, and
scalability
Structured and service-related
IP Address Planning Example
Background Address Type Address Scope
Network segment of
192.168.1.0/24 Core node
the R&D department
Page 41 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Summary
▫ To connect a PC to the Internet, apply an IP address from the Internet Service
Provider (ISP).
addresses.
Page 44 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.