二.静态路由实验
下面的知识点要清楚理解的
.
具体做法在实验中显示出来
静态路由管理距离
1
静态路由使用在现实生活中就是点对点
动态路由是每秒更新的
下一跳地址不等同于下一跳路由
扩展
ping
的用法
S 192.168.50.0 [1/0]via 192.168.20.2
S
代表静态路由
[1/0]
分别为管理距离和度量值
Ip route [
目标地址
][
目标地址掩码
][
下一跳地址
]
默认路由
IP route 0.0.0 .0 0.0.0.0 192.168.1.1
S*
表示默认路由
这个知识点要记住:
默认的管理距离
路由源
默认
连接接口
0
静态路由
1
EIGRP 90
IGRP 100
OSPF 110
RIP 120
Extemal EIGRP 170
未知
255 (
这个路由将决不会被使用
)
两台路由的静态路由实验
实验用的拓扑图:
先配置
R 1 F 0/0
和
S1/0
的
IP
地址
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#interface serial1/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#clockrate 64000
R1(config-if)#no shut
R1(config-if)#exit
配置
R 2 F 0/0 S1/0
的
IP
地址
R2(config)#interface serial1/0
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#interface f0/0
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#^Z
在没配置静态路由前
ping
一下对边的
F0/0
接口看能不能通
.
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Ping R2
相邻路由
R1
的的接口,可以
ping
通了
.
R2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/82/96 ms
给
R1
配置一条静态的路由
.
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#exit
R1#show ip
*Mar 1 00:29:52.211: %SYS-5-CONFIG_I: Configured from console by console
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial1/0
S 192.168.3.0/24 [1/0] via 192.168.2.2
给
R2
配置一条静态路由
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#^Z
R2#show ip
*Mar 1 00:30:15.563: %SYS-5-CONFIG_I: Configured from console by console
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
S 192.168.1.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
可以
ping
通网络了
.
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/73/120 ms
这里用扩展的
ping
来测试效果
R2#ping
Protocol [ip]:
Target IP address: 192.168.1.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.3.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.3.1
!!!!!
R1
配置不变
给
R2
添加一条默认路由看看
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#ip route 0.0.0 .0 0.0.0.0 192.168.2.1
R2(config)#exit
在
R2
上测试效果
.
可以
ping
通网络了
.
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/81/120 ms
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 192.168.2.1 to network 0.0.0 .0
C 192.168.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
S* 0.0.0 .0/0 [1/0] via 192.168.2.1
实验总结:两台路由的静态路由实验比较简单
.
熟悉配置静态路由的命令
.
理解它门的原理
.
一定要给路由配置回路
.
掌握扩展
ping
的用法
.
会用
show ip route
查看并理解路由表的内容
.