In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Static routing (English: Static routing) is a way of routing in which routing items (routing entry) are manually configured rather than dynamically determined. Unlike dynamic routes, static routes are fixed and will not change, even if the network condition has changed or has been reconfigured. Generally speaking, static routes are added to the routing table item by item by the network administrator.
What is the static route reencapsulation process? It can be understood by the following two pictures
Can't you read the picture? It doesn't matter, the encapsulation process of the static route is simply 1Mui 2mi 3MUMI 4, and the final data frame format received by the target machine is similar to figure 2.
The complex point consists of the following five steps:
1. HostA sends out a data frame and sends it to the E0 interface of A route, which contains ip and MAC of its own ip, MAC and E0 interfaces (if HostA is the first time to send to A route, it needs to be broadcast using ARP protocol, and the destination MAC of the broadcast is FFFF-FFFF-FFFF-FFFF to obtain the MAC of A routing E0 interface)
2. After receiving the data frame sent by HostA, the A routing E0 interface first compares whether the destination MAC is itself (if not, it is discarded directly). After the comparison, the data frame is unencapsulated and the packet is left behind. Through the comparison between the destination ip in the ip header of the packet and the routing table, the packet is moved to the A routing E1 interface, and the remaining MAC header is discarded.
3. The packet is re-encapsulated on the A routing E1 interface to add the source and destination MAC address to the original packet (first, the next hop ip is obtained by comparing the routing table, and then the next hop MAC is obtained by comparing the ARP table. If it is sent for the first time, it still needs to be broadcast by ARP)
4. Here, the A routing E1 interface sends the re-encapsulated data frame to the B routing E1 interface, which is the same as step 2, and carries out the process of unblocking-comparing-re-encapsulating again, and sends the data frame to the HostB through the B routing E0 interface.
5. The source MAC of the data frame received by HostB should be the B-routed E0 interface MAC, and the destination MAC should be the MAC of HostB.
The above are the principles of static route forwarding. If you don't want to see it, you can skip to the following experiment.
The purpose of this experiment is to understand the principle of static route encapsulation and to complete the data exchange between different network segments by setting up a virtual switch and a virtual client.
First, complete the construction of the experimental environment and set up the settings of the two clients
1. Open GNS3 and drag and drop two switches and two clients to the work area through the icon bar on the left side of the program
2. Use the network cable tool to connect the four devices, and use the marking tool to mark the ip address and subnet mask of each interface (Note: 24 after the ip address means the subnet mask is 255.255.255.0) to facilitate the experiment. From left to right, the order is "192.168.5.5Compact 24", "192.168.5.1Accord24", "192.168.6.1Accord24", "192.168.6.2Compare 24", "192.168.7.1Compact 24", "192.168.7.7Accord 24" as shown in the figure.
3. Double-click PC1 and PC2 to enter the ip and gateway addresses indicated in the pop-up control window, namely "ip 192.168.5.5 192.168.5.1" and "ip 192.168.7.7 192.168.7.1" (here I am not using the console that comes with GNS3, but CRT)
After completing the first big step here, the remaining two switches need to manually add non-directly connected routes to the ip and routing tables of each interface (directly connected routes do not need to be added manually. They exist after the interface is specified with ip).
Add ip for two interfaces of R1, f0can0 and f0can1, and manually add routes that are not directly connected
1. Double-click the R1 route, enter "configure terminal" in the console to enter global mode, and then enter "interface fastEthernet 0ap0" to enter the interface mode of the f0mar0 interface.
2. Enter "ip address 192.168.5.1 255.255.255.0" in the interface mode of f0Uniq0 to specify ip for the interface of f0Univer0, and enter "no shutdown" to keep the interface open after entering enter.
3. Now, theoretically, we should type "end" to return the privileged mode, and then re-enter the global mode-f0Unix1 interface mode, which will be very troublesome and affect work efficiency. Is it possible to enter f0Univer 1 interface mode directly in the interface mode of f0pic0? The answer is yes. Enter "interface fastEthernet 0Unix1" directly in f0can0 interface mode, and set ip for f0can1 interface and keep it on.
4. Immediately enter "exit" to return to global mode from interface mode, and enter "ip route 192.168.7.0 255.255.255.0 192.168.6.2" to specify a static route for R1. Here, "192.168.7.0" is the segment on which R1 routes non-directly connected routes; "192.168.6.2" is the next-hop ip address, that is, the address of the next R2 routing interface (not yet specified, and will be set up later). Then enter "do show ip interface brief" to view the ip of each interface in global mode and how it is up, and then enter "do show ip route" to view the static routing table
Add ip to R2's two interfaces f0can0 and f0can1 and manually add routes that are not directly connected
The process is the same as R1 (concise and nonsense) the specific flow chart is as follows
4. Check the data exchange between the clients of two different network segments
Return to any client (I chose PC1 here) to test ping on another client.
The timeout occurs because the two clients and even the switch in the virtual environment are brand new, so the data interworking needs to be broadcast by ARP in advance. Similarly, because the topology of this experiment is relatively simple, the two routes have and only one interface for interconnection, so it meets the requirements of using the default route for interconnection, so we can choose a route to re-set the default route.
First, select the R2 route to restart without saving, and re-set the directly connected route for it.
Second, because the topology is simple and the specific structure is shown in the figure, R1\ R2 routes have only one interface for external interconnection.
What is the default route? To put it simply, the recipient ip cannot find a correspondence with the static route or directly connected route in the routing table before it will enter the default route. If no default route is set and the corresponding cannot be found in the table, the route will discard it directly.
3. Enter "ip route 0.0.0.0 0.0.0.0 192.168.6.1" in global mode to specify the default route. If the destination ip is not within the 192.168.6.0 or 192.168.7.0 network segments, enter the default route.
4. Then, as before, select a PC to communicate with another PC (here is the interworking between PC2 and PC1)
5. Please use the default route carefully. Once the default route is set for both routes in this topology, accidentally entering a non-existent ip during the ping experiment will make the two routers fall into an endless loop.
At this time, both routes set the default route, and the wrong ip was entered in the ping experiment, as a result. Forward indefinitely
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.