IP Routing Technology
IP Routing Technology
Foreword
⚫ In our network, there are many different IP network segments, and data interaction between different
segments is required with the help of Layer 3 devices. These devices have routing capabilities and can
forward data to different network segments.
⚫ Routing is a fundamental element in data communication networks. Routing information is the path
information that guides the forwarding of messages, and the routing process is the process of message
forwarding.
1. Routing Overview
2. Static Routing
3. Dynamic Routing
⚫ When the PC's NIC is transmiting data, the network layer will check whether the destination IP is in the same network
segment or not
➢ If belonging to a network segment, then ARP can be directly used to parse the MAC address of the destination IP directly
➢ If not belonging to a network segment, then ARP can be used to parse the MAC address of the gateway
⚫ Within a Layer 2 switched network (same broadcast domain/VLAN), hosts on different network segments cannot
communicate with each other directly
SW1 SW2
⚫ The process of receiving a packet from an interface, orienting and forwarding it based on the packet's destination IP
address
⚫ The router selects the next-hop address/outgoing interface and forwards data based on the routing table, enabling
communication across IP segments
Resolve destination
host hardware address
Y
N
Resolve gateway/next hop
hardware address
⚫ The communication process between PC1 and PC2 in the same LAN: PC1>ping 192.168.1.200
⚫ The communication process between PC1 and PC2 in the same LAN: PC1>ping 192.168.1.200
⚫ If the network number of the destination address is the same as the network number of any interface of
the router, the destination is located in the network segment directly connected to the corresponding
interface.
⚫ The router determines the address of the next hop router by looking up the routing information.
N Y
Whether the purpose IP
is directly connected
Encapsulated into a
frame, sent out by the
corresponding interface
Router Layer 3 Switches firewalls Export Gateway Servers with soft routing
capabilities
Routing
table
⚫ The next-hop address is determined by the routing table, and the default next-hop address of the PC
client is usually called the "gateway"
➢ As shown in the figure, PC2 wants to communicate with PC3
Router and PC3 belong to the same
LAN2, no need for next hop, directly
forwarding packets to PC3
192.168.1.254/24 192.168.2.254/24
Broadcast Domain Broadcast Domain
LAN1 LAN2
⚫ The next-hop address is the best path chosen by the routing device based on the routing table
➢ As shown in the figure, PC2 wants to communicate with PC3
172.16.1.2/30 172.16.1.5/30
172.16.1.1/30 172.16.1.6/30
R2
⚫ The routing table is the basis for the router's judgment in forwarding data messages.
172.16.1.2/30 172.16.1.5/30
F0/0 F0/1
172.16.1.6/30
172.16.1.1/30 F0/1
R2
F0/1 192.168.2.254/24
172.16.1.9/30 172.16.1.10/30 F0/0
192.168.1.254/24
F0/0 E0/0 10M Twisted Pair E0/0
F0/2
R1 R3 192.168.3.254/24
Routing table for R1
Routing Sources Destination Address/Mask next hop address Outlet interface Metric
Direct Connection Routing 10.13.1.0/24 192.168.1.254 F0/0 0
Direct Connection Routing 172.16.1.0/30 172.16.1.1 F0/1 0
Direct Connection Routing 172.16.1.8/30 172.16.1.9 E0/0 0
Dynamic Routing 192.168.2.0/24 172.16.1.2 F0/1 20
Dynamic Routing 172.16.1.4/30 172.16.1.2 F0/1 10
Static Routing 192.168.3.0/24 172.16.1.10 E0/0 0
⚫ Metric: A parameter used by routing protocols to measure the merit of a path. Denoting the sum of the cost of reaching
the destination
⚫ Factors Affecting Metric: line bandwidth, number of hops, line latency, line utilization, line confidence, etc.
Routing Type Metric Reference Factors
Static Routing 0
Dynamic Routing Protocol OSPF Bandwidth
Dynamic Routing Protocol RIP Hop count
172.16.1.2/30 172.16.1.5/30
F0/0 F0/1
172.16.1.6/30
172.16.1.1/30 F0/1
R2
F0/1 192.168.2.254/24
For the target network: 192.168.2.0/24
172.16.1.9/30 172.16.1.10/30 F0/0
If the entire network uses OSPF 192.168.1.254/24
If the entire network uses RIP E0/0 10M Twisted Pair E0/0
F0/0
F0/2
R1 R3 192.168.3.254/24
Target Administrative
Source Network Next hop IP Local Export
distance/Metrics
⚫ Administrative Distance, also called priority, is used to measure the trustworthiness of a routing source
⚫ The lower the administrative distance value, the higher the confidence level. Only the most trusted routings will be
added to the routing table
⚫ Administrative distance default value is vendor-defined Routing Sources
Default administrative
distance value
172.16.1.2/30 172.16.1.5/30
F0/0 F0/1 Direct Connection Routing 0
Static Routing 1
172.16.1.6/30
172.16.1.1/30 F0/1 Dynamic Routing OSPF 110
R2
F0/1 192.168.2.254/24
Dynamic Routing RIP 120
172.16.1.9/30 172.16.1.10/30 F0/0
192.168.1.254/24 Unreachable Routings 255
F0/0 E0/0 10M Twisted Pair E0/0
F0/2 1. Network-wide operation of RIP, new
R1 R3 192.168.3.254/24 RIP routing entries
⚫ Only the best path is added to the routing table, forming a routing entry
Compare Target
Networks • Put into routing table in different target networks
Compare
Administrative
• Manage the path with the lowest administrative distance into the
If equal
Distance routing table
Compare Metric
• The path with the lowest metric is placed in the routing
If equal table
⚫ The routing device looks up the routing table according to the longest subnet mask matching principle based on the
destination IP address of the packet
⚫ Forwarding based on query results
⚫ If the query is unsuccessful, the packet is dropped
When the destination IP of the packet is 172.16.1.1, it will be forwarded by the F0/1 interface
172.16.1.0/24 F0/1
When the destination IP of the packet is 172.16.2.1, it will be forwarded by the F0/2 interface
1. Routing Overview
2. Static Routing
3. Dynamic Routing
⚫ The routing information configured manually by the network administrator, when the network topology
changes, the administrator needs to manually modify the static routing information
⚫ Static routing information is locally valid and will not be passed on to other routers
⚫ Static routing is generally suitable for relatively simple network environments, large and complex network
environments are usually not suitable for static routing
⚫ The benefits of using static routings are high network security and confidentiality
⚫ Use the global configuration command ip route to configure a static routing
➢ The next hop address must be a reachable address on the directly connected network
➢ For point-to-point connections, the next-hop address can be replaced by the outgoing interface
⚫ Configure static routings on 3 routers, so that Net 1 and Net 2 can communicate with each other
➢ Select 100M link with the path: Net1-R1-R2-R3-Net2
R2
G0/2 Gi0/0
172.16.1.2/30 172.16.1.5/30
G0/2 Gi0/0
172.16.1.1/30 172.16.1.6/30
R1(config)#ip route 192.168.2.0 255.255.255.0 172.16.1.2
10M Twisted Pair
R1 R3 R2(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.1
Gi0/1 Gi0/1
172.16.1.9/30 172.16.1.10/30
R2(config)#ip route 192.168.2.0 255.255.255.0 172.16.1.6
G0/5 G0/5
192.168.1.254/24 192.168.2.254/24 R3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.5
Net 1 Net 2
10.13.1.0/24 192.168.2.0/24
R2#show ip route
C 172.16.1.0/30 is directly connected, GigabitEthernet 0/2
C 172.16.1.4/30 is directly connected, GigabitEthernet 0/0
S 192.168.1.0/24 [1/0] via 172.16.1.1
S 192.168.2.0/24 [1/0] via 172.16.1.6
R3#show ip route
C 172.16.1.4/30 is directly connected, GigabitEthernet 0/0
C 192.168.2.0/24 is directly connected, GigabitEthernet 0/5
C 172.16.1.8/30 is directly connected, GigabitEthernet 0/1
S 192.168.1.0/24 [1/0] via 172.16.1.5
⚫ The default static routing is a special static routing that has a destination network and subnet mask of 0.0.0.0 (it is
possible that the default routing is a dynamic routing)
⚫ Configure the default routing on R1 and R3 so that a 10M link can be used when the 100M link between R1 and R3
fails
R2
R3#show ip route
C 172.16.1.4/30 is directly connected, GigabitEthernet 0/0
Net 1 Net 2
10.13.1.0/24 192.168.2.0/24
C 192.168.2.0/24 is directly connected, GigabitEthernet 0/5
C 172.16.1.8/30 is directly connected, GigabitEthernet 0/1
S* 0.0.0.0/0 [1/0] via 172.16.1.9
⚫ Floating routing is based on the static routing, plus the administrative distance parameter, the smaller the
administrative distance, the higher the trustworthiness
⚫ Multiple floating routings are configured, and only the one with the highest confidence (smallest administrative
distance) will be added to the routing table
⚫ When the highest confidence float routing fails, the float with the next highest confidence is added to the routing table
⚫ The normal path is: Net1-R1-R2-R3-Net2, the backup path switches is: Net1-R1-R3-Net2
R2
G0/2 Gi0/0
172.16.1.2/30 172.16.1.5/30
G0/2 Gi0/0
172.16.1.6/30 R1(config)#ip route 192.168.2.0 255.255.255.0 172.16.1.2 10
172.16.1.1/30
R1(config)#ip route 192.168.2.0 255.255.255.0 172.16.1.10 100
10M Twisted Pair
R1 R3
Gi0/1 Gi0/1 R3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.5 10
G0/5 172.16.1.9/30 172.16.1.10/30 G0/5 R3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.9 100
192.168.1.254/24 192.168.2.254/24
Net 1 Net 2
10.13.1.0/24 192.168.2.0/24
R3#show ip route
C 172.16.1.4/30 is directly connected, GigabitEthernet 0/0
C 192.168.2.0/24 is directly connected, GigabitEthernet 0/5
C 172.16.1.8/30 is directly connected, GigabitEthernet 0/1
S 192.168.1.0 /24 [10/0] via 172.16.1.5
⚫ After disconnecting R1 from R2 and R3 from R2, check the routing table of R1 and R3
R1#show ip route
C 192.168.1.0/24 is directly connected, GigabitEthernet 0/5
C 172.16.1.8/30 is directly connected, GigabitEthernet 0/1
S 192.168.2.0 /24 [100/0] via 172.16.1.10
R3#show ip route
C 192.168.2.0/24 is directly connected, GigabitEthernet 0/5
C 172.16.1.8/30 is directly connected, GigabitEthernet 0/1
S 192.168.1.0 /24 [100/0] via 172.16.1.9
⚫ Definition of routing aggregation: aggregating multiple contiguous routing entries into a single routing entry
⚫ The role of routing summary: shrink the routing table, reduce the burden on the router, improve the efficiency of the
router forwarding
⚫ Configure only one static routing (no default routing) on R1 and R2 respectively, so that all PCs can communicate with
each other
Gi0/1 172.16.12.0/24
10.0.0.1/30
G0/2 172.16.13.0/24
Gi0/0 Gi0/1
192.168.1.0/24
Gi0/0
10.0.0.2/30
G0/3 172.16.14.0/24
R1
R2
G0/4 172.16.15.0/24
Left? Right?
172.16.12.0/22 172.16.12.0/22
172.16.14.0/24 172.16.15.0/24
R1 R2 F0/2 R3
Destination IP: 172.16.12.1
PC
192.168.1.100/24
Default gateway: 192.168.1.254
1. Routing Overview
2. Static Routing
3. Dynamic Routing
⚫ The main routing protocols in the current network project are: RIP, OSPF, ISIS, BGP
⚫ This is a protocol used by routers to calculate and maintain network routing information, usually with certain algorithms,
and works at the transmitter or application layer BGP RIP OSPF
➢ RIP based on UDP, port number 520 TCP UDP
⚫ Four main steps in the working mechanism of the routing protocol are:
➢ Neighbor Discovery: Routers discover neighbors in the network by sending broadcast or multicast messages, and establish
neighbor relationships based on specific parameters.
➢ Routing Exchange: Each router sends its own known routing-related information to neighboring routers.
➢ Routing Calculation: Each router runs some algorithm to calculate the final routing table.
➢ Routing Maintenance: Routers maintain neighbor information by periodically sending protocol messages to each other.
⚫ Classification by Algorithm
➢ Distance vector routing protocols: RIP, BGP
➢ Link state routing protocols: OSPF, IS-IS
IGP:RIP、OSPF、IS-IS IGP:RIP、OSPF、IS-IS
⚫ Shortest Path First (SPF) algorithm based on Dijkstra's algorithm, which is more complex than distance vector routing
protocols
⚫ The router does not pass "routing table entries" directly to the neighbors, but informs them of the link state
⚫ Link state information includes: interface IP address and mask, network type, link overhead, and all neighboring
routers on the link
⚫ Working Process:
➢ Find neighbors running the same protocol and form a neighbor table
➢ Collect link state information of all routers in the region and form a database
➢ Generate network topology based on state information and SPF algorithm
➢ Each router calculates the route based on the topology
SPF algorithm
⚫ The function of routing: path information to guide network devices for IP message delivery
⚫ The routing table entry contains: routing source, destination address/mask, next hop address, outgoing
interface, metric
⚫ Routing sources: static routings and dynamic routings. Dynamic routing including: RIP, OSPF, ISIS and
BGP.
⚫ Dynamic routing protocols are usually divided into distance vector type routing protocols and link state
type routing protocols according to their algorithms