RIP协议手动配置小型园区网

RIP协议搭建园区网
本文介绍了一个基于RIP协议的小型园区网搭建过程,包括内网DNS与HTTP服务器配置、内外网连通性测试等内容。

本文是基于RIP协议搭建的一个小型园区网,仅供学习使用

一、基础拓朴图

这是上篇文章结束时的拓朴图,这次的配置也是基于这个拓扑进行配置的

 二、配置内网DNS和HTTP服务器

使用:两台服务器,一台HTTP服务器,一台DNS服务器

为DNS服务器和HTTP服务器分配ip和网关,并把这两个对应的核心交换机上的端口划分到vlan70域中

先创建一个vlan70域,并把两个端口划分到vlan70域中

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 70
Switch(config-vlan)#int f0/3
Switch(config-if)#switchport access vlan 70
Switch(config-if)#int g0/1
Switch(config-if)#switchport access vlan 70

除去常规的为DNS和HTTP服务器配置IP和网关之外

这里需要在DNS服务器上为HTTP服务器只当一下ip地址和域名

并且打开DNS服务

在核心交换机上给vlan70一个网关地址

给完网关地址后查看一下路由表,多出了192.168.7.0/24这个网段就对了

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int vlan 70
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan70, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan70, changed state to up

Switch(config-if)#ip address 192.168.7.1 255.255.255.0
Switch(config-if)#no shutdown 
Switch(config-if)#do show 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

R    192.168.1.0/24 [120/1] via 192.168.5.1, 00:00:03, Vlan50
R    192.168.2.0/24 [120/1] via 192.168.5.1, 00:00:03, Vlan50
R    192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:25, Vlan60
R    192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:25, Vlan60
     192.168.5.0/30 is subnetted, 1 subnets
C       192.168.5.0 is directly connected, Vlan50
     192.168.6.0/30 is subnetted, 1 subnets
C       192.168.6.0 is directly connected, Vlan60
C    192.168.7.0/24 is directly connected, Vlan70

 配置一下rip协议,把刚配置的vlan70对应的192.168.7.0这个网段加入到rip协议中

Switch(config-if)#router rip
Switch(config-router)#version 2
Switch(config-router)#network 192.168.7.0
Switch(config-router)#no auto-summary 

测试一下:PC0 ping一下HTTP服务器(192.168.7.100)

可以ping通,说明配置完成

之后要对域名进行解析还需要配置一下PC机的DNS地址,否则就算ip可达,域名也无法解析

 

三、配置外网网络

使用:两台2911路由器、一台HTTP服务器、一台PC机

1、添加两台路由器

添加两台2911路由器,并为其各添加一个HWIC-2T模块,使其多出两个串口以供使用

关闭电源——>选中模块——>将模块拖到图中所示位置——>打开电源

 

2、连线并进行基本配置

添加完模块之后按如图所示连线

接下来可以看到图中的连线的灯都是红的,说明线路不通

路由器的接口开关需要手动打开,类似下面这样

依次打开所有开关,线路就通了

按照如图所示为其各部分配置ip地址和网关等信息

首先是在核心交换机上为g0/2进行配置

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int g0/2
Switch(config-if)#no switchport 
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up

Switch(config-if)#ip address 192.168.15.1 255.255.255.252
Switch(config-if)#no shutdown 

 第一个路由器的g0/0端口

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.15.2 255.255.255.252
Router(config-if)#no shutdown 

 第一个路由器的s0/3/0端口

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.16.2 255.255.255.252
Router(config-if)#no shutdown 

第二个路由器的s0/3/0端口

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.16.1 255.255.255.252
Router(config-if)#no shutdown 

第二个路由器的g0/0端口

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.167.100.1 255.255.255.0
Router(config-if)#no shutdown 

第二个路由器的g0/1端口

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/1
Router(config-if)#ip address 192.169.100.1 255.255.255.0
Router(config-if)#no shutdown 

3、路由器跳转配置

首先配置外网即右边那个路由器

配置走向内网的流量全部下一跳为192.168.16.2

内网的网段计算是20位子网掩码的192.168.0.0网段

此网段ip为(192.168.0.1-192.168.15.254,共4094个可用ip)

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 192.168.0.0 255.255.240.0 192.168.16.2
Router(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

     192.167.100.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.167.100.0/24 is directly connected, GigabitEthernet0/0
L       192.167.100.1/32 is directly connected, GigabitEthernet0/0
S    192.168.0.0/20 [1/0] via 192.168.16.2    //有了这个就说明配置成功了
     192.168.16.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.16.0/30 is directly connected, Serial0/3/0
L       192.168.16.1/32 is directly connected, Serial0/3/0
     192.169.100.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.169.100.0/24 is directly connected, GigabitEthernet0/1
L       192.169.100.1/32 is directly connected, GigabitEthernet0/1

配置内网路由器,即左边这个路由器

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.16.1
Router(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 192.168.16.1 to network 0.0.0.0

     192.168.15.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.15.0/30 is directly connected, GigabitEthernet0/0
L       192.168.15.2/32 is directly connected, GigabitEthernet0/0
     192.168.16.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.16.0/30 is directly connected, Serial0/3/0
L       192.168.16.2/32 is directly connected, Serial0/3/0
S*   0.0.0.0/0 [1/0] via 192.168.16.1    //出现这个就说明配置成功了

配置一下核心交换机的路由转发

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.15.2
Switch(config)#do show 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.15.2 to network 0.0.0.0

R    192.168.1.0/24 [120/1] via 192.168.5.1, 00:00:20, Vlan50
R    192.168.2.0/24 [120/1] via 192.168.5.1, 00:00:20, Vlan50
R    192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:03, Vlan60
R    192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:03, Vlan60
     192.168.5.0/30 is subnetted, 1 subnets
C       192.168.5.0 is directly connected, Vlan50
     192.168.6.0/30 is subnetted, 1 subnets
C       192.168.6.0 is directly connected, Vlan60
C    192.168.7.0/24 is directly connected, Vlan70
     192.168.15.0/30 is subnetted, 1 subnets
C       192.168.15.0 is directly connected, GigabitEthernet0/2
S*   0.0.0.0/0 [1/0] via 192.168.15.2    //出现这个就代表配置成功了

除去这三个之外,还要配置一下下面两个三层交换机

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.15.2
Switch(config)#do show 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.15.2 to network 0.0.0.0

C    192.168.1.0/24 is directly connected, Vlan10
C    192.168.2.0/24 is directly connected, Vlan20
R    192.168.3.0/24 [120/2] via 192.168.5.2, 00:00:27, Vlan50
R    192.168.4.0/24 [120/2] via 192.168.5.2, 00:00:27, Vlan50
     192.168.5.0/30 is subnetted, 1 subnets
C       192.168.5.0 is directly connected, Vlan50
     192.168.6.0/30 is subnetted, 1 subnets
R       192.168.6.0 [120/1] via 192.168.5.2, 00:00:27, Vlan50
R    192.168.7.0/24 [120/1] via 192.168.5.2, 00:00:27, Vlan50
     192.168.15.0/30 is subnetted, 1 subnets
R       192.168.15.0 [120/1] via 192.168.5.2, 00:00:27, Vlan50
     192.168.16.0/30 is subnetted, 1 subnets
R       192.168.16.0 [120/2] via 192.168.5.2, 00:00:27, Vlan50
S*   0.0.0.0/0 [1/0] via 192.168.15.2    //出现这个就是配置成功了

4、RIP协议配置

配置核心交换机的RIP协议

添加两个网段(内网和外网)

Switch#show 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.15.2 to network 0.0.0.0

R    192.168.1.0/24 [120/1] via 192.168.5.1, 00:00:24, Vlan50
R    192.168.2.0/24 [120/1] via 192.168.5.1, 00:00:24, Vlan50
R    192.168.3.0/24 [120/1] via 192.168.6.1, 00:00:04, Vlan60
R    192.168.4.0/24 [120/1] via 192.168.6.1, 00:00:04, Vlan60
     192.168.5.0/30 is subnetted, 1 subnets
C       192.168.5.0 is directly connected, Vlan50
     192.168.6.0/30 is subnetted, 1 subnets
C       192.168.6.0 is directly connected, Vlan60
C    192.168.7.0/24 is directly connected, Vlan70
     192.168.15.0/30 is subnetted, 1 subnets
C       192.168.15.0 is directly connected, GigabitEthernet0/2
     192.168.16.0/30 is subnetted, 1 subnets
R       192.168.16.0 [120/1] via 192.168.15.2, 00:00:45, GigabitEthernet0/2
S*   0.0.0.0/0 [1/0] via 192.168.15.2

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#router rip
Switch(config-router)#version 2
Switch(config-router)#network 192.168.15.0
Switch(config-router)#network 192.168.16.0
Switch(config-router)#no auto-summary 

配置内网路由器的RIP协议

Router#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 192.168.16.1 to network 0.0.0.0

R    192.168.1.0/24 [120/2] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
R    192.168.2.0/24 [120/2] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
R    192.168.3.0/24 [120/2] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
R    192.168.4.0/24 [120/2] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
     192.168.5.0/30 is subnetted, 1 subnets
R       192.168.5.0/30 [120/1] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
     192.168.6.0/30 is subnetted, 1 subnets
R       192.168.6.0/30 [120/1] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
R    192.168.7.0/24 [120/1] via 192.168.15.1, 00:02:57, GigabitEthernet0/0
     192.168.15.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.15.0/30 is directly connected, GigabitEthernet0/0
L       192.168.15.2/32 is directly connected, GigabitEthernet0/0
     192.168.16.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.16.0/30 is directly connected, Serial0/3/0
L       192.168.16.2/32 is directly connected, Serial0/3/0
S*   0.0.0.0/0 [1/0] via 192.168.16.1

Router#
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#network 192.168.15.0
Router(config-router)#network 192.168.16.0
Router(config-router)#no auto-summary 

外网路由器是不需要配置RIP协议的

这时,内外网所有ip都是互通的了

5、添加外网服务器DNS解析

在DNS服务器上再添加一条DNS解析信息

四、验证整体网络的连通性 

1、外网互相访问

2、内网互相访问

 

3、内外网互相访问

五、最终拓扑图

### 小型园区构建的计算机网络综合实验 #### 实验目标 本实验旨在通过实际操作,掌握小型园区的设计、部署和调试技能。具体包括理解并实施子划分、VLAN配置、路由协议选择以及络安全措施。 #### 拓扑设计 为了满足高效稳定的要求,建议采用星形拓扑结构来搭建校园内的各个区域连接至核心层[^2]。这种布局不仅简化了物理连线方式,还提高了系统的可靠性和易维护性。对于两台作为冗余备份的核心交换设备,则需确保两者间能够实时同步状态信息,在单点失效情况下迅速切换而不影响正常通讯流程。 #### 设备选型与互联介质 考虑到成本效益和技术先进性的平衡,推荐选用支持千兆接口以上的高性能交换机作为汇聚/接入层面的关键组件;而对于骨干链路部分则应优先考虑具备更高吞吐量特性的产品型号。此外,鉴于数据传输速率的重要性,从核心到各分支节点之间的主干线路宜全部铺设光纤缆线以提供更佳性能表现。 #### VLAN规划 针对不同部门或功能区设立独立虚拟局域(VLAN),可以有效隔离内部广播风暴的同时便于权限管理和资源分配。例如办公区、教学楼、宿舍群分别归属于三个不同的VLAN ID下,并通过Trunk端口实现跨交换机间的互通有无[^1]。 #### IP地址规划 合理规划IP地址空间有助于提高络利用率并减少后期运维难度。一般做法是按照地理位置或者逻辑关系来进行连续区块式的分配策略。比如某所高校内共有五个学生公寓楼栋,那么就可以为其各自指定一段C类私有IPv4段落用于本地主机命名解析服务(DNS)。 #### 路由器与防火墙设置 在络边界处安装专业的硬件级防护装置——即下一代防火墙NGFW,它除了基本包过滤外还能执行深层次的数据流检测DPI等功能从而抵御外部威胁入侵风险。与此同时还要精心挑选一款适合当前规模的企业级路由器负责广域WAN侧连通任务,确保内外双向通信顺畅无阻滞现象发生[^4]。 ```bash # 防火墙基础命令示例外观模式 firewall-cmd --zone=public --add-service=http --permanent firewall-cmd --reload ``` #### 测试验证阶段 完成上述各项准备工作之后便进入了至关重要的检验环节。此时可借助Wireshark抓包工具或是专门面向教育科研用途开发出来的仿真平台GNS3来进行全方位的功能性考察评估工作。前者适用于捕捉真实环境中产生的各类报文样本以便后续深入剖析研究之用;后者则是允许使用者在一个完全受控环境下自由创建复杂度各异的小型化互联模型进而开展针对性训练演练活动。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值