首页 > 其他分享 >6.13学习内容

6.13学习内容

时间:2024-06-14 10:57:18浏览次数:10  
标签:6.13 0.0 192.168 学习 Switch 内容 ip Router config

今天完成了计算机网络的实验三 综合性训练(搭建中小企业园区网)

一、实验目的:

1.通过对网络设备的连通和对拓扑的分析,加深对常见典型局域网拓扑的理解;

2.通过路由建立起网络之间的连接,了解网络路由的设计与配置;

3.进一步熟悉交换机、路由器的基本操作命令。

二、实验设备:

六个PC,两个3560-24PS的交换机,两台2950-24的交换机,三个2811路由器,一台服务器

三、实验拓扑图

 

 

 

 

 

四、实验过程:

步骤1:在4台交换机上创建vlan10/20/30,分别命名为yewubu,caiwubu,zonghebu 四台交换机:

Switch0

Switch>enable

Switch#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#vlan 10

Switch(config-vlan)#name yewubu

Switch(config-vlan)#exit

Switch(config)#vlan 20

Switch(config-vlan)#name caiwubu

Switch(config-vlan)#exit

Switch(config)#vlan 30

Switch(config-vlan)#name zonghebu

Switch(config-vlan)#exit

(四台交换机代码相同)

 

 

步骤2:在交换机s2_01,s2_02(二层交换机)上分别将6-10端口,11-15端口,16-20端口分别划分到vlan10,20,30中 两台二层交换机(下面)//这里可以只将连接主机的端口分配给相应的vlan即可【可以使用2960(有24个端口)】

Switch>en

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int range fa0/6-10

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 10

Switch(config-if-range)#exit

Switch(config)#int range fa0/11-15

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 20

Switch(config-if-range)#exit

Switch(config)#int range fa0/16-20

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport access vlan 30

Switch(config-if-range)#exit

Switch(config)#

(两台交换机代码相同)

步骤3:把s2_01,s2_02连s3_01,s3_02的端口设置都为Trunk模式(8个端口) 四台交换机

Switch(config)#

Switch(config)#interface FastEthernet0/1

Switch(config-if)#

Switch(config-if)#switchport mode trunk

 

Switch(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

 

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

 

Switch(config-if)#exit

Switch(config)#interface FastEthernet0/2

Switch(config-if)#

Switch(config-if)#switchport mode trunk

 

步骤4:将两台三层交换机之间的fa0/3,fa0/4端口配置为聚合端口 两台三层交换机(上面)

Switch(config)#int range fa0/1-2

Switch(config-if-range)#channel-group 1 mode on

Switch(config-if-range)#

Creating a port-channel interface Port-channel 1

 

%LINK-5-CHANGED: Interface Port-channel1, changed state to up

 

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

 

Switch(config-if-range)#exit

Switch(config)#int port-channel 1

Switch(config-if)#switchport mode trunk

Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.

Switch(config-if)#exit

 

Show vlan

 

步骤5:在四台交换机上配置RSTP,指定s3_01和s3-02分别为根网桥和备份网桥(生成树协议) 四台交换机

其中两台二层交换机:

spanning-tree mode pvst

剩余的两台三层交换机:

Switch(config)#spanning-tree mode pvst

Switch(config)#spanning-tree vlan 10,20,30 priority 16384

Switch#show spanning-tree

VLAN0001

Spanning tree enabled protocol ieee

Root ID Priority 32769

Address 0001.9609.ECB3

Cost 9

Port 27(Port-channel1)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

 

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)

Address 00E0.F726.8751

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

 

Interface Role Sts Cost Prio.Nbr Type

---------------- ---- --- --------- -------- --------------------------------

Fa0/3 Desg FWD 19 128.3 P2p

Fa0/4 Desg FWD 19 128.4 P2p

Po1 Root FWD 9 128.27 Shr

 

VLAN0010

Spanning tree enabled protocol ieee

Root ID Priority 16394

Address 00E0.F726.8751

This bridge is the root

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

 

Bridge ID Priority 16394 (priority 16384 sys-id-ext 10)

Address 00E0.F726.8751

--More--

步骤6:在接入交换机的access链路上实现端口安全,最大连接数量为4个,当违例产生时,将关闭端口并发送一个Trap通知 两台二层交换机(下面)

Switch(config)#int range fa0/6-20

Switch(config-if-range)#switchport mode access

Switch(config-if-range)#switchport port-security

Switch(config-if-range)#switchport port-security maximum 4

Switch(config-if-range)#switchport port-security violation shutdown

步骤7:在三层交换机上配置SVI实现vlan间的路由 两台三层交换机(上面)

左边

Switch(config-if)#int vlan 10

Switch(config-if)#ip address 192.168.10.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 20

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan20, changed state to up

 

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

 

Switch(config-if)#ip address 192.168.20.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 30

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan30, changed state to up

 

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

 

Switch(config-if)#ip address 192.168.30.1 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

 

右边

Switch(config)#int vlan 10

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan10, changed state to up

 

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

 

Switch(config-if)#ip address 192.168.10.2 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 20

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan20, changed state to up

 

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

 

Switch(config-if)#ip address 192.168.20.2 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

Switch(config)#int vlan 30

Switch(config-if)#

%LINK-5-CHANGED: Interface Vlan30, changed state to up

 

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

 

Switch(config-if)#ip address 192.168.30.2 255.255.255.0

Switch(config-if)#no shutdown

Switch(config-if)#exit

步骤8:在三层交换机的路由端口,Ra和Rb及模拟Internet的路由上配置接口IP地址 两台三层交换机(上面)和路由器 其中两台三层交换机

左边

Switch(config)#int fa0/24

Switch(config-if)#no switchport

Switch(config-if)#ip address 10.1.1.2 255.255.255.0

Switch(config-if)#no shutdown

右边

Switch(config)#int fa0/24

Switch(config-if)#no switchport

Switch(config-if)#ip address 20.2.2.2 255.255.255.0

Switch(config-if)#no shutdown

Ra路由器

Router(config)#int fa0/0

Router(config-if)#ip address 10.1.1.1 255.255.255.0

Router(config-if)#clock rate 64000

Router(config)#interface FastEthernet1/0

Router(config-if)#ip address 20.2.2.1 255.255.255.0

Router(config-if)#no shutdown

 

Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up

 

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

Router(config)#interface Serial2/0

Router(config-if)#ip address 192.168.1.1 255.255.255.0

Router(config-if)#ip address 192.168.1.1 255.255.255.0

Router(config-if)#no shutdown

 

Rb路由器

Router>enable

Router#

Router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#interface Serial2/0

Router(config-if)#ip address 192.168.1.2 255.255.255.0

Router(config-if)#ip address 192.168.1.2 255.255.255.0

Router(config-if)#clock rate 64000

This command applies only to DCE interfaces

Router(config-if)#no shutdown

Router(config-if)#

%LINK-5-CHANGED: Interface Serial2/0, changed state to up

 

Router(config-if)#exit

Router(config)#interface FastEthernet0/0

Router(config-if)#

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

ip address 201.10.8.1 255.255.255.0

Router(config-if)#ip address 201.10.8.1 255.255.255.0

Router(config-if)#no shutdown

 

Rs路由器

Router>enable

Router#

Router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#interface FastEthernet0/0

Router(config-if)#ip address 201.10.8.2 255.255.255.0

Router(config-if)#ip address 201.10.8.2 255.255.255.0

Router(config-if)#no shutdown

Router(config-if)#

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

 

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

 

Router(config-if)#interface loopback 0

 

Router(config-if)#

%LINK-5-CHANGED: Interface Loopback0, changed state to up

 

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

 

Router(config-if)#ip address 201.1.1.1 255.255.255.0

Router(config-if)#no shutdown

 

步骤9:在Ra和Rb上配置广域网链路,启用PPP协议和配置PAP认证 两台路由器

Ra路由器

Router(config)#interface Serial2/0

Router(config-if)#encapsulation ppp

Router(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to down

 

Router(config-if)#ppp pap sent-username Ra password 0 123

Router(config-if)#exit

 

Rb路由器

Router(config)#username Ra password 0 123

Router(config)#Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#

Router(config)#interface Serial2/0

Router(config-if)#encapsulation ppp

Router(config-if)#

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

 

Router(config-if)#ppp authentication pap

Router(config-if)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to down

 

Router(config-if)#exit

步骤10:运用RIPv2路由协议,在企业内网实现全网路由互通,用静态路由实现企业内网到互联网的访问 两台三层交换机(上面)和两台路由器

左边

Switch(config)#route rip

Switch(config-router)#version 2

Switch(config-router)#network 10.1.1.0

Switch(config-router)#network 192.168.10.0

Switch(config-router)#network 192.168.20.0

Switch(config-router)#network 192.168.30.0

Switch(config-router)#exit

Switch(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1

 

右边

Switch(config)#route rip

Switch(config-router)#version 2

Switch(config-router)#network 20.2.2.0

Switch(config-router)#network 192.168.10.0

Switch(config-router)#network 192.168.20.0

Switch(config-router)#network 192.168.30.0

Switch(config-router)#exit

Switch(config)#ip route 0.0.0.0 0.0.0.0 20.2.2.1

 

Ra

Router(config)#route rip

Router(config-router)#version 2

Router(config-router)#no auto-summary

Router(config-router)#network 192.168.1.0

Router(config-router)#network 10.1.1.0

Router(config-router)#network 20.2.2.0

Router(config-router)#exit

Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2

 

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

 

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

R 10.0.0.0/8 [120/7] via 10.1.1.2, 00:00:03, FastEthernet0/0

C 10.1.1.0/24 is directly connected, FastEthernet0/0

20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

R 20.0.0.0/8 [120/6] via 10.1.1.2, 00:00:03, FastEthernet0/0

C 20.2.2.0/24 is directly connected, FastEthernet1/0

192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks

C 192.168.1.0/24 is directly connected, Serial2/0

C 192.168.1.2/32 is directly connected, Serial2/0

R 192.168.10.0/24 [120/1] via 10.1.1.2, 00:00:25, FastEthernet0/0

[120/1] via 20.2.2.2, 00:00:03, FastEthernet1/0

R 192.168.20.0/24 [120/1] via 10.1.1.2, 00:00:25, FastEthernet0/0

--More--

 

 

Rb

Router(config)#router rip

Router(config-router)#version 2

Router(config-router)#no auto-summary

Router(config-router)#network 192.168.1.0

Router(config-router)#exit

Router(config)#ip route 0.0.0.0 0.0.0.0 201.10.8.2

 

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

 

192.168.1.0/32 is subnetted, 1 subnets

C 192.168.1.1 is directly connected, Serial2/0

C 201.10.8.0/24 is directly connected, FastEthernet0/0

S* 0.0.0.0/0 [1/0] via 201.10.8.2

 

步骤11:在路由器Rb上做NAT实现内网对外网的访问,可用的公网地址包括201.10.8.3/24—201.10.8.10/24 一台路由器Rb

Rb

Router(config)#interface Serial2/0

Router(config-if)#ip nat inside

Router(config-if)#exit

Router(config)#Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#

Router(config)#interface Serial2/0

Router(config-if)#

Router(config-if)#exit

Router(config)#interface FastEthernet0/0

Router(config-if)#ip nat outside

Router(config-if)#exit

Router(config)#access-list 1 permit 192.168.10.0 0.0.0.255

Router(config)#access-list 1 permit 192.168.20.0 0.0.0.255

Router(config)#access-list 1 permit 192.168.30.0 0.0.0.255

Router(config)#ip nat pool internet 201.10.8.3 201.10.8.10 netmask 255.255.255.0

Router(config)#ip nat inside source list 1 pool internet

Router(config)#exit

 

步骤12:为了控制内网对互联网的访问,在路由器Rb上做访问控制列表 一台路由器

Rb

Router(config)#access-list 101 deny ip 192.168.20.0 0.0.0.255 any

Router(config)#access-list 101 permit tcp 192.168.10.0 0.0.0.255 any eq 80

Router(config)#access-list 101 permit tcp 192.168.30.0 0.0.0.255 any eq 80

Router(config)#access-list 101 permit tcp 192.168.10.0 0.0.0.255 any eq 21

Router(config)#access-list 101 permit tcp 192.168.10.0 0.0.0.255 any eq 20

Router(config)#access-list 101 deny tcp 192.168.10.0 0.0.0.255 any

Router(config)#access-list 101 deny tcp 192.168.30.0 0.0.0.255 any

Router(config)#access-list 101 permit ip any any

Router(config)#Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#

Router(config)#interface Serial2/0

Router(config-if)#ip access-group 101 in

Router(config-if)#exit

 

Router#show access-lists

Standard IP access list 1

10 permit 192.168.10.0 0.0.0.255

20 permit 192.168.20.0 0.0.0.255

30 permit 192.168.30.0 0.0.0.255

Extended IP access list 101

10 deny ip 192.168.20.0 0.0.0.255 any

20 permit tcp 192.168.10.0 0.0.0.255 any eq www

30 permit tcp 192.168.30.0 0.0.0.255 any eq www

40 permit tcp 192.168.10.0 0.0.0.255 any eq ftp

50 permit tcp 192.168.10.0 0.0.0.255 any eq 20

60 deny tcp 192.168.10.0 0.0.0.255 any

70 deny tcp 192.168.30.0 0.0.0.255 any

80 permit ip any any

标签:6.13,0.0,192.168,学习,Switch,内容,ip,Router,config
From: https://www.cnblogs.com/lijianlongCode13/p/18247369

相关文章

  • 6.14内容
    今天完成了数据库的实验四  数据库的备份和恢复实验四数据库的备份和恢复一、实验目的:熟悉并掌握数据库备份和恢复的原理和操作。二、实验要求:掌握存储设备的创建、使用。掌握数据库中数据的导入导出操作。掌握数据上的备份和恢复操作。掌握数据库备份策略的制定原理和......
  • 6.7学习进度
    今天完成了计算机网络的实验一valan的创建和划分,还完成了部分结组作业的代码。实验一vlan的创建与划分一、实验目的:1.了解vlan的工作原理;2.学习基于端口划分vlan的方法;3.了解跨交换机的相同vlan之间的通信;4.进一步学习交换机端口的配置命令。二、实验原理:1.创建VLAN:首先需......
  • 6.10学习进度
    今天为端午节,完成了数据库的实验二实验二SQL语言的使用一、实验目的:掌握使用SQL语言进行各种查询的操作和视图的操纵方法。二、实验要求:在现有的数据库上进行各种查询操作,对视图的创建、使用等操作。三、实验步骤:1、开始→程序→MicrosoftSQLServer→SQLServerMan......
  • 6.11学习进度
    今天依旧是写数据库实验报告的一天,今天的实验报告为实验三数据库完整性、安全性实验三数据库完整性、安全性实现一、实验目的:使学生加深对数据库安全性和完整性的理解,并掌握SQLServer中有关用户、角色及操作权限的管理方法,学会创建和使用规则、缺省和触发器以及存储过程......
  • 6.5学习进度
    完成了数据库的实验实验一数据库和表的建立、数据操作一、实验目的:掌握使用SQL语言进行数据定义和数据操纵的方法。二、实验要求:建立一个数据库stumanage,建立三个关系表student,course,sc。向表中插入数据,然后对数据进行删除、修改等操作,对关系、数据库进行删除操作。三......
  • 6.6学习进度
    今天进行了Python大作业可视化界面设计器的部分编写,以下代码为画图的功能,以及调节笔刷大小的功能importtkinterastkfromtkinterimportfiledialog,messagebox,colorchooser,simpledialogclassLoginWindow:def__init__(self,root):self.root=root......
  • 【课程总结】Day8(上):深度学习基本流程
    前言在上一篇课程《【课程总结】Day7:深度学习概述》中,我们了解到:模型训练过程→本质上是固定w和b参数的过程;让模型更好→本质上就是让模型的损失值loss变小;让loss变小→本质上就是求loss函数的最小值;本篇文章,我们将继续深入了解深度学习的项目流程,包括:批量化打包数据、模......
  • STM学习记录(四)———中断及NVIC
    文章目录前言一、中断1.中断的定义2.中断的优先级3.中断嵌套二、STM32中断总结前言一个学习32单片机的小白~有问题评论或私信指出~提示:以下是本篇文章正文内容,下面案例可供参考一、中断1.中断的定义在主程序运行过程中,出现了特定的中断触发条件(中断源),使得CPU......
  • STM32学习记录(二)————基本GPIO控制
    文章目录前言1.GPIO基础知识2.IO八种工作模式3固件库实现LED点灯前言一个学习STM32的小白有问题评论区或私信指出~1.GPIO基础知识GPIO(General-Purposeinput/output,通用输入/输出接口)用于感知外部信号(输入模式)和控制外部设备(输出模式)简单模块:LED,按键,蜂......
  • 第四届物联网与机器学习国际学术会议(IoTML 2024)
    【ACM独立出版,高录用,见刊检索快速稳定】第四届物联网与机器学习国际学术会议(IoTML2024)【IoTML2023会后三个半月内完成EI检索】20244thInternationalConferenceonInternetofThingsandMachineLearning2024年8月9-11日,中国-南昌大会官网:https://ais.cn/u/qM7ruu【更......