2. Static route Static Routing and longest match
R1
Int E0/0/0
IP add 192.168.1.1 255.255.255.0
R2
Int E0/0/0
IP add 192.168.1.2 24
IP route-s 192.168.1.1 255.255.255.0 null0 // null 0 is the logical interface, and data packets are discarded when they arrive at this interface.
[R2] dis cur | in route
OSPF 10 router-ID 2.2.2.2
IP route-static 192.168.1.1 255.255.255.255 null0
[R2] dis IP ROU
Route flags: R-relay, D-download to fib
------------------------------------------------------------------------------
Routing tables: Public
Destinations: 6 routes: 6
Destination/mask proto pre cost flags nexthop Interface
2.2.2.2/32 direct 0 0 d 127.0.0.1 loopback0
127.0.0.0/8 Direct 0 0 d 127.0.0.1 inloopback0
127.0.0.1/32 direct 0 0 d 127.0.0.1 inloopback0
192.168.1.0/24 direct 0 0 d 192.168.1.2 ethernet0/0/0
192.168.1.1/32Static 60 0 d 0.0.0.0 null0
192.168.1.2/32 direct 0 0 d 127.0.0.1 ethernet0/0/0
The longest matching principle is followed when routing is selected., The static route is 32-bit for the longest match. The packet is sent to the null0 interface and then discarded.
[R2] Ping 192.168.1.1
Ping 192.168.1.1: 56 data bytes, press ctrl_c to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 192.168.1.1 Ping statistics ---
5 packet (s) transmitted
0 packet (s) received
100.00% packet loss
Packet Loss Rate, cannot be pinged.
This article from "old books often read New Ideas" blog, please be sure to keep this source http://ramboking.blog.51cto.com/3596215/1543363