Computer Network Technology and Application
Chapter 17 Network Interconnection Technology
Chapter 17 Network Interconnection Technology (2)
3. Example of subnet addressing
[Example 5-1] Assume that a network has applied for a class B address 146.10.0.0, and it needs to be divided into 6 subnets. How to divide the subnets and host IP addresses?What is the subnet address range?
规划:划分6个子网,需要在第3字节取高3位来编码这6个子网;这样划分共有8个子网,其中两个作为扩展。二进制范围:
146.10.00000000.0~146.10.00011111.0→ 146.10.0.0~146.10.31.0
146.10.00100000.0~146.10.00111111.0→ 146.10.32.0~146.10.63.0
146.10.01000000.0~146.10.01011111.0→ 146.10.65.0~146.10.95.0
146.10.01100000.0~146.10.01111111.0→ 146.10.96.0~146.10.127.0
146.10.10000000.0~146.10.10011111.0→ 146.10.128.0~146.10.159.0
146.10.10100000.0~146.10.10111111.0→ 146.10.160.0~146.10.191.0
146.10.11000000.0~126.10.11011111.0→ 146.10.192.0~146.10.223.0
146.10.11100000.0~126.10.11111111.0→ 146.10.225.0~146.10.255.0
The subnet mask is changed from the default 255.255.0.0 to 255.255.224 (11100000).0
[Example 5-2] The subnet mask code of a class B network is 255.255.248.0. How many subnets can this network be divided into?What is the maximum number of hosts per subnet?
(1)子网掩码的第3字节共占用高5位(11111),最多可以编出25=32个子网。
(2)第3字节余下3位+第4字节的8位,共11位,可以编出211=2048个主机地址。
Note: All "0" and all "1" should be removed from the host address.
5.3.5 Classless (supernetting) addressing
1. No category
In 1992, the introduction of CIDR (Classless Inter Domain Routing) means that the concept of address "class" at the network level has been canceled and replaced by the concept of "network prefix".
"Classless" means a routing strategy, which is based on the 32-bit IP address mask operation. It no longer cares whether the IP address is Class A, Class B or Class C, so that multiple consecutive Class C addresses or Class B addresses are used in combination.This representation does not see standard classification, and classless network addressing combines consecutive network addresses into a network that loads more hosts.For example, multiple C-class addresses can be combined into a continuous address space, breaking through the limitation that addresses must be divided according to the three basic units of classful addresses.It turns out that the use of CIDR already slows down address consumption somewhat.
2. Addressing method
Now give an example to illustrate the classless addressing method.
[Example 5-3] Assuming that the consecutive addresses applied for are 223.1.185.0~223.1.191.0, the binary representation is:
11011111.00000001.10111000.00000000~11011111.00000001.10111111.00000000如果不考虑第3字节的低3位(作为主机地址位),那么第3字节的高5位都是184,也就是说这组连续的地址构成了一个前缀(前缀长度为21)是223.1.184的网络,掩码为255.255.248.0。这样,这个连续网络的主机位数就可以达到11位。通过以上过程,我们就把网络的主机范围扩大了很多。
无分类地址的表示法,以上面地址为例。223.1.185.0/21表示地址掩码为21位(高位21个1,其余为0),高位21位为网络地址标识,低位11位为主机标识。
Main points and steps of this question:
Apply for a continuous Class C address.
Find all addresses with the same prefix.
Determine the subnet mask digits, which should be the same as the prefix digits.
Determines the number of bits to identify the host (32 minus the number of prefix bits).
Note: No classification method can also reduce the space of the host, such as 223.1.185.0/27, only the lower 5 bits are used to identify the host.
5.4 Routing Protocols
Routers run three-layer protocols: physical layer, data link, and network layer protocols. Generally, routing protocols are located at the network protocol layer.
The work of a router includes two basic contents: finding a route and forwarding, and the routing selection algorithm determines the best path to the destination.
In order to determine the best path, a router must start and maintain a routing table containing routing information, and the routing information depends on the routing algorithm used and is not the same.
The routing selection algorithm will update the routing table with different information collected, and tell the router the relationship between the destination network and the next hop (nexthop) according to the routing table.
Routers exchange routing information, update and maintain the routing table to correctly reflect changes in the network topology, and the router determines the best path based on the weight.
In short, routing must complete two tasks, one is to collect network topology information for the establishment of routing tables, and the other is to select the best path and forward data packets.Both tasks are performed by routing protocols.
5.4.1 RIP protocol and distance vector selection algorithm
Routing Information Protocols (RIP), the most widely used distance vector protocol, was developed by Xerox in the 20s.At the time, RIP was part of the Xerox Network Service (XNS) protocol system.
The TCP/IP version of RIP is an improved version of the Xerox protocol. The biggest feature of the RIP protocol is that it is very simple in terms of implementation principle and configuration method, but it is not suitable for large-scale networks, and the protocol works at the application layer instead of the network layer.
1. Measurement method
The measurement of RIP is based on the hop count (Hops Count). Every time a path passes through a router, the hop count of the path is increased by 1.The more hops, the longer the path. The RIP algorithm will preferentially select paths with fewer hops. The maximum hop count supported by RIP is 15, and a network with a hop count of 16 is considered unreachable.
2. Routing update - distance vector method
Routing updates in the RIP protocol are implemented through scheduled broadcasts.By default, a router broadcasts its own routing table to its adjacent routers every 30s; routers that receive the broadcast will add the received information to their own routing table.
Under normal circumstances, the router can receive a confirmation of routing information every 30s; if after 180s, no routing entry is confirmed, the router considers this update invalid; Delete items related to this router in .
3. Defects of RIP
Although RIP is simple and easy to implement, and has been tested for a long time, it also has some important defects, mainly as follows.
(1) It is too simple, and calculates the metric value based on the number of hops, often resulting in a non-optimal route.
(2) The metric value is limited to 16, which is not suitable for large networks.
(3) Poor security, accepting routing updates from any device.
(4) The convergence is slow, and the general time is longer than 5 minutes. Once there is a network failure, a deadlock phenomenon will occur.
(5) Consuming network resources, etc.
5.4.2 OSPF protocol
In the mid-20s, RIP could no longer meet the interconnection requirements of large-scale heterogeneous networks, and the OSPF protocol came into being.It is a routing protocol developed by the IETF's Interior Gateway Protocol Working Group (an organization of the Internet) for IP networks.
OSPF is a link-state-based routing protocol, requiring each router to send link-state broadcast information to all other routers in the same autonomous domain (same broadcast domain).
Include all network interface information, all metrics, and other variables in OSPF link state broadcasts.Routers using OSPF must first collect relevant link state information, and calculate the shortest path to each node according to a certain algorithm.
The Internet is divided into several autonomous regions, such as China Education and Research Network, China Netcom Network, etc., are all autonomous regions. OSPF divides an autonomous domain into areas, corresponding to two types of routing methods.
(1) When the source and destination are in the same area, use intra-area routing.
(2) When the source and destination are in different areas, the interval routing is used.
Doing so can greatly reduce network overhead and increase network stability.When a router in one area fails, it does not affect the normal operation of routers in other areas in the autonomous domain, which brings convenience to network management and maintenance.
It should be noted that the OSPF protocol uses an algorithm known as the shortest path first (Shortest Path First, SPF), this algorithm requires each router to keep an up-to-date topology database about the entire network, so the router not only clearly knows Whether a specified network can be reached from this router, and if it can be reached, the shortest path and which routers will be passed through the path can be selected.
The method of OSPF is called link state algorithm, which uses link state packets (Link State Packets, LSP), network topology database, and path selection algorithm to finally calculate the shortest path from the router to other target networks.These paths are written into the routing table.
5.4.3 Static and dynamic routing
For routing, static routing and dynamic routing can be used for management.
1. Static routing
Static routing refers to setting a fixed routing table in the router. Unless the routing table is artificially changed, the static routing will not change.Since static routing cannot respond to network changes, it is generally used in a network with a small network and a fixed topology.
The advantages of static routing are simplicity, efficiency, and reliability.Among all routes, static routes have the highest priority.When a dynamic route conflicts with a static route, the static route prevails.
2. Dynamic Routing
Dynamic routing is a process in which routers in the network communicate with each other, transfer routing information, and use the received routing information to update the routing table.
Dynamic routing can adapt to changes in the network structure in real time.If the routing update indicates that a network change has occurred, the routing algorithm will recalculate the route and issue a new routing update.The information passes through each network, causing each router to restart its routing algorithm and update its own routing table to dynamically reflect network topology changes.
Dynamic routing is applicable to networks with large network scale and complex network topology.Of course, various dynamic routing protocols will occupy network bandwidth and CPU resources to varying degrees.
Static routing and dynamic routing have their own scope of application, so dynamic routing is usually used as a supplement to static routing in the network.When a packet is routed in a router, the router first looks for a static route.If it is found, forward the packet according to the corresponding static route, otherwise search for a dynamic route.
5.4.4 Direct routing and indirect routing
1. Direct Routing
In a local network, only direct routing is used when data packets are passed from one computer to another.In other words, the source and destination network addresses of the data packet are the same and belong to the same network, so the data packet does not need to be forwarded through the routing device.
2. Indirect routing
The source and destination network addresses of the data packets are different and belong to different networks. The sender needs a router to forward it to the destination computer.There may be several networks in the middle, and indirect routing is used in this way.
3. Know the routing table
There is a routing table in the router, which is used to point out the routing information to the destination (which may be a network or a computer).The router selects a route for the data packet to reach the destination by consulting this table.
Taking the Internet as an example, the routing table usually contains multiple (N, R) routing information pairs, where N is the IP address of the destination network, and R is the IP address of the "next hop" router to reach network N.In the routing table, only the next step on the path from this router to the destination network is specified, and the complete path to the destination site is not included.
The size of the routing table depends only on the number of networks in the Internet, not on the number of connected computers. IP routing only maintains information about the destination network address and has nothing to do with computer address information.
On the Internet, tens of millions of computers need to send data, and the entries in the routing table will expand infinitely. A technique to hide information and keep the routing table as small as possible is to use the default route.Let IP routing first look up the destination network in the routing table, and if there is no route in the table, send the packet to a default router.This default routing is particularly effective when a network has few addresses and only one connection to other networks, and the routing method is simple.
Below we will use some routing tables as an example to illustrate the routing selection process.
(End of this chapter)
3. Example of subnet addressing
[Example 5-1] Assume that a network has applied for a class B address 146.10.0.0, and it needs to be divided into 6 subnets. How to divide the subnets and host IP addresses?What is the subnet address range?
规划:划分6个子网,需要在第3字节取高3位来编码这6个子网;这样划分共有8个子网,其中两个作为扩展。二进制范围:
146.10.00000000.0~146.10.00011111.0→ 146.10.0.0~146.10.31.0
146.10.00100000.0~146.10.00111111.0→ 146.10.32.0~146.10.63.0
146.10.01000000.0~146.10.01011111.0→ 146.10.65.0~146.10.95.0
146.10.01100000.0~146.10.01111111.0→ 146.10.96.0~146.10.127.0
146.10.10000000.0~146.10.10011111.0→ 146.10.128.0~146.10.159.0
146.10.10100000.0~146.10.10111111.0→ 146.10.160.0~146.10.191.0
146.10.11000000.0~126.10.11011111.0→ 146.10.192.0~146.10.223.0
146.10.11100000.0~126.10.11111111.0→ 146.10.225.0~146.10.255.0
The subnet mask is changed from the default 255.255.0.0 to 255.255.224 (11100000).0
[Example 5-2] The subnet mask code of a class B network is 255.255.248.0. How many subnets can this network be divided into?What is the maximum number of hosts per subnet?
(1)子网掩码的第3字节共占用高5位(11111),最多可以编出25=32个子网。
(2)第3字节余下3位+第4字节的8位,共11位,可以编出211=2048个主机地址。
Note: All "0" and all "1" should be removed from the host address.
5.3.5 Classless (supernetting) addressing
1. No category
In 1992, the introduction of CIDR (Classless Inter Domain Routing) means that the concept of address "class" at the network level has been canceled and replaced by the concept of "network prefix".
"Classless" means a routing strategy, which is based on the 32-bit IP address mask operation. It no longer cares whether the IP address is Class A, Class B or Class C, so that multiple consecutive Class C addresses or Class B addresses are used in combination.This representation does not see standard classification, and classless network addressing combines consecutive network addresses into a network that loads more hosts.For example, multiple C-class addresses can be combined into a continuous address space, breaking through the limitation that addresses must be divided according to the three basic units of classful addresses.It turns out that the use of CIDR already slows down address consumption somewhat.
2. Addressing method
Now give an example to illustrate the classless addressing method.
[Example 5-3] Assuming that the consecutive addresses applied for are 223.1.185.0~223.1.191.0, the binary representation is:
11011111.00000001.10111000.00000000~11011111.00000001.10111111.00000000如果不考虑第3字节的低3位(作为主机地址位),那么第3字节的高5位都是184,也就是说这组连续的地址构成了一个前缀(前缀长度为21)是223.1.184的网络,掩码为255.255.248.0。这样,这个连续网络的主机位数就可以达到11位。通过以上过程,我们就把网络的主机范围扩大了很多。
无分类地址的表示法,以上面地址为例。223.1.185.0/21表示地址掩码为21位(高位21个1,其余为0),高位21位为网络地址标识,低位11位为主机标识。
Main points and steps of this question:
Apply for a continuous Class C address.
Find all addresses with the same prefix.
Determine the subnet mask digits, which should be the same as the prefix digits.
Determines the number of bits to identify the host (32 minus the number of prefix bits).
Note: No classification method can also reduce the space of the host, such as 223.1.185.0/27, only the lower 5 bits are used to identify the host.
5.4 Routing Protocols
Routers run three-layer protocols: physical layer, data link, and network layer protocols. Generally, routing protocols are located at the network protocol layer.
The work of a router includes two basic contents: finding a route and forwarding, and the routing selection algorithm determines the best path to the destination.
In order to determine the best path, a router must start and maintain a routing table containing routing information, and the routing information depends on the routing algorithm used and is not the same.
The routing selection algorithm will update the routing table with different information collected, and tell the router the relationship between the destination network and the next hop (nexthop) according to the routing table.
Routers exchange routing information, update and maintain the routing table to correctly reflect changes in the network topology, and the router determines the best path based on the weight.
In short, routing must complete two tasks, one is to collect network topology information for the establishment of routing tables, and the other is to select the best path and forward data packets.Both tasks are performed by routing protocols.
5.4.1 RIP protocol and distance vector selection algorithm
Routing Information Protocols (RIP), the most widely used distance vector protocol, was developed by Xerox in the 20s.At the time, RIP was part of the Xerox Network Service (XNS) protocol system.
The TCP/IP version of RIP is an improved version of the Xerox protocol. The biggest feature of the RIP protocol is that it is very simple in terms of implementation principle and configuration method, but it is not suitable for large-scale networks, and the protocol works at the application layer instead of the network layer.
1. Measurement method
The measurement of RIP is based on the hop count (Hops Count). Every time a path passes through a router, the hop count of the path is increased by 1.The more hops, the longer the path. The RIP algorithm will preferentially select paths with fewer hops. The maximum hop count supported by RIP is 15, and a network with a hop count of 16 is considered unreachable.
2. Routing update - distance vector method
Routing updates in the RIP protocol are implemented through scheduled broadcasts.By default, a router broadcasts its own routing table to its adjacent routers every 30s; routers that receive the broadcast will add the received information to their own routing table.
Under normal circumstances, the router can receive a confirmation of routing information every 30s; if after 180s, no routing entry is confirmed, the router considers this update invalid; Delete items related to this router in .
3. Defects of RIP
Although RIP is simple and easy to implement, and has been tested for a long time, it also has some important defects, mainly as follows.
(1) It is too simple, and calculates the metric value based on the number of hops, often resulting in a non-optimal route.
(2) The metric value is limited to 16, which is not suitable for large networks.
(3) Poor security, accepting routing updates from any device.
(4) The convergence is slow, and the general time is longer than 5 minutes. Once there is a network failure, a deadlock phenomenon will occur.
(5) Consuming network resources, etc.
5.4.2 OSPF protocol
In the mid-20s, RIP could no longer meet the interconnection requirements of large-scale heterogeneous networks, and the OSPF protocol came into being.It is a routing protocol developed by the IETF's Interior Gateway Protocol Working Group (an organization of the Internet) for IP networks.
OSPF is a link-state-based routing protocol, requiring each router to send link-state broadcast information to all other routers in the same autonomous domain (same broadcast domain).
Include all network interface information, all metrics, and other variables in OSPF link state broadcasts.Routers using OSPF must first collect relevant link state information, and calculate the shortest path to each node according to a certain algorithm.
The Internet is divided into several autonomous regions, such as China Education and Research Network, China Netcom Network, etc., are all autonomous regions. OSPF divides an autonomous domain into areas, corresponding to two types of routing methods.
(1) When the source and destination are in the same area, use intra-area routing.
(2) When the source and destination are in different areas, the interval routing is used.
Doing so can greatly reduce network overhead and increase network stability.When a router in one area fails, it does not affect the normal operation of routers in other areas in the autonomous domain, which brings convenience to network management and maintenance.
It should be noted that the OSPF protocol uses an algorithm known as the shortest path first (Shortest Path First, SPF), this algorithm requires each router to keep an up-to-date topology database about the entire network, so the router not only clearly knows Whether a specified network can be reached from this router, and if it can be reached, the shortest path and which routers will be passed through the path can be selected.
The method of OSPF is called link state algorithm, which uses link state packets (Link State Packets, LSP), network topology database, and path selection algorithm to finally calculate the shortest path from the router to other target networks.These paths are written into the routing table.
5.4.3 Static and dynamic routing
For routing, static routing and dynamic routing can be used for management.
1. Static routing
Static routing refers to setting a fixed routing table in the router. Unless the routing table is artificially changed, the static routing will not change.Since static routing cannot respond to network changes, it is generally used in a network with a small network and a fixed topology.
The advantages of static routing are simplicity, efficiency, and reliability.Among all routes, static routes have the highest priority.When a dynamic route conflicts with a static route, the static route prevails.
2. Dynamic Routing
Dynamic routing is a process in which routers in the network communicate with each other, transfer routing information, and use the received routing information to update the routing table.
Dynamic routing can adapt to changes in the network structure in real time.If the routing update indicates that a network change has occurred, the routing algorithm will recalculate the route and issue a new routing update.The information passes through each network, causing each router to restart its routing algorithm and update its own routing table to dynamically reflect network topology changes.
Dynamic routing is applicable to networks with large network scale and complex network topology.Of course, various dynamic routing protocols will occupy network bandwidth and CPU resources to varying degrees.
Static routing and dynamic routing have their own scope of application, so dynamic routing is usually used as a supplement to static routing in the network.When a packet is routed in a router, the router first looks for a static route.If it is found, forward the packet according to the corresponding static route, otherwise search for a dynamic route.
5.4.4 Direct routing and indirect routing
1. Direct Routing
In a local network, only direct routing is used when data packets are passed from one computer to another.In other words, the source and destination network addresses of the data packet are the same and belong to the same network, so the data packet does not need to be forwarded through the routing device.
2. Indirect routing
The source and destination network addresses of the data packets are different and belong to different networks. The sender needs a router to forward it to the destination computer.There may be several networks in the middle, and indirect routing is used in this way.
3. Know the routing table
There is a routing table in the router, which is used to point out the routing information to the destination (which may be a network or a computer).The router selects a route for the data packet to reach the destination by consulting this table.
Taking the Internet as an example, the routing table usually contains multiple (N, R) routing information pairs, where N is the IP address of the destination network, and R is the IP address of the "next hop" router to reach network N.In the routing table, only the next step on the path from this router to the destination network is specified, and the complete path to the destination site is not included.
The size of the routing table depends only on the number of networks in the Internet, not on the number of connected computers. IP routing only maintains information about the destination network address and has nothing to do with computer address information.
On the Internet, tens of millions of computers need to send data, and the entries in the routing table will expand infinitely. A technique to hide information and keep the routing table as small as possible is to use the default route.Let IP routing first look up the destination network in the routing table, and if there is no route in the table, send the packet to a default router.This default routing is particularly effective when a network has few addresses and only one connection to other networks, and the routing method is simple.
Below we will use some routing tables as an example to illustrate the routing selection process.
(End of this chapter)
You'll Also Like
-
Crossover Anime: Collecting Treasures from All Worlds Starting with Type-Moon
Chapter 261 1 hours ago -
Film and Television: Bao Zong has finance in his left hand and entertainment in his right.
Chapter 145 1 hours ago -
American comics: From the black robes to becoming the ultimate Doomsday
Chapter 359 1 hours ago -
American comic book: Invasion of the universe, even Wanda Gwen is shocked.
Chapter 331 1 hours ago -
Joyful Youth: Many Children, Many Blessings, Starting with Song Qian
Chapter 621 1 hours ago -
Walking in the Question and Answer System of Heroic Spirits
Chapter 675 1 hours ago -
A one-on-one fight against Regigigas? Is this the Elf Professor?
Chapter 504 1 hours ago -
Knight: In the Extreme Fox, opening a box turns him into a weirdo.
Chapter 892 1 hours ago -
Fairy: Heal Mirajane, Black Dragon Template
Chapter 177 1 hours ago -
Urban drama: Me! I collide with Bei Weiwei at the very beginning.
Chapter 307 1 hours ago