Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Static routing principle and configuration

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Routers work at the network layer of the IOS reference model and their primary role is to select the best path for packets

Route Overview

Routing: The process of forwarding from a source host to a destination host

How routers work

Forward data according to routing tables

routing table formation routing table

(1) A collection of routing entries maintained in a router

(2) Routers select paths according to routing tables

Routing table formation

(1) Directly connected network segment, configure IP address, port UP state, form directly connected route

(2) Non-direct network segment

static route and default route static route

(1) manually configured by the administrator, one-way

2) Lack of flexibility

default route

when the router cannot find a routing entry for the destination network in the routing table, the router forwards the request to the default routing interface

Priority of routes

When both static routes and default routes exist in the routing table, the static route has the highest priority and is forwarded immediately if it does not match. If it does not match the static route, it is forwarded according to the default route.

Encapsulation process of data packet forwarded by router

As shown in the figure above, computer A communicates with computer B. Computer A only knows the IP address of computer B, and pings the other party through the router A and router B.

(1) Computer A only knows the IP address of router A. To obtain the MAC address of router A, computer A must first send an ARP broadcast to port E0 of router A.

Source IP: 192.168.1.2

Source MAC: 00-11-12-21-11-11

Target IP: 192.168.1.1

Target MAC: FF-FF-FF-FF-FF-FF

(2) After receiving the packet at port E0 of router A, the packet corresponds to the IP address and replies to computer A. After receiving the packet, computer A records the MAC address of the source router A.

(3) Computer A starts to ping computer B, sending a data to port E0 of router A.

Source IP: 192.168.1.2

Source MAC: 00-11-12-21-11-11

Target IP: 192.168.2.2

Target MAC: 00-11-12-21-22-22

(4) After receiving the data, check the destination MAC address, unpack the data packet to expose the source IP and destination IP, and router A queries the network segment of the destination IP address from the routing table to find the path to port E1.

(5) Port E1 of router A begins to encapsulate MAC address header and prepares to send data packet to port E1 of router B. Because it does not know MAC address of router E1, router A directly discards data packet.

(6) Port E1 of router A sends ARP broadcast to port E1 of router B.

Source IP: 10.1.1.1

Source MAC: 00-11-12-21-33-33

Target IP: 10.1.1.2

Target MAC: FF-FF-FF-FF-FF-FF

(7) After receiving the broadcast, the E1 port of router B unpacks and checks the IP address to generate a response. The E1 port of router A also records the MAC address of the E1 port of router B. After the second piece of data reaches the E1 port of router A, it is re-encapsulated.

Source IP: 192.168.1.2

Source MAC: 00-11-12-21-33-33

Target IP: 192.168.2.2

Target MAC: 00-11-12-21-44-44

(8) Router B confirms the MAC address at port E1, and then unpacks to expose the source IP and destination IP. Router B queries the network segment of the destination IP address from the routing table to find the path to port E0.

(9) Port E0 of router B begins to encapsulate MAC address header and prepares to send data packet to computer B. Because it does not know MAC address of computer B, router directly discards data packet.

(10) Router B sends ARP broadcast to computer B on port E0

Source IP: 192.168.2.1

Source MAC: 00-11-12-21-55-55

Target IP: 192.168.2.2

Target MAC: FF-FF-FF-FF-FF-FF

(11) Computer B receives the packet and generates a response to the E0 port of router B. Port E0 also records the MAC address of computer B.

The MAC header is re-encapsulated after the next piece of data arrives at port E0

Source IP: 192.168.1.2

Source MAC: 00-11-12-21-55-55

Target IP: 192.168.2.2

Target MAC: 00-11-12-21-66-66

(12) Computer B starts responding after receiving the confirmation data message.

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report