In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How a router works:
1. The router only cares about the "destination IP address" in the data.
2. The router extracts the destination IP address and matches the entries in the routing table:
If the match is successful, forward it.
If the match is not successful, it is discarded
Matching principle:
The longest matching principle.
Matching process:
For example-192.168.12.1 of R1 accesses 192.168.23.3 of target R3
1. First look at the routing table of R1-show ip route
S 192.168.23.0 / 24 [1/0] via 192.168.12.2
In the above entry, first check the subnet mask length / 24; it means that the entry only looks at the first 24 bits in the destination IP address; if the first 24 bits in the destination IP address are exactly the same as the first 24 bits in the routing entry, it means the match is successful and forwarded
If it is different from the 24 bits in front of the route entry, it means that the match failed and the packet is discarded
2. Determine whether the specified number of digits in the destination IP address is the same as the specified number of digits in the routing entry
If the same, forward
If it is different, discard
Nature of routing:
The routing function is realized through a "routing table"
Experiment:
1. Rename each router and configure the IP address:
R1:
Route > enable
Route# configuration terminal
Router (config) # no ip domain lookup
Router (config) # hostname R1
R1 (config) # interface gigabitEthernet0/1
R1 (config-if) # no shutdown
R1 (config-if) # ip address 192.168.12.1 255.255.255.0
R2:
Route > enable
Route# configuration terminal
Router (config) # no ip domain lookup
Router (config) # hostname R2
R2 (config) # interface gigabitEthernet0/1
R2 (config-if) # no shutdown
R2 (config-if) # ip address 192.168.12.2 255.255.255.0
R2 (config) # interface gigabitEthernet0/2
R2 (config-if) # no shutdown
R2 (config-if) # ip address 192.168.23.1 255.255.255.0
R3:
Route > enable
Route# configuration terminal
Router (config) # no ip domain lookup
Router (config) # hostname R3
R3 (config) # interface gigabitEthernet0/2
R3 (config-if) # no shutdown
R3 (config-if) # ip address 192.168.23.2 255.255.255.0
2. After configuring IP, we will find that there is no communication between them, so we will formally configure routing.
There are two types of routing configurations:
1. Static route:
I: the next hop address is port:
R1 (config) # ip route 192.168.23.0 255.255.255.0 gigabitEthernet0/1
R3 (config) # ip route 192.168.12.0 255.255.255.0 gigabitEthernet0/2
Ii: the next address is IP:
R1 (config) # ip route 192.168.23.0 255.255.255.0 192.168.12.2
(network segment) (subnet mask) (next hop port IP)
R3 (config) # ip route 192.168.12.0 255.255.255.0 192.168.23.1
It is recommended that when configuring static routes, use the second configuration mode; reduce the sending of ARP messages
2. Dynamic routing:
R1 (config) # router rip
R1 (config-router) # network 192.168.12.0 / / publish its own network segment
R2 (config) # router rip
R2 (config-router) # network 192.168.12.0 / / publish your own network segment
R2 (config-router) # network 192.168.23.0 / / publish your own network segment
R3 (config) # router rip
R3 (config-router) # network 192.168.23.0 / / publish your own network segment
3. Check after the configuration is completed:
R1# show ip route
Routing attributes:
Composition of route entries:
R1:
S: 192.168.1.0 / 24 [1ram 0] via 192.168.23.2 / / static route
Source IP address [administrative distance / metric] through next hop (device port IP)
Administrative distance (Admin Distance):
Indicates the stability of the route entry; the value range is 0-255; the smaller the value, the more stable it is; when the value reaches 255, it will not be placed in the routing table.
Each type of route has a default administrative distance
For example, the administrative distance of directly connected routes is 0, and the administrative distance of static routes is 1.
Measure (metric):
Indicates the distance from the router to the destination network segment; the smaller the better.
For both directly connected and static routes, the metric is 0 and cannot be changed
Note:
When there are multiple entries to the same network, the routing attributes are compared.
Select an optimal one and put it in the routing table:
1. Compare AD first. The smaller the better.
2. If the AD is the same, compare the Metric. The smaller the better.
3. If they are all the same, they will be put into the routing table at the same time to form a "load balancing".
Egress Link backup configuration:
Floating static route-that is, adjust the administrative distance of the egress static route to a non-default value
R1 (config) # ip route 192.168.2.0 255.255.255.255 192.168.12.2 / / main link
R2 (config) # ip route 192.168.1.0 255.255.255.255 192.168.12.1 / / main link
R1 (config) # ip route 192.168.2.0 255.255.255.255 192.168.21.2 9 / / the routing AD of the backup link is adjusted to 9
R2 (config) # ip route 192.168.1.0 255.255.255.255 192.168.21.1 9 / / the routing AD of the backup link is adjusted to 9
Test steps:
1. After the configuration is completed, check the routing table of R2. Only the main link route enters.
2. Close the port connected to R1 on R2 (simulate the failure of the main link), and back up the link.
The corresponding route (administrative distance is 9) enters the routing table
3. Open the port connected to R1 on R2 (simulate the repair of the main link failure), and back up at this time.
The route corresponding to the link "jumps out" of the routing table, and the main link route enters
Note:
As we said before, layer 3 switches also have routing functions.
For some models of multilayer switches, routing is not enabled by default
SW# configuration terminal
SW (config) # ip routing / / enable routing
R1#show ip route / / Open the routing table
Codes: l-local, C-connected, S-static, R-RIP, M-
Mobile, B-BGP
In the display, if there is "codes", the routing function is enabled.
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.