自己做的关于cisco静态路由,默认路由,浮动路由的三个实验!实验很简单,不多说看实验,如下:
实验拓扑:
实验目标:通过在R2 R3上配置静态路由.使R2. R3可以相互的通信。
首先配置好R2.R3的ip 地址:
R2:
Router(config)#host R2
R2(config)#int s1/0
R2(config-if)#ip add 192.168.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/1
R2(config-if)#ip add 192.168.1.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R3:
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int s1/0
R3(config-if)#ip add 192.168.1.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int s1/1
R3(config-if)#ip add 192.168.2.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#
1.在R2上配置静态路由:
R2(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
R2(config)#
在R3上配置静态路由:
R3(config)#ip route 192.168.0.0 255.255.255.0 192.168.1.1
R3(config)#
在R2上用“show ip route”命令查看路由表:
*Nov 3 22:31:02.350: %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
C 192.168.0.0/24 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/1
S 192.168.2.0/24 [1/0] via 192.168.1.2 //R2上静态路由
R2#
查看R3路由表:
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/47/100 ms
R3#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.0.0/24 [1/0] via 192.168.1.1
192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/1
R3#
在R2上Ping R3:
R2#PING
Protocol [ip]:
Target IP address: 192.168.2.1 //目标ip地址
Repeat count [5]: //发送ping次数
Datagram size [100]: //ping包的大小
Timeout in seconds [2]: //超时时间
Extended commands [n]: Y //是否进一步扩展命令
Source address or interface: 192.168.0.2 //源ip地址
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.2.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.0.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/27/56 ms
R2#
以上输出结果表明通过在R2 R3 配置静态路由,从而是R2 R3之间可以互相通信。
个人关于配置静态路由的认识:
配置静态路由的命令为“ip route" 其命令格式为:
ip route 目标网络号 子网掩码 下一跳路由ip |接口
上面的R2也可写成端口模式
ip route 192.168.2.0 255.255.255.0 s1/0
注:在写静态路由时,如果链路是点对点的链路(如 ppp 封装的链路),采用下一跳路由ip 或接口是可以的:然而如果链路是多路访问的链路(以太网),则只能采用下一跳路由ip!
============================
2.配置默认路由:
实验拓扑如上:
实验目标:通过在R2 R3上配置默认路由.使R2. R3可以相互的通信。
首先分别删除R2 R3 上的静态路由信息
R2:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip route 192.168.2.0 255.255.255.0 192.168.1.2
R2(config)#^Z
R2#
R3:
R3(config)#no ip route 192.168.0.0 255.255.255.0 192.168.1.1
R3(config)#^Z
R3#
在R2 R3 上分别配置默认路由:
R2
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 0.0.0.0 0.0.0.0 s1/0 //使用的是下一跳路由接受端口
R2(config)#^Z
R3
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#ip route 0.0.0.0 0.0.0.0 s1/1 //使用的是下一跳路由接受端口
R3(config)#^Z
分别查看R2 R3路由表信息:
R2
*Nov 3 23:48:01.957: %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 0.0.0.0 to network 0.0.0.0
C 192.168.0.0/24 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/0
R2#
R3
R3#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 0.0.0.0 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/1
R3#
R2 ping R3 结果:
R2#ping
Protocol [ip]:
Target IP address: 192.168.1.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.0.1
% Invalid source. Must use IP address or full interface name without spaces (e.g. Serial0/1)
Source address or interface:
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.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/16/32 ms
R2#
通过以上结果相信大家已经看到,我们在R2 R3 上配置的静态路由已经起来了,并R2 R3可以相互通信,实验是成功的!
关于默认路由配置的认识;
配置默认路由命令格式为:
ip route 0.0.0.0 0.0.0.0 下一跳ip地址|端口
默认路由配置比较简单,就是当前路由找不知道不知道路怎么走的,都交给下一跳路由去路由
===========================
好了实验就到这了,很简单!希望对您有点用,有什么的不对的或需要补充的请指出哦!
谢谢!