In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Experimental case of static routing principle and configuration
The router works at the network layer of the OSI reference model, and its important role is to choose the best path for the packet and finally reach the destination.
The following figure is an example of how the following routing techniques look:
In a network with only one network segment, packets can easily reach the destination host from the source host. However, if a computer wants to communicate with a computer that is not on its own network segment, the packet will go through many routers. As shown in the figure above, the network segment of host An and host B is separated by many routers, and if the two hosts need to communicate, they have to go through these routers in the middle. The most important question at this time is how to choose the path to the destination. Packets have multiple paths to choose from from host A to host B, but it is clear that one of these paths is always the best and fastest. Therefore, in order to improve the access speed of the network, there needs to be a way to determine the best path from the source host to the target host for forwarding, this is the routing technology!
So don't talk too much nonsense, let's go to the experimental part first, and then make up the theoretical knowledge of routing.
The main purpose of today's experiment is to simulate two routers and two PCs to connect different network segments with network cables and configure IP addresses through GNS3.
1. First open GNS3 and create two routes and two PC. Next step:
two。
Connect them through a network cable and configure different interfaces and IP addresses, as shown in the figure:
3. After the connection is complete, double-click R1 R2 PC1 PC2 to open it for easy operation, as shown in the figure:
4.
To configure the word IP address on the R1 port, first enter the command conf t to enter global mode
Then enter int f0amp 0 to enter the f0apax 0 interface, and then you can start to configure the IP address.
Pay attention to three elements when matching IP address
① entry interface
② address allocation
③ no shutdown
At this point, you can open the interface, otherwise with the address, the interface is always down.
In the same way, you can configure IP on the F0can1 interface routed to R1.
5. After the configuration is complete, how can I check the IP address?
You can type do show ip int b to check. As shown in the figure:
At this point, we can see that the IP addresses of R1 routes have been set up and are in the up-up state.
6. How do I view the routing table? Enter do show ip route to view the routing table across modes. At this time, we find that an entry has been automatically generated on the routing table, and the C next to it represents connected, that is, a directly connected network segment. As long as the interface is equipped with an IP address to open the port, the entry will be automatically written. At this point, we find that we have not yet configured static, and we will configure static routes in the next step. As shown in the figure:
7. Let's go back to global mode because the static route is configured in global mode, not on the interface. Enter ex to return. The configuration of static routes is to enter the command: Ip route followed by the destination network number (non-directly connected network segment) + subnet mask + next-hop address. As shown in the figure:
8. After the configuration is complete, we enter do show ip route to view the routing table again and find that the static route has been set up.
You can remember a rule here: when you put all the addresses on the route on your routing table, you must be able to communicate with each other. As shown in the figure:
Similarly, set a static route for R2 and configure an IP address for the interface, as shown in the figure:
9. Now that the configuration of R1 and R2 is complete, you can configure the IP address and gateway for PC1 PC2, as shown in the figure:
When the configuration is complete, we use the ip address of PC1 ping PC2 to see if it is interconnected. As shown in the figure:
The communication is successful!
10. At this point, we can think about the question: if we set R2 as the default routing address, will PC1 and PC2 still communicate with each other? Let's give an answer here!
Let's turn R2 off and on, so that the configuration of R2 that we set up before will be gone. Let's reopen R2 and configure the interface IP addresses of F0Unix 0 and F0Unix 1. At the same time, we began to set up the default route for R2:
Enter the ip route 0.0.0.0 0.0.0.0 + ip address. The default route for completing R2 can be set. As shown in the figure:
11. After the setup is complete, we open PC1 again and make it ping with PC2 again, and the interconnection is successful!
The experiment is complete!
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.