Cisco-静态路由及默认路由

简介: Cisco-静态路由及默认路由

前言

网络已经成为了我们生活中不可或缺的一部分,它连接了世界各地的人们,让信息和资源得以自由流动。随着互联网的发展,我们可以通过网络学习、工作、娱乐,甚至是社交。因此,学习网络知识和技能已经成为了每个人都需要掌握的重要能力。

本课程博主将带领读者深入了解网络的基本原理、结构和运作方式,帮助读者建立起对网络的全面理解。我们将介绍网络的发展历程、网络的分类和组成、网络的安全和隐私保护等内容,帮助读者掌握网络知识,提高网络素养。

通过学习本书,读者将能够更好地利用网络资源,提高工作效率,拓展人际关系,甚至是保护自己的网络安全。网络世界充满了无限的可能,希望本课程能够帮助读者更好地驾驭网络,享受网络带来的便利和乐趣。


一、静态路由是什么?

静态路由(英语:Static routing)是一种路由的方式,路由项(routing entry)由手动配置,而非动态决定。与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态。一般来说,静态路由是由网络管理员逐项加入路由表

二、实验

1.引入

实验目标

  1. 掌握静态路由的配置方法和技巧;
  2. 掌握通过静态路由方式实现网络的连通性;
  3. 熟悉广域网线缆的链接方式;

实验背景

        学校有新旧两个校区,每个校区是一个独立的局域网,为了使新旧校区能够正常相互通讯,共享资源。每个校区出口利用一台路由器进行连接,两台路由器间学校申请了一条2M的DDN专线进行相连,要求做适当配置实现两个校区的正常相互访问。

技术原理

  1. 路由器属于网络层设备,能够根据IP包头的信息,选择一条最佳路径,将数据包转发出去。实现不同网段的主机之间的互相访问。路由器是根据路由表进行选路和转发的。而路由表里就是由一条条路由信息组成。
  2. 生成路由表主要有两种方法:手工配置和动态配置,即静态路由协议配置和动态路由协议配置。
  3. 静态路由是指有网络管理员手工配置的路由信息。
  4. 静态路由除了具有简单、高效、可靠的优点外,它的另一个好处是网络安全保密性高。
  5. 缺省路由可以看做是静态路由的一种特殊情况。当数据在查找路由表时,没有找到和目标相匹配的路由表项时,为数据指定路由。

实验步骤

  1. 新建packet tracer拓扑图
  2. 在路由器R1、R2上配置接口的IP地址和R1串口上的时钟频率;
  3. 查看路由器生成的直连路由;
  4. 在路由器R1、R2上配置静态路由;
  5. 验证R1、R2上的静态路由配置;
  6. 将PC1、PC2主机默认网关分别设置为路由器接口fa 1/0的IP地址;
  7. PC1、PC2主机之间可以相互通信;

实验设备

Routers-2811(3台),PC(2台)

实验拓扑图

两根串口线(NM-4A/S),两根交叉线

实验配置

PC配置

PC0:
IP  地址:192.168.10.1
子网掩码:255.255.255.0
网   关:192.168.10.254
PC1:
IP  地址:192.168.20.1
子网掩码:255.255.255.0
网   关:192.168.20.254

Routers路由器的线路配置(1-3)

R1:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.254 255.255.255.0        //配置接口网关
R1(config-if)#no shut
R1(config)#int s1/0
R1(config-if)#no shut
R1(config-if)#ip add 10.0.1.1 255.255.255.0              //配置出接口IP
R2:
Router>
Router>en
Router#conf 
Router(config)#h R2
R2(config)#int s1/0
R2(config-if)#no shutdown 
R2(config-if)#ip add 10.0.1.2 255.255.255.0
R2(config)#int s1/1
R2(config-if)#ip add 10.0.2.1 255.255.255.0
R2(config-if)#no shutdown 
R3:
Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#h R3
R3(config)#int s1/0
R3(config-if)#ip add 10.0.2.2 255.255.255.0
R3(config-if)#no shut
R3(config)#int f0/0
R3(config-if)#ip add 192.168.20.254 255.255.255.0
R3(config-if)#no shut

静态路由

R1:
R1(config)#ip route 192.168.20.0 255.255.255.0 10.0.1.2    //目标IP 子网掩码 下一跳IP
R1(config)#do show ip route
Codes: L - local, 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, 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
 
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.1.0/24 is directly connected, Serial1/0
L       10.0.1.1/32 is directly connected, Serial1/0
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.10.0/24 is directly connected, FastEthernet0/0
L       192.168.10.254/32 is directly connected, FastEthernet0/0
S    192.168.20.0/24 [1/0] via 10.0.1.2            //主要是这一条,一定要有
R2:
R2(config)#ip route 192.168.10.0 255.255.255.0 10.0.1.1        //静态路由
R2(config)#ip route 0.0.0.0 0.0.0.0 10.0.2.2                  //默认路由
Codes: L - local, 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, 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 10.0.2.2 to network 0.0.0.0
 
     10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C       10.0.1.0/24 is directly connected, Serial1/0
L       10.0.1.2/32 is directly connected, Serial1/0
C       10.0.2.0/24 is directly connected, Serial1/1
L       10.0.2.1/32 is directly connected, Serial1/1
S    192.168.10.0/24 [1/0] via 10.0.1.1
S*   0.0.0.0 [1/0] via 10.0.2.2
R3:
R3(config)#ip route 0.0.0.0 0.0.0.0 10.0.2.1 
R3(config)#do show ip route
Codes: L - local, 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, 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 10.0.2.1 to network 0.0.0.0
 
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.0.2.0/24 is directly connected, Serial1/0
L       10.0.2.2/32 is directly connected, Serial1/0
     192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.20.0/24 is directly connected, FastEthernet0/0
L       192.168.20.254/32 is directly connected, FastEthernet0/0
S*      0.0.0.0 [1/0] via 10.0.2.1

实验验证

PC0 PING PC1 :

PC0 PING PC1 

总结

默认路由与静态路由在公司中经常使用,因为后者的安全系数更高,所以基本都是工程师手动的去配置,

相关文章
|
12月前
|
网络协议 算法 安全
Cisco-动态路由(OSPF)
Cisco-动态路由(OSPF)
125 3
|
5月前
|
网络协议 安全 算法
路由协议(静态路由、RIP、OSPF、BGP)
本文介绍了四种常见的路由协议:静态路由、RIP、OSPF 和 BGP。静态路由由管理员手动配置,简单安全但缺乏动态性;RIP 是距离矢量协议,适合小型网络,实现简单但收敛慢且易产生环路;OSPF 基于链路状态算法,适用于中大型网络,快速收敛且无环路,但配置复杂;BGP 是路径矢量协议,主要用于自治系统间路由选择,策略性强、稳定性高,但配置难度大且依赖人工干预。根据网络规模和需求,可选择合适的路由协议。
649 9
|
12月前
|
运维 监控 网络协议
HCIP-Datacom H12-821 题库 (11)
HCIP-Datacom H12-821 题库 (11)
176 0
|
10月前
|
移动开发 JavaScript 前端开发
简单易用的jquery响应式轮播图插件ma5slider
ma5slider是一款简单易用的jquery响应式轮播图插件。该轮播图支持鼠标拖拽,可以通过CSS定制外观,支持无限循环模式,内置水平,垂直和淡入淡出三种轮播图过渡动画效果。
|
12月前
|
人工智能 搜索推荐 程序员
AI 搜索引擎工具集合
AI 搜索引擎工具集合
1066 1
AI 搜索引擎工具集合
|
12月前
|
网络协议
BGP路由原理详解
BGP路由原理详解
575 1
BGP路由原理详解
|
12月前
|
网络协议 安全 网络安全
HCIP-Datacom H12-821 题库 (7)
HCIP-Datacom H12-821 题库 (7)
105 0
HCIP-Datacom H12-821 题库 (7)
|
12月前
|
安全 网络协议 网络安全
Windows Server 2003 Web服务器搭建
Windows Server 2003 Web服务器搭建
146 1
|
12月前
|
C语言
【C语言】AscII码值详解
【C语言】AscII码值详解
1335 1
|
12月前
|
C语言 C++
【C语言】编写“猜数字“小游戏
【C语言】编写“猜数字“小游戏
183 1