04 Network Layer Protocols and IP Addressing
04 Network Layer Protocols and IP Addressing
Addressing
Page 1 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Foreword
● 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 protocol stack and this layer
corresponds to the network layer in the Open System Interconnection Reference
Model (OSI RM).
Page 2 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Objectives
● On completion of this course, you will be able:
🞐 Describe main protocols at the network layer.
🞐 Describe the concepts and classification of IPv4 addresses and special IPv4 addresses.
Page 3 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Network Layer Protocols
3. Subnetting
4. ICMP
Page 4 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Network Layer Protocols
● The network layer is often called the IP layer. Network layer protocols include Internet Control
Message Protocol (ICMP) and Internet Packet Exchange (IPX), in addition to IP.
Application Layer
Transport layer
Physical Layer
Page 5 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Internet Protocol
● IP is short for the Internet Protocol. IP 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 6 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 7 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:
Options Padding
0–40 bytes
Page 8 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Data Packet Fragmentation
● The process of dividing a packet into multiple fragments is called fragmentation.
● 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
TTL Protocol Header Checksum Data B
Source IP Address
Data fragment
Destination IP Address
Options Padding
Page 10 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.
Header Type of
Version Total Length
Length Service TTL = 255 TTL = 254 TTL = 253
Identification Flags Fragment Offset
TTL Protocol Header Checksum
Source IP Address
Host A Host
Destination IP Address B
Options Padding
Page 11 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 12 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Network Layer Protocols
3. Subnetting
4. ICMP
Page 13 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
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 14 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
IP address Notation
● An IPv4 address is 32 bits long.
27 26 25 24 23 22 21 20
Power
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
● IPv4 address range is 0.0.0.0–255.255.255.255.
Page 15 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
IP Address Structure
● Network part: identifies a network.
• Network mask: is used to distinguish the network part from the host part in an IP address.
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 16 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
IP Addressing
● Network part (network ID): identifies a network.
Network part
10.0.1.0/24 10.0.2.0/24
10.0.1.1/24 10.0.2.1/24
Page 17 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Address
Concepts Address Calculation Special Addresses IPv4 vs. IPv6
Classification
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.
Address
Concepts Address Calculation Special Addresses IPv4 vs. IPv6
Classification
IP Address Types
● A network range defined by a network ID is called a network segment.
● Broadcast address: a special address used to send data • Network and broadcast addresses
Page 20 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
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 to 0s.
Network address 1 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 172.16.0.0/16
The broadcast address is obtained,
with all host bits set to 1s.
Broadcast address 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
Page 21 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Special
Concepts Address Classification Address Calculation IPv4 vs. IPv6
Addresses
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. Such an IP address is
a public IP address.
● 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.
🞐 Class A: 10.0.0.0–10.255.255.255
192.168.1.0/24
10.0.0.0/8
🞐 Class B: 172.16.0.0–172.31.255.255
Implemented using network
Internet address translation (NAT)
🞐 Class C: 192.168.0.0–192.168.255.255
10.0.0.0/8 192.168.1.0/24
Page 22 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Special
Concepts Address Classification Address Calculation IPv4 vs. IPv6
Addresses
Special IP Addresses
● Some IP addresses in the IP address space are of special meanings and functions.
● For example:
Loopback address 127.0.0.0/8 It is used to test the software system of a test device.
If a host fails to automatically obtain an IP address, the host
Link-local address 169.254.0.0/24 can use an IP address in this address block for temporary
communication.
Page 23 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Concepts Address Classification Address Calculation Special Addresses IPv4 vs. IPv6
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
1. Network Layer Protocols
3. 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.0.0
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 subnet
255. 255. 255. 0 0 0 0 0 0 0 0 One class C network:
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
Network part Host part
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
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.
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
addresses to three subnets.
10 hosts
... 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
...
... Take 4 bits from the host part.
Page 31 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Practice: Computing Subnets (2)
• Question: An existing class C network segment
is 192.168.1.0/24. Use the VLSM to allocate IP
192.168.1.0/28
addresses to three subnets.
10 hosts
...
... 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
1. Network Layer Protocols
3. Subnetting
4. ICMP
Page 33 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
ICMP
● The Internet Control Message Protocol (ICMP) is an auxiliary protocol of the IP protocol.
Page 34 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
ICMP Redirection
● ICMP Redirect messages are a type of ICMP control message. When a router detects that a
host uses a non-optimal route in a specific scenario, the router sends an ICMP Redirect
message to the host, requesting the host to change the route.
Server Internet
A
20.0.0.1/24
20.0.0.2/24
RT RT
A B
10.0.0.200/24 10.0.0.100/24
3 1
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. For example,
after a network device receives a packet, it cannot access the network where the destination device
resides, the network device automatically sends an ICMP Destination Unreachable message to the source.
10.0.0.0/24 20.0.0.0/24
traceroute to 20.0.0.2(20.0.0.2), max hops: 30 ,packet length:
. . . .
1 2 1 2 40,press CTRL_C
RT RT Server
A B A to break
Destination Unreachable message
Function: Tracert
1 10.0.0.2 80 ms 10 ms 10 ms
Tracert checks the reachability of each hop on a forwarding path
based on the TTL value carried in the packet header. 2 20.0.0.2 30 ms 30 ms 20 ms
Tracert is an effective method to detect packet loss and delay on a
network and helps administrators discover routing loops on the
network.
Page 37 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Network Layer Protocols
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.
You can run this command to enter the view of a specified interface and configure attributes for the interface.
• interface-type interface-number: specifies the type and number of an interface. The interface type and number
can be closely next to each other or separated by a space character.
2. Configure an IP address for the interface.
You can run this command in the interface view to assign an IP address to the interface on the network devices to
implement network interconnection.
• ip-address: specifies the IP address of an interface. The value is in dotted decimal notation.
• mask: specifies a subnet mask. The value is in dotted decimal notation.
• mask-length: specifies a mask length. The value is an integer ranging from 0 to 32.
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 interface.
192.168.1.1/24 192.168.1.2/24 [RTA] interface gigabitethernet 0/0/1
GE0/0/1 GE0/0/1
[RTA-GigabitEthernet0/0/1] ip address 192.168.1.1 255.255.255.0
Or,
RTA RTB
Loopback 0 Loopback 0 [RTA-GigabitEthernet0/0/1] ip address 192.168.1.1 24
1.1.1.1/32 2.2.2.2/32
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.
● In conclusion, IP address planning objectives are to achieve easy management, easy scalability,
and high utilization. Reference Planning Rules
Page 41 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Quiz
1. (Multiple) Which class does 201.222.5.64 belong? ( )
A. Class A
B. Class B
C. Class C
D. Class D
2. (Multiple) A company is assigned a class C network segment 192.168.20.0/24. One of its departments has
40 hosts. Which of the following subnets can be allocated? ( )
A. 192.168.20.64/26
B. 192.168.20.64/27
C. 192.168.20.128/26
D. 192.168.20.190/26
Page 42 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).
● This presentation also describes the planning and basic configuration of IP addresses.
Page 43 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.
Thank You
www.huawei.com
Page 44 Copyright © 2020 Huawei Technologies Co., Ltd. All rights reserved.