Report
Report
Report
Subnetting Overview
1. Why subnetting?
If IPv4 addresses are only classified by class (A, B, C), it will cause a lot of waste or insufficient
use. Divide, divide a part into the network number, you can divide the network of various types
and sizes.
subnet mask:
1. The concept and function of the subnet mask:
①The subnet mask is also called the network mask or the address mask, which must be used
together with the IP address.
②You can identify the relationship between a host subnet and other subnets only using the subnet
mask to ensure that the network works properly.
③Subnet Mask and IP address Perform the collation operation to separate the network address and
host address in the IP address. This operation is used to determine whether the IP address is on the
local network or the remote network.
④The subnet mask is also used to further divide the network into a number of subnets to avoid too
many hosts and congestion or too little IP waste.
The subnet mask binary 11111111.11111111.11111111.00000000, can you give its subnet mask?
Note:n is a number from 1 to 32, indicating the length of the network ID in the subnet mask. The
number of hosts in the subnet is determined by the number of n =2^(32-n)-2 (reason for -2: When
all the host bits are 0, it indicates the network address of the local network, and when all the host
bits are 1, it indicates the broadcast address of the local network, which are two special addresses).
Subnetting method
1. The basic idea of VLSM subnet division
Use the leftmost bits of the host bits of the existing network segment as subnet bits to divide
multiple subnets.
①Borrow the "Network ID" part of the original classful network IPv4 address from the "Host ID"
part
②Change a part of the bits that originally belonged to the "host ID" part into a part of the
"network ID" (usually called "subnet ID").
③, the original "network ID" + "subnet ID" = new "network ID". The length of the "subnet ID"
determines the number of subnets that can be divided.
The following example diagram:
Final result:
Network address of subnet A: 192.168.0.0/25, available addresses (192.168.0.1 to 192.168.0.126),
broadcast address: 192.168.0.127.
Network address of subnet B: 192.168.0.128/25, available addresses (192.168.0.129 to
192.168.0.254), broadcast address: 192.168.0.255.
指导版本
Conclusion: Class C network is equally divided into 4 subnets, and the subnet mask can be
divided into 4 subnets by moving the subnet mask to the right by 2 bits, that is, 2^2.
Final result:
Network address of subnet A: 192.168.0.0/26, available addresses (192.168.0.1 to 192.168.0.62),
broadcast address: 192.168.0.63/26.
Network address of subnet B: 192.168.0.64/26, available addresses (192.168.65 to 192.168.0.126),
broadcast address: 192.168.0.127.
Network address of subnet C: 192.168.0.128/26, available addresses (192.168.129 to
192.168.0.190), broadcast address: 192.168.0.191.
Network address of subnet D: 192.168.0.192/26, available addresses (192.168.193/26 to
192.168.0.254), broadcast address: 192.168.0.255.
Final result:
A subnet
Network address: 131.107.0.0/17,
Available addresses (131.107.0.1 ~ 131.107.127.254)
Broadcast address: 131.107.127.255
B subnet
Network address: 131.107.128.0/17
Available addresses (131.107.128.1 ~ 131.107.255.254)
Broadcast address: 131.107.255.255
2 bits are borrowed from the host, so the subnet mask + 2 bits is changed from 255.0.0.0 (/8) to
255.192.0.0 (/10)
Conclusion: A class A network is equally divided into 4 subnets, and the subnet mask can be
divided into 4 subnets by moving the subnet mask to the right by 2 bits, that is, 2^2.
Final result:
Network address of subnet A: 42.0.0.0/10, available address (42.0.0.1 ~ 42.63.255.254), broadcast
address: 42.63.255.255
Network address of subnet B: 42.64.0.0/10, available address (42.64.0.1 ~ 42.127.255.254),
broadcast address: 42.127.255.255
Network address of subnet C: 42.128.0.0/10, available address (42.128.0.1 ~ 42.191.255.254),
broadcast address: 42.191.255.255
Network address of subnet D: 42.192.0.0/10, available addresses (42.192.0.1 ~ 42.255.255.254),
broadcast address: 42.255.255.255
Principle part
1. IP Address
The IP address corresponds to the third network layer of the OSI reference model. The router
working in the network layer judges whether it belongs to the same network segment according to
the destination IP and the source IP. If it is a different network segment, it forwards the data
packet.
2. Format of IP addresses
An IP address (IPv4) consists of a 32-bit binary number, divided into 4 segments (4 bytes), each
segment is an 8-bit binary number (1 byte). Each segment of 8-bit binary is separated by
punctuation marks "."
Since the binary number is too long, in order to facilitate memory and identification, each segment
of 8-bit binary number is converted into decimal, and the size is 0 to 255. This representation of IP
addresses is called "dotted decimal notation". The IP address is represented as: xxx.xxx.xxx.xxx
3. Components of an IP Address
192.168.1.100
Network part Host part
The IP address of a computer consists of two parts. One part is the network identification, the
other part is the host identification. The computer network part in the same network segment is the
same, but the host part is different. Routers connect different network segments and are
responsible for data forwarding between different network segments. While switches connect
computers on the same network segment. By setting the network address and the host address, it is
ensured that the IP addresses of each host will not overlap each other in the entire network, that is,
the IP address is unique.
4. Classification of IP address
IP addresses are divided into five categories: A B C D and E. Among them, A B and C are
commonly used IP addresses, and categories D and E are special addresses.
a. Class A Address
ⅰ The first byte of a class A address is the network address (the highest bit is fixed at 0), and the
other 3 bytes are the host address.
ⅱ Class A address range: 1.0.0.0 - 126.255.255.255, with 0 and 127 as special addresses.
ⅲ The default subnet mask for a class A network is 255.0.0.0, which can also be written as /8.
ⅳ The maximum number of hosts in a class A network is 256×256×256-2=16777214 (minus 1
network address with 0 host bits and 1 broadcast address).
In a computer network, the address whose host ID is all 0 is the network address, and the address
whose host ID is all 1 is the broadcast address. These two addresses cannot be assigned to the
host.
b. Class B Address
ⅰ The first byte (the highest bit is fixed at 10) and the second byte of the class B address are the
network address, and the other two bytes are the host address.
ⅱ Class B address range: 128.0.0.0 - 191.255.255.255.
ⅲ The default subnet mask for Class B networks is 255.255.0.0, which can also be written as /16.
ⅳ The maximum number of hosts in a class B network is 256×256-2=65534.
c. Class C Address
ⅰ The first byte of the C class address (the highest bit is fixed at 110), the second byte, the third
byte, and the other 1 byte are the host address.
ⅱ Class C address range: 192.0.0.0 - 223.255.255.255.
ⅲ The default subnet mask of a Class C network is 255.255.255.0, which can also be written as
/24.
ⅳ The maximum number of hosts in a class C network is 256-2=254.
d. Class D Address
ⅰ Class D address is not divided into network address and host address. The highest bit of the first
byte is fixed at 1110.
ⅱ Class D address is used for multicast (also known as multicast) address without a subnet mask.
ⅲ Class D address range: 224.0.0.0 - 239.255.255.255.
e. Class E Address
ⅰ Class E address is also not divided into network address and host address. The highest bit of the
first byte is fixed at 11110.
ⅱ Class E address range: 240.0.0.0 - 255.255.255.255.
ⅲ Among them, 240.0.0.0-255.255.255.254 is the reserved address, mainly used for Internet
experiment and development. 255.255.255.255 is the broadcast address.
5. special IP address
ⅰ The address whose host ID is all 0: refers to a certain network segment. For example:
192.168.10.0 255.255.255.0, refers to the 192.168.10.0 network segment.
ⅱ Addresses whose host ID are all 1: refer to all hosts in the network segment. For example:
192.168.10.255. If a computer sends data packets, using the IP address whose host ID is all 1, use
the broadcast address FF-FF-FF-FF-FF-FF for the data link layer address.
ⅲ 127.0.0.1 is the local loopback address, which refers to the local address and is generally used
for testing.
ⅳ 169.254.0.0-169.254.255.255 is actually an automatic private IP address.
ⅴ 0.0.0.0: If the computer's IP address conflicts with other computer address on the network, using
the ipconfig command will see 0.0.0.0. Besides, the subnet mask will also be 0.0.0.0.
Practice part
Part 1: IP Subnetting
1. Objectives
a. To study the characteristics of IP and Subnet.
b. To study the method of IP setting and subnet mask setting.
2. Equipment
a. Two 24-port Catalyst switch 2950
b. Four PCs
c. A router-PT
Result as follow:
c. Configure the IP network address and subnet mask on PC0, PC1, PC4 and PC5. Respectively,
as shown in the follow table. (Refer to Appendix C on how to configure a host).
PC0 PC1 PC4 PC5
IP Address 10.0.0.2 10.0.0.3 11.0.0.2 11.0.0.3
Subnet mask 255.0.0.0 255.0.0.0 255.0.0.0 255.0.0.0
How to configure?
Results as follows:
d. Verify to insure successful connects between the PCs by using the “ping” function from the
Command Prompt Window.
C:\>ping PC IP address
1 Switching:
1.1 Concept of switching:
In computer networks, switching means to connect one telephone line to another so
that they can transmit data to each other.
1.2 Types of communication
1.2.1 Circuit switching:
Circuit switching is a switching method for the purpose of circuit connection.
Before communication, a physical channel is established between the two
communication parties.
1.2.2 Packet (datagram) switching:
Packet switching is transmitted and switched in the unit of packets. It is a store-
forward switching mode. Packets that are about to arrive at the switch are first
sent to the memory for temporary storage and processing, and then sent out when
the corresponding output circuit is idle.
1.3 Circuit switching
Circuit switching has three stages: establishing a connection, communicating, and
releasing a connection.
The most classic circuit switching system is the telephone system:
2 Switch
To implement packet switching, switches appeared. A switch is a network device used to
forward electrical (optical) signals. It can provide exclusive electrical signal pathways for any
two network nodes of the access switch. The most common switch is an Ethernet switch.
Other common are telephone voice switch, Fiber Channel switch and so on.
2.1 Collision domain
A collision domain is a region to which data must be sent. HUB is a signal driver
without intelligence, and the whole network composed of hubs is a conflict domain. The
network under an interface of a switch is a conflict domain, so the switch can isolate the
conflict domain.
2.2 Broadcast domains
The area to which data can be sent when broadcast is a broadcast domain. Switches and
hubs are transparent to broadcast frames, so a network of switches and hubs is a
broadcast domain. A router's interface under the network is a broadcast domain. So, the
router can isolate the broadcast domain.
2.3 Working principle:
The switch can "learn" the MAC address and store it in an internal address table, making
the data frame go directly from the source address to the destination address by
establishing a temporary exchange path between the originator and the destination
receiver of the data frame.
2.4 Forwarding decision:
The switch's forwarding decision has three operations: drop, forward, and diffusion.
- Filter: If the port on which the switch receives the data frame is the same as the
port on which it forwards the data frame, the switch discards the data frame and
does not forward the data frame.
- Forwarding: Forwards the packets when a host on a port accesses a host on a
known port.
- Flooding: When a host connected to a port accesses a host connected to an
unknown port, the host needs to be diffused.
The MAC address of the sender is recorded for each operation, so that other hosts can
access it.
Part of Practice I
3 Implement the switch working principle
First, create the following topology on the packet tracer and configure the IP address and
mask of each PC.
Enter the simulation mode and view the MAC address table of the switch in the initial state.
Q1:If PC2 sends a message to PC1, how does the packet propagate?
A1:Because the MAC address table of the switch is empty, the switch floods the
packet after receiving it, that is, it forwards the packet to all other ports.
After PC0 pings PC2, check the process and record the MAC address table.
Then it sends signals to other PCs and checks the MAC address table.
Finally, clear the MAC address table to test the broadcast domain and let PC0 send broadcast
frames.
Q2:If PC2 sends a message to PC1 again, how does the packet propagate?
A2:In this case, the MAC address of PC1 already exists in the MAC address
table. Therefore, the switch directly forwards the packet to the port connected to
PC1.
4 VLAN (Virtual Local Area Network)
A virtual local area network (VLAN) is a communication technology that logically divides a
physical LAN into multiple broadcast domains. Each VLAN is a broadcast domain. Hosts in
a VLAN can directly communicate with each other, but VLANs cannot. In this way,
broadcast packets are restricted to a VLAN.
Early Ethernet is a data network communication technology based on CSMA/CD (Carrier
Sense Multiple Access/Collision Detection) sharing communication medium. When the
number of hosts is too large, there will be serious conflicts, broadcast flooding, performance
degradation and even network unavailability. Although LAN interconnection through Layer 2
devices can resolve serious conflicts, it still fails to isolate broadcast packets and improve
network quality. In this case, VLAN technology appears.
In this way, a LAN can be divided into multiple logical VLANs. Each VLAN is a broadcast
domain. Hosts in a VLAN can communicate with each other just as in a LAN.
Part of practice II
5 Implement a simple VLAN with two switches
Build the following topology diagram and configure the IP of each PC:
The connectivity test shows that although PC0 and PC1 are in the same network segment,
they cannot communicate with each other because they are in different VLANs.
Part3 Routing
Routing
1. Objectives
2. Equipment
a. A router
b. Two switches
c. 4 PCs
We use one router, two switches and four hosts to connect the two subnets. Its topology is
shown below.
\
Figure 1
B. Assign IP addresses, masks, and gateways to PCS and switches on each subnet, as shown
in chart 1.
Q1. Why should the IP address of the computer be the same subnet as the IP address of
the gateway to access the Internet?
Ans:_______________________________________________________________________
___________________________________________________________________________
C. Create vlan1.
D. Switch to the interface mode and add the interface Fa0/2 , Fa0/3 and Fa0/4 to vlan1.
E. Creating vlan2 and repeating the process, we end up with the result shown in Figure 2.
Figure 2
Q3. Can we now implement communication between PC0 and PC1? What about PC0 and
PC2?
Ans:_______________________________________________________________________
___________________________________________________________________________
Q4.Does the router's IP address have to be the same as the default gateway?
Ans:___________________________________________________________________________
_______________________________________________________________________
Q5:Must the gateway ip address and any interface ip address have the same subnet?
Ans:_______________________________________________________________________
___________________________________________________________________________
Ans1: The gateway is meant to generate a default route. Default routing means: Who should I send
a packet to when the object I want to communicate with is not in my subnet?
When you specify a gateway, the gateway must be on the same network segment as your
computer. Otherwise, the computer cannot figure out how to reach the gateway, that is, the
computer does not know the exit of the current subnet.
Ans2: The trunk function is used to cascade switches. By sacrificing the number of ports, the trunk
function provides bundled high bandwidth for data exchange between switches, improving
network speed, breaking through network bottlenecks, and greatly improving network
performance.
Ans3: PC0 and PC1 can communicate. Because they have the same subnet mask and gateway.
PC0 and PC2 cannot communicate because they have different gateways.
Ans4: The ip address of the router does not have to be the same as the default gateway. The
gateway is shared by all hosts in the LAN, that is, the router address.
The default gateway must be the ip address of the router, because the network egress of all hosts in
the LAN is the port of the route. The ip address of the router (the default gateway of the host) must
be on the same network segment as the ip addresses of all hosts, but cannot conflict.
Ans5: Yes. If your PC needs to access the Internet through a router or access a different network
segment, you must set the IP address of the PC and the IP address of the port connected to the
router to be on the same network segment. Otherwise, the PC cannot access the Internet or
communicate across network segments.