默认路由
默认路由是静态路由的一种特殊形式,可以用来跟位置望断通讯,但是运行环境只能在末梢网络的路由器上
默认路由_职场
在这个拓扑里面只有第一个和第三个路由器上才能 配置默认路由 而第二个路由器上只能配置静态路由
Ru1上的基本配置
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host ru1
ru1(config)#int s0/0
ru1(config-if)#ip add 192.168.1.1 255.255.255.0
ru1(config-if)#clock rate 64000
ru1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
ru1(config-if)#exit
ru1(config)#int f0/0
ru1(config-if)#ip add 172.16.1.1 255.255.255.0
ru1(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ru1(config-if)#exit
ru1(config)#
ru2 上的基本配置
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host ru2
ru2(config)#int s0/0
ru2(config-if)#ip add 192.168.1.2 255.255.255.0
ru2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
ru2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to upexit
ru2(config)#int f0/0
ru2(config-if)#ip add 172.16.2.1 255.255.255.0
ru2(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ru2(config-if)#exit
ru2(config)#int s0/1
ru2(config-if)#ip add 192.168.2.1 255.255.255.0
ru2(config-if)#clock rate 64000
ru2(config-if)#no shut
ru2(config-if)#exit
ru2(config)#
ru3 上的基本配置
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host ru3
ru3(config)#int s0/0
ru3(config-if)#ip add 192.168.2.2 255.255.255.0
ru3(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
ru3(config-if)#exit
ru3(config)#int
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up f0/0
ru3(config-if)#ip add 172.16.3.1 255.255.255.0
ru3(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ru3(config-if)#exit
ru3(config)#
我们开始进行路由协议的配置了
ru1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2
ru2(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.1
ru2(config)#ip route 172.16.3.0 255.255.255.0 192.168.2.2
ru2(config)#
ru3(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
这里呢一定要分清楚哪个是你的下一跳ip地址,注意一下ru1 和ru3 上的配置
ru3#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.3.0 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
S* 0.0.0.0/0 [1/0] via 192.168.2.1
ru3#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 62/65/79 ms
ru3#ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/34/47 ms
ru3#
上面的这个是在ru3 上查看到的路由表信息 注意学到的末梢路由的标示
ru2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
172.16.0.0/24 is subnetted, 3 subnets
S 172.16.1.0 [1/0] via 192.168.1.1
C 172.16.2.0 is directly connected, FastEthernet0/0
S 172.16.3.0 [1/0] via 192.168.2.2
C 192.168.1.0/24 is directly connected, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/1
ru2#
这是ru2上学到的路由信息 其中C表示的是直连网段 S 表示静态路由 S* 表示的是缺省路由 即我们说的默认路由
---------------------------------------------------------
我三台pc机的ip
依次是172.16.1.2 172.16.2.2 172.16.3.2
这是在pc3 上的查勘信息
以及测试与其他计算机的连通情况
Packet Tracer PC Command Line 1.0
PC>ipconfig
IP Address......................: 172.16.3.2
Subnet Mask.....................: 255.255.0.0
Default Gateway.................: 172.16.3.1
PC>ping 172.16.1.2
Pinging 172.16.1.2 with 32 bytes of data:
Request timed out.
Reply from 172.16.1.2: bytes=32 time=125ms TTL=125
Reply from 172.16.1.2: bytes=32 time=109ms TTL=125
Reply from 172.16.1.2: bytes=32 time=125ms TTL=125
Ping statistics for 172.16.1.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 109ms, Maximum = 125ms, Average = 119ms
PC>ping 172.16.2.2
Pinging 172.16.2.2 with 32 bytes of data:
Request timed out.
Reply from 172.16.2.2: bytes=32 time=125ms TTL=126
Reply from 172.16.2.2: bytes=32 time=78ms TTL=126
Reply from 172.16.2.2: bytes=32 time=94ms TTL=126
Ping statistics for 172.16.2.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 78ms, Maximum = 125ms, Average = 99ms
PC>
静态路由协议的特点
对路由器cpu没有管理性开销
在路由器急案没有带宽占用
增加了安全性,
缺点就是必须对网络有足够的了解,对于大型的网络配置繁琐,对于一个稍微大点的网络来说配置的工作量复杂,且容易出错