From 302c2edd8ee7a8ba17627adf9885878069762831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=8E=9F?= <2139119717@qq.com> Date: Mon, 1 Apr 2024 11:02:08 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=9C=BA=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E5=9F=BA=E7=A1=80=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...23\347\263\273\347\273\223\346\236\204.md" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240401\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234\344\275\223\347\263\273\347\273\223\346\236\204.md" diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240401\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234\344\275\223\347\263\273\347\273\223\346\236\204.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240401\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234\344\275\223\347\263\273\347\273\223\346\236\204.md" new file mode 100644 index 0000000..28b2741 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240401\350\256\241\347\256\227\346\234\272\347\275\221\347\273\234\344\275\223\347\263\273\347\273\223\346\236\204.md" @@ -0,0 +1,25 @@ +# 计算机网络体系结构 + +### 1、简介 + +##### 定义: + +计算机网络的各层+其协议的集合 + +##### 作用: + +定义该计算机网络的所能完成的功能 + +### 2、结构介绍 + +计算机网络体系结构分为3种:OSI体系结构、TCP / IP体系结构、五层体系结构。 + +- OSI 体系结构:概念清楚 & 理念完整,但复杂 & 不实用; +- TCP / IP 体系结构:含了一系列构成互联网基础的网络协议,是Internet的核心协议 & 被广泛应用于局域网和广域网; +- 五层体系结构:融合了OSI 与 TCP / IP的体系结构,目的是为了学习 & 讲解计算机原理。 + +> 低三层为通信子网,负责数据传输; +> 高三层为资源子网,相当于计算机系统, +> 完成数据处理;传输层承上启下。 + + \ No newline at end of file -- Gitee From 0911d3ec70bb9b622bd89dfeafc7023130bd1444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=8E=9F?= <2139119717@qq.com> Date: Wed, 17 Apr 2024 03:18:53 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李玟 <2139119717@qq.com> --- ...21\347\273\234\346\246\202\350\277\260.md" | 43 ++++++++++++++++++ .../20240406\345\205\211\347\272\244.md" | 39 ++++++++++++++++ .../20240408\346\227\240\347\272\277.md" | 45 +++++++++++++++++++ ...56\351\223\276\350\267\257\345\261\202.md" | 31 +++++++++++++ ...11\345\272\224\347\224\250\345\261\202.md" | 37 +++++++++++++++ ...21\346\250\241\346\213\237\345\231\250.md" | 33 ++++++++++++++ ...56\344\270\216\347\256\241\347\220\206.md" | 45 +++++++++++++++++++ 7 files changed, 273 insertions(+) create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240403\347\275\221\347\273\234\346\246\202\350\277\260.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240406\345\205\211\347\272\244.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240408\346\227\240\347\272\277.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240410\346\225\260\346\215\256\351\223\276\350\267\257\345\261\202.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240411\345\272\224\347\224\250\345\261\202.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240415\346\200\235\347\247\221\346\250\241\346\213\237\345\231\250.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240417\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\347\241\200\351\205\215\347\275\256\344\270\216\347\256\241\347\220\206.md" diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240403\347\275\221\347\273\234\346\246\202\350\277\260.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240403\347\275\221\347\273\234\346\246\202\350\277\260.md" new file mode 100644 index 0000000..cb2d152 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240403\347\275\221\347\273\234\346\246\202\350\277\260.md" @@ -0,0 +1,43 @@ +## 网络概述 + +ADSL电话线拨号:10k-->10Mbps-->100M B/8-->1000M双绞线(bit per second)-->2.5G 6类线 光纤-->10G 光纤 + +双绞线:理论极限运输距离100m(建议不超过80m) + +软件:Packet Tracer模拟网络 + ++ 线序:A类标准、B类标准 一般以B类标准为常见 + +如下:白橙、橙、白绿、绿、白蓝、蓝、白棕、棕 + ++ 一共是4对 4对全接,可以提供最多的1000M的宽带(或者速度) + +如果只接其中2对(4根),理论最大速度为100M + ++ 直通线、交叉线 + +直通线:用于不同设备的连接 + +交叉线:用于相同设备的连接 + +但是,最新的网络标准下,设备和设备之间,设备和线材之间,已经不再是区分直通线和交叉线 + + + +### OSI分层 + ++ 物理层:这是OSI模型的最低层,负责设备之间的实际物理连接,如电缆、光纤和网卡。它还涉及比特同步、比特率控制、物理拓扑和传输模式 + ++ 数据链路层:此层运行以太网等协议,负责将数据帧转换成二进制位供物理层处理。它通过网桥或交换机关注以太网上的MAC地址 + ++ 网络层:网络层的任务是选择合适的路由和交换节点,确保数据及时传送 + ++ 传输层:此层负责获取全部信息,跟踪数据单元碎片、乱序到达的数据包等。TCP和UDP是传输层的两个主要协议 + ++ 会话层:会话层负责建立、管理和终止网络连接上的会话 + ++ 表示层:表示层负责数据的表示和转换,确保数据在不同系统之间交换时的格式一致性 + ++ 应用层:应用层是OSI模型的最顶层,负责用户与网络的交互,如文件传输、电子邮件发送等 + + \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240406\345\205\211\347\272\244.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240406\345\205\211\347\272\244.md" new file mode 100644 index 0000000..2ac5c0d --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240406\345\205\211\347\272\244.md" @@ -0,0 +1,39 @@ +## 网络概述 + ++ 线序:A类标准、B类标准 一般以B类标准为常见 + +如下:白橙、橙、白绿、绿、白蓝、蓝、白棕、棕 + ++ 一共是4对 4对全接,可以提供最多的1000M的宽带(或者速度) + +如果只接其中2对(4根),理论最大速度为100M + ++ 直通线、交叉线 + +直通线:用于不同设备的连接 + +交叉线:用于相同设备的连接 + +但是,最新的网络标准下,设备和设备之间,设备和线材之间,已经不再是区分直通线和交叉线 + ++ 常见的超五类线和6类线、超6类水晶头是不一样的 + +## 光纤 + ++ 单模光纤:相对较贵,传输距离远 + ++ 多模光纤:相比较便宜,相比较距离较短 + +宽带:指信息传输通道最高频率范围,通常用赫兹表示 + +### 光猫 + ++ 光猫:光电转换器、光纤收发器 + ++ 猫棒:ADSL + ++ 电猫:散热快、mini版的光电转换器 + +多波技术:同时接入光纤(Openwrt) + +光缆:把多个光缆包在芯里 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240408\346\227\240\347\272\277.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240408\346\227\240\347\272\277.md" new file mode 100644 index 0000000..d338dd7 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240408\346\227\240\347\272\277.md" @@ -0,0 +1,45 @@ +## 无线 + +信道设置:ac68u + +## 无线电波:wifi5、wifi6、wifi7 + +实现信号覆盖的方式,以下两种方式: + ++ AC+AP + ++ mesh + +## 卫星 + ++ WG、G60S + +## 数据层链路 + +### 交换机: + ++ 意为“开关”是一种用于电(光)信号转发的网络设备 + ++ 它可以为接入交换机的任意两个网络节点提供独享的电信号通路 + +### ARP: + ++ 数据解析地址协议(通过IP地址获取MAC地址的协议) + +### 局域网 + ++ 其具备的安装便捷、成本节约、扩展方便等特点使其在各类办公室内运用广泛 + ++ 局域网可以实现文件管理、应用软件共享、打印机共享等功能,在使用过程当中,通过维护局域网网络安全,能够有效地保护资料安全,保证局域网网络能够正常稳定的运行 + +### MAC: + ++ 局域网其实是通过MAC地址来通讯 + +## 防范ARP病毒的方式 + ++ 设置静态IP地址 + ++ 绑定IP地址和MAC + +PS:MAC地址理论上是不重复的,也不能修改,但大部分设备,其实是可以修改地址 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240410\346\225\260\346\215\256\351\223\276\350\267\257\345\261\202.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240410\346\225\260\346\215\256\351\223\276\350\267\257\345\261\202.md" new file mode 100644 index 0000000..70f7e2b --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240410\346\225\260\346\215\256\351\223\276\350\267\257\345\261\202.md" @@ -0,0 +1,31 @@ +## 数据链路层 + +交换机: + ++ 二层交换机:傻瓜交换机,网管交换机(vlan) + ++ 三层交换机:部分工作在网络层,提供一些路由器提供功能 + +## 应用层 + ++ HTTP + ++ FTP + ++ SFTP scp(secure) + ++ SMTP简单邮件发送协议 + ++ POP3邮件接收协议,企业邮件 + +软件:35.OM、stackflow + ++ IMAP + ++ telnet,水木年华的BBS,就使用telnet,DHCP自动分配地址 + ++ DNS域名解析 + ++ TPC:有连接的的可靠传输协议 + ++ UDP:没有连接的的不可靠传输协议 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240411\345\272\224\347\224\250\345\261\202.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240411\345\272\224\347\224\250\345\261\202.md" new file mode 100644 index 0000000..60b47a4 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240411\345\272\224\347\224\250\345\261\202.md" @@ -0,0 +1,37 @@ +## 应用层 + +IP地址:是分配给连接到计算机网络的每一个设备的数字标签 + +NAT(网络地址转换):将多个私有IP地址映射到一个公网IP地址 + +端口号范围: + ++ 0-1000:一般的操作系统保留的端口号,不要去占用 + ++ 10001-65535:可以作为用户层面的端口号,TPC和UDP两层协议,可以使用同一个端口 + +网络套接字:协议、主机名、端口号组成的 + +tpc:127.0.0.1:80 + +udp:127.0.0.1:80 + +http://127.0.0.0:80 + +### 子网掩码 + +子网掩码:用于确定IP地址中那一部分表示网络地址 + +2的8次方等于256,因为从0开始,所以范围0-255 + +172.16.70.0当前局域网的网络号172.16.70.1-172.16.70.254 + +子网掩码:255.255.255.0 + ++ 一个网络中只有60台主机,请使用A类地址来规划IP地址及其子网掩码 + +第一段:172.16.70.0-172.16.70.63 172.16.70.1-172.16.70.62 + +第二段:172.16.70.64-172.16.70.127 172.16.70.172-172.16.70.126 + +第三段:172.16.70.129-172.16.70.192 172.16.70.65-172.16.70.191 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240415\346\200\235\347\247\221\346\250\241\346\213\237\345\231\250.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240415\346\200\235\347\247\221\346\250\241\346\213\237\345\231\250.md" new file mode 100644 index 0000000..06b3312 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240415\346\200\235\347\247\221\346\250\241\346\213\237\345\231\250.md" @@ -0,0 +1,33 @@ +## 思科模拟器 + +#### packet tracer 介绍: + + 1. 是Cisco公司针对CCNA认证开发的一个用来设计、配置和故障排除网络的模拟软件 + 1. Packer Tracer模拟器软件比Boson功能强大,比Dynamips操作简单,非常适合网络设备初学者使用。 + 1. Packet Tracer模拟器是考CCNA必须掌握的软件。 + +**技术原理** + +- 交换机的管理方式基本分为两种:带内管理和带外管理。 + +​ 通过交换机的Console端口管理交换机属于带外管理;这种管理方式不占用交换机的网络端口,第一次配置交换机必须利用Console端口进行配置。 + +​ 通过Telnet、拨号等方式属于带内管理。 + +**交换机常用的配置命令行** + +enable:特权模式 + +confing t :全局配置模式 + +interface fa 0/1 : 端口视图模式 + +exit:返回上一级 + +end:直接返回特权模式 + +write:保持配置 + +do write momery : 在其他模式下保存配置信息 + +show runnig-config : 显示当前配置信息 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240417\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\347\241\200\351\205\215\347\275\256\344\270\216\347\256\241\347\220\206.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240417\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\347\241\200\351\205\215\347\275\256\344\270\216\347\256\241\347\220\206.md" new file mode 100644 index 0000000..8061e12 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240417\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\347\241\200\351\205\215\347\275\256\344\270\216\347\256\241\347\220\206.md" @@ -0,0 +1,45 @@ +## 交换机的基础配置与管理 + +#### 快捷指令: + +帮助信息(?) + +命令自动补全(tab) + +中断测试(Ctrl+c,Ctrl+shift+6) + +退回到特权视图(Ctrl+z) + +在特权模式下重启(reload) + +#### 端口配置指令: + +speed(10,100,auto),duplex (half,full,auto): 配置交换机端口参数 + +show version : 查看交换机版本信息 + +show running-config :查看当前生效的配置信息 + +show interface :查看端口信息 + +show mac-address-table : 查看交换机的mac地址 + +#### 密码指令设置: + +设置进入特权模式的密码: + +Switch(config)# enable password *** + +通过console端口连接设备及Telnet远程登录时所需的密码: + +Switch(config)# line console 0 表示配置控制台路线,0是控制台的线路编号 + +Switch(config-line)# login 用于打开登录认证功能 + +Switch(config-line)# password *** 设置进入控制台访问的密码 + +#### ps: + +若交换机设置为auto以外的具体速度,此时应注意保证通信双方也要有相同的设置值。 + +注意事项:在配置交换机时,要注意交换机端口的单双工模式的匹配,如果链路一端设置的是全双工,另一端是自动协商,则会造成响应差和高出错率,丢包现象会很严重。通常两端设置为相同的模式。 \ No newline at end of file -- Gitee From dde4f8181bf2c4f1703b89b94dcf13cff2590998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=8E=9F?= <2139119717@qq.com> Date: Wed, 24 Apr 2024 03:15:27 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9D=8E=E7=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李玟 <2139119717@qq.com> --- ...34\347\250\213\347\231\273\345\275\225.md" | 114 ++++++++++++++++ ...\275\256telent\347\231\273\345\275\225.md" | 105 +++++++++++++++ ...72\346\234\254\351\205\215\347\275\256.md" | 47 +++++++ ...46\234\272VLAN\351\205\215\347\275\256.md" | 126 ++++++++++++++++++ 4 files changed, 392 insertions(+) create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240418SSH\350\277\234\347\250\213\347\231\273\345\275\225.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240419\344\272\244\346\215\242\346\234\272\350\277\234\347\250\213\351\205\215\347\275\256telent\347\231\273\345\275\225.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240421\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\346\234\254\351\205\215\347\275\256.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240422\344\272\244\346\215\242\346\234\272VLAN\351\205\215\347\275\256.md" diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240418SSH\350\277\234\347\250\213\347\231\273\345\275\225.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240418SSH\350\277\234\347\250\213\347\231\273\345\275\225.md" new file mode 100644 index 0000000..2e15330 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240418SSH\350\277\234\347\250\213\347\231\273\345\275\225.md" @@ -0,0 +1,114 @@ +## SSH远程登录 + +在Cisco模拟器(如Cisco Packet Tracer或GNS3)中配置SSH登录,可以让您模拟真实环境中的远程管理操作。以下是详细的步骤来配置SSH登录: + +##### 步骤1: 基本设备配置 + +首先,确保交换机的基本配置已完成,包括设备名称、接口配置等。 + + +Switch> enable + +Switch# configure terminal + +Switch(config)# hostname S1 + +S1(config)# interface vlan 1 + +S1(config-if)# ip address 192.168.1.2 255.255.255.0 + +S1(config-if)# no shutdown + +S1(config-if)# exit + + + +##### 步骤2: 配置域名 + +SSH需要一个域名来生成密钥。 + + +S1(config)# ip domain-name example.com + + + +##### 步骤3: 生成加密密钥 + +生成RSA密钥对,这是SSH需要用到的。密钥长度至少为1024位。 + + +S1(config)# crypto key generate rsa + +The name for the keys will be: S1.example.com + +Choose the size of the key modulus in the range of 360 to 2048 for your + + General Purpose Keys. Choosing a key modulus greater than 512 may take + + a few minutes. + +How many bits in the modulus [512]: 2048 + +% Generating 2048 bit RSA keys, keys will be non-exportable...[OK] + + + +##### 步骤4: 启用SSH + +确保SSH服务已启用。 + + +S1(config)# ip ssh version 2 + +S1(config)# line vty 0 15 + +S1(config-line)# transport input ssh + +S1(config-line)# login local + +S1(config-line)# exit + + + +##### 步骤5: 配置用户和密码 + +配置设备登录的用户名和密码。这是SSH登录验证所必需的。 + + +S1(config)# username admin passsword 123 + +S1(config)#exit + + +S1#wr m //保存 + +##### 步骤6: 保存配置 + +保存配置,确保在设备重启后配置仍然有效。 + + +S1(config)# end + +S1# write memory + +Building configuration... + +[OK] + +S1# + + + +##### 步骤7: 测试SSH连接 + +从另一台设备(如PC或另一台路由器/交换机)测试SSH连接。 + + +PC> ssh -l admin 192.168.1.2 + +Password: adminpass + +以上步骤展示了在Cisco模拟器中配置SSH的完整过程 + + +注:第一步设置的ip address 和后面写的不能一样 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240419\344\272\244\346\215\242\346\234\272\350\277\234\347\250\213\351\205\215\347\275\256telent\347\231\273\345\275\225.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240419\344\272\244\346\215\242\346\234\272\350\277\234\347\250\213\351\205\215\347\275\256telent\347\231\273\345\275\225.md" new file mode 100644 index 0000000..d15744d --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240419\344\272\244\346\215\242\346\234\272\350\277\234\347\250\213\351\205\215\347\275\256telent\347\231\273\345\275\225.md" @@ -0,0 +1,105 @@ +## 交换机远程配置telent登录 + +### 实验步骤: + +进入VLAN端口模式(interface vlan 1) + +配置交换机管理IP地址(ip address IP submask) + +选择具体的线路配置模式(line vty [0-15] [0-15]) + +配置登录密码(password ******) + +手动打开VLAN1端口(no shutdown) + +将两台PC与交换机连接,同时保证其IP地址与交换机管理IP地址在同一个网段 + +``` +PC0设置 +192.168.1.2 +255.255.255.0 +192.168.1.1 +``` + +``` +PC1设置 +192.168.1.3 +255.255.255.0 +192.168.1.1 +``` + +``` +PC0(超级终端下) +Switch>en +Switch#conf t +Switch(config)#interface vlan 1 //进入端口模式 +Switch(config-if)#ip address 192.168.1.1 255.255.255.0 //设置交换机管理IP地址 +Switch(config-if)#no shutdown //打开该端口 +Switch(config-if)#exit +Switch(config)#line vty 0 //进入编号为0的vty线路配置模式 +Switch(config-line)#password cisco0 //设置vty线路编号为0的登录密码 +Switch(config-line)#exit +Switch(config)#line vty 1 4 //进入编号为1~4的vty线路配置模式 +Switch(config-line)#password cisco1 //设置对应vty线路的登录密码 +Switch(config-line)#privilege level 15 //设置该线路权限级别为15 +Switch(config-line)#exit +Switch(config)#service password-encryption //启用全局密码加密功能 +Switch(config)#^z //快捷键(Ctrl+z):进入特权模式 +Switch#show r +``` + +``` +PC0(命令提示符CMD下) +ping 192.168.1.1 //链路通 +telnet 192.168.1.1 +//输入密码: cisco0 +Switch> +PC1(命令提示符CMD下) +ping 192.168.1.1 //链路通 +telnet 192.168.1.1 +//输入密码: cisco1 +Switch#show users //显示正在使用中的控制台和所有连接中的vtp线路 +``` + +### 配置SSH登录(建议) +必须的步骤: + +1.配置设备名称 + +``` +switch(config)# hostname sw1 +``` + +2.配置设备域名 + +``` +sw1(config)# ip domain-name qq.com +``` + +3.配置ip地址(如果是交换机,是配置其vlan的管理地址,如果是路由器,则配置接口地址) +命令如下(以思科模拟器中的交换机为例): + +``` +sw1(config)# interface vlan 1 // 进入默认的vlan +sw1(config)# ip address 192.168.2.250 255.255.255.0 // 配置管理的ip地址 +``` + +4.生成密钥对 + +``` +sw1(config)# crypto key generate rsa +How many bits in the modulus [512]:2048 +% Generating 2048 bit RSA keys, keys will be non-exportable...[OK] +``` + +5.启用SSH版本,并设置本地用户登录,同时设置本地用户和密码 + +``` +sw1(config)# ip ssh version 2 // 启用ssh版本,建议2这个版本,更加安全 +sw1(config)# line vty 0 15 // 设置0~15的虚拟线路(其实就是所有的线路) +sw1(config)# transport input ssh // 用于指定允许通过哪些协议来访问终端行(如 vty 行,即虚拟终端) +sw1(config)# login local // 允许本地账户登录 +sw1(config)# usrname admin password 113 // 设置用户名和密码,用户名可以自己设定,不一定是admin +``` + +6.保存配置 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240421\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\346\234\254\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240421\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\346\234\254\351\205\215\347\275\256.md" new file mode 100644 index 0000000..5bff12e --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240421\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\347\232\204\345\237\272\346\234\254\351\205\215\347\275\256.md" @@ -0,0 +1,47 @@ +# 三层交换机的基本配置 + +## 实验步骤: + +1. 开启路由功能 + +```bash +Switch(config)#ip routing +``` + +2. 配置三层交换机端口的路由功能 + +```bash +Switch(config)#interface fastEthenet 0/5 +Switch(config-if)#no switchport +Switch(config-if)#ip address 192.168.1.1 255.255.255.0 +Switch(config-if)#no shutdown +Switch(config-if)#end +``` + +```bash +PC0设置 +192.168.1.2 +255.255.255.0 +192.168.1.1 + +``` +```bash +Switch0配置 +Switch>en +Switch#config t +Switch(config)#hostname S3560 +S3560(config)#ip routing //开启路由功能 +S3560(config)#interface fastEthemet 0/5 +S3560(config-if)#no switchport //该端口启用三层路由功能 +S3560(config-if)#ip address 192.168.5.1 255.255.255.0 //配置 IP 地址 +S3560(config-if)#no shutdown //开启端口 +S3560(conflg-if)#end +S3560# + +``` +```bash +PC0(命令提示符CMD下) +ping 192.168.1.2 //ping通自身 +ping 192.168.1.1 //ping通网关 + +``` \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240422\344\272\244\346\215\242\346\234\272VLAN\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240422\344\272\244\346\215\242\346\234\272VLAN\351\205\215\347\275\256.md" new file mode 100644 index 0000000..5283577 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240422\344\272\244\346\215\242\346\234\272VLAN\351\205\215\347\275\256.md" @@ -0,0 +1,126 @@ +## 交换机VLAN配置 + +### 交换机的命令行VLAN模式包括: + +``` +VLAN子模式 Switch(vlan)# + +VLAN配置模式 Switch(config-vlan)# + +VLAN接口(SVI)模式 Switch(config-if)# +``` + +实验设备:Switch_2960 2台;PC 4台;直通线;交叉线。 + +## 实验步骤: + +1. 单交换机下的配置 + + - 创建若干个vlan 编号从2开始(1为默认局域网),并命名 + - 将若干端口分配到指定vlan + + ```bash + Switch>en + Switch#conf t + Switch(config)#vlan 2 // 创建VLAN 2 + Switch(config-vlan)#name x1 // 命名VLAN + Switch(config-vlan)#vlan 3 + Switch(config-vlan)#name x2 + Switch(config-vlan)#vlan 3 + Switch(config-vlan)#name x3 + Switch(config-vlan)#exit + Switch(config)#inter rang fa 0/1-8 //批量指定端口 + Switch(config)#switchport access vlan 2 //批量分配端口到指定vlan + ... + Switch(config-vlan)#exit //回到全局设置模式 + Switch(config)#exit //回到特权模式 + Switch#wr m //保存 + + ``` + +2. 多交换机下的配置 + + - 创建VLAN 2和VLAN 3,财务部对应VLAN 2,销售部对应VLAN 3 + + - 将部门PC对应端口划分到相应的VLAN中 + + - 为其中一台交换机配置VTP模式及VTP域名 + + - 配置交换机间互联的端口为Trunk类型 + + ``` + PC设置 + 192.168.1.2 //PC0 + 192.168.1.3 //PC1 + 192.168.1.4 //PC2 + 192.168.1.5 //PC3 + //子网掩码和网关 + 255.255.255.0 + 192.168.1.1 + ``` + + ``` + Switch0配置 + Switch>en + Switch#conf t + Switch(config)#vlan 2 //创建VLAN 2 + Switch(config-vlan)#name Finance_Dept //将该VLAN命名为Finance_Dept + Switch(config-vlan)#vlan 3 //创建VLAN 2 + Switch(config-vlan)#name Sales_Dept //将该VLAN命名为Sales_Dept + Switch(config-vlan)#exit + Switch(config)#inter f0/1 + Switch(config-if)#switchport access vlan 2 //将该端口划分到VLAN 2 + Switch(config-if)#exit + Switch(config)#inter f0/2 + Switch(config-if)#switchport access vlan 3 //将该端口划分到VLAN 3 + Switch(config-if)#exit + Switch(config)#inter f0/24 + Switch(config-if)#switch mode trunk //将端口配置为Trunk模式 + Switch(config-if)#end + Switch#show vlan brief //显示VLAN配置信息 + Switch#vlan database //进入VLAN子模式 + Switch(vlan)#vtp server //设置VTP模式为server + Switch(vlan)#vtp domain vtp0 //设置VTP域名为vtp0 + Switch(vlan)#exit + Switch#show vtp status //查看VTP配置信息 + ``` + + 输入vlan database命令时将报告这一模式将被弃用,所以更新为如下命令(设置其中一台交换机下的vlan模式为服务器模式,以便两台设置了vlan的交换机同步vlan信息,以实现相互通讯) + ``` + vtp mode server // 用于将交换机的vtp模式设置为server,其中一台交换机设置就可以了 + vtp domain vtp0 // 设置vtp的“域名” + ``` + + ``` + Switch1配置 + Switch>en + Switch#vlan database //进入VLAN子模式 + Switch(vlan)#vtp client //设置VTP模式为client + Switch(vlan)#vtp domain vtp0 //设置VTP域名为vtp0,此处不填亦可 + Switch(vlan)#exit + Switch#show vtp status //查看VTP配置信息 + Switch#show vlan brief //显示VLAN配置信息 + Switch#conf t + Switch(config)#inter f0/1 + Switch(config-if)#switchport access vlan 2 //将该端口划分到VLAN 2 + Switch(config-if)#exit + Switch(config)#inter f0/2 + Switch(config-if)#switchport access vlan 3 //将该端口划分到VLAN 3 + Switch(config-if)#exit + Switch(config)#inter f0/24 + Switch(config-if)#switch mode trunk //将端口配置为Trunk模式 + Switch(config-if)#end + Switch#show r + ``` + + ``` + PC0(命令提示符CMD下) + ping 192.168.1.3 //链路不通 + ping 192.168.1.4 //链路通 + ``` + + ``` + PC1(命令提示符CMD下) + ping 192.168.1.4 //链路不通 + ping 192.168.1.5 //链路通 + ``` \ No newline at end of file -- Gitee From 1aad13cb7d7db1788e2a22ea34d61571c287976e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=8E=9F?= <2139119717@qq.com> Date: Sat, 11 May 2024 08:36:12 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E6=80=9D=E7=A7=91=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李玟 <2139119717@qq.com> --- ...20\346\240\221\345\215\217\350\256\256.md" | 64 ++++++++++ ...32\345\220\210\351\205\215\347\275\256.md" | 81 ++++++++++++ ...42\346\234\272\351\205\215\347\275\256.md" | 71 +++++++++++ ...13\351\227\264\351\200\232\350\256\257.md" | 91 +++++++++++++ ...25\350\207\202\350\267\257\347\224\261.md" | 91 +++++++++++++ ...31\346\200\201\350\267\257\347\224\261.md" | 103 +++++++++++++++ .../20240506RIP\351\205\215\347\275\256.md" | 74 +++++++++++ ...345\212\240SVI\351\205\215\347\275\256.md" | 120 ++++++++++++++++++ 8 files changed, 695 insertions(+) create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240423\347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240424\347\253\257\345\217\243\350\201\232\345\220\210\351\205\215\347\275\256.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240425\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\351\205\215\347\275\256.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240426\351\205\215\347\275\256\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272VLAN\344\271\213\351\227\264\351\200\232\350\256\257.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240428\345\215\225\350\207\202\350\267\257\347\224\261.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240429\351\205\215\347\275\256\345\215\225\350\207\202\351\235\231\346\200\201\350\267\257\347\224\261.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240506RIP\351\205\215\347\275\256.md" create mode 100644 "\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240508RIP\345\212\240SVI\351\205\215\347\275\256.md" diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240423\347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240423\347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" new file mode 100644 index 0000000..b9481ff --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240423\347\224\237\346\210\220\346\240\221\345\215\217\350\256\256.md" @@ -0,0 +1,64 @@ +### 生成树协议 +为了提高网络可靠性 交换网络中通常会使用冗余链路 而冗余链路会给交换网络带来环路风险 并导致广播风暴以及MAC地址表不稳定等问题 进而会影响到用户的通信质量 生成树协议(Spanning Tree Protocol)可以在提高可靠性的同时又能避免环路带来的各种问题 + +### 生成树版本 +生成树(STP) +- stp通过阻塞端口来消除环路 并能够实现链路备份目的 +- 消除了广播风暴 +- 物理链路冗余 网络变成了层次化结构的网络 + +快速生成树协议(RSTP) +- 当主链路断掉后可以在一秒内收敛快速恢复网络的连通性 + +### 生成树端口四种状态 +- 阻塞(Block):只监听/接收BPDU报文 +- 侦听(Listening):只能接收或发送BPDU报文 +- 学习(Learning):能接收或发送BPDU报文,并形成MAC地址表,但不能转发数据帧 +- 转发(Forwarding):能接收或发送BPDU报文,并形成MAC地址表,同时发送和接收数据帧 + +`注意:两台交换机都配置快速生成树协议后,再将两台交换机连接起来 如果先连线再配置会造成广播风暴,影响交换机的正常工作` + +![alt text](https://img2.imgtp.com/2024/04/23/LwG4ncNU.png) + +### SW1 +````````bash +Switch>enable +Switch#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#hostname SW1 +SW1(config-vlan)#int f0/1 +SW1(config-if)#swi acc vlan 10 +SW1(config-if)#int g0/1-2 +SW1(config-if)#swi mode trunk -- 开启端口Trunk模式 +SW1(config-if)#exit +SW1(config)#spanning-tree mode rapid-pvst --配置生成树协议 +```````` + +### SW2 +````````bash +Switch>enable +Switch#configure terminal +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#hostname SW2 +SW2(config-vlan)#int f0/1 +SW2(config-if)#swi acc vlan 10 +SW2(config-if)#int g0/1-2 +SW2(config-if)#swi mode trunk -- 开启端口Trunk模式 +SW2(config-if)#exit +SW2(config)#spanning-tree mode rapid-pvst --配置生成树协议 +```````` +配置两台pc机IP及子网掩码 测试是否能联通 + +### 查看交换机生成树协议配置 +- Switch#show spanning-tree summary +- Switch#show spanning-tree + +### 测试链路 +```bash +在pc机中ping -t --不间断的ping指定计算机 +Switch(config)#inter g0/1 --关闭主链路上的端口 +Switch(config-if)#shutdown +``` +这时候可以发现当主链路断开后 两台pc机依然能够持续ping通中 (通过生成树协议在两个或两个通信时候来解决多交换机环路问题) + +![alt text](https://img2.imgtp.com/2024/04/23/FrzwpsBw.png) \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240424\347\253\257\345\217\243\350\201\232\345\220\210\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240424\347\253\257\345\217\243\350\201\232\345\220\210\351\205\215\347\275\256.md" new file mode 100644 index 0000000..8c34047 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240424\347\253\257\345\217\243\350\201\232\345\220\210\351\205\215\347\275\256.md" @@ -0,0 +1,81 @@ +## 端口聚合配置 +端口聚合(又称为链路聚合) 将交换机上的多个端口在物理上连接起来 在逻辑上捆绑在一起 形成一个拥有较大宽带的端口 可以实现负载均衡并提供冗余链路 + +- 由于cisco交换机默认开启生成树协议 要实现端口聚合 需要关闭生成树协议 +```````bash +Switch(config)#no spanning-tree moed rapid-post +``````` +- 配置端口模式 +```````bash +Switch(config)#interface range g0/1-2 +``````` +- 将端口加入聚合组 +```````bash +Switch(config-if-rang)#channel-group 1 mode on +-- mode active表示接口将以主动模式参与LACP协商 +-- 还有另一种模式passive,表示接口将以被动模式参与协商 +Switch(config-if-rang)#swi mode trunk -- cisco交换机自动将连接端口配置trunk模式 所以在测试中可以略过这一步配置 +``````` +- 配置聚合口 +```````bash +Switch(config)#port-channel load-balance dst-ip -- 按目的IP地址来实现负载均衡 +Switch(config)#interface port-channel 1 -- 如果需要的话可以进入port-channel接口配置模式并分配IP地址等参数 +Switch#show interfaces etherchannel -- 显示聚合端口信息 +``````` + +当关闭了g0/1端口后还能ping通 且未出现丢包 + +![alt text](https://img2.imgtp.com/2024/04/24/nv8J8cFj.png) + +## 端口安全配置 + +![alt text](https://img2.imgtp.com/2024/04/27/z6Y2COTd.png) + +### 配置端口安全 +````````````bash +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#int range f0/3-24,g0/1-2 -- 禁用未使用的端口 +Switch(config-if-range)#shutdown +Switch(config-if-range)#exit +Switch(config)#int range f0/1-2 +Switch(config-if-range)#swi port-security -- 端口安全配置命令 +Command rejected: FastEthernet0/1 is a dynamic port. -- 这里报错了 +Command rejected: FastEthernet0/2 is a dynamic port. -- 这是因为端口安全只能在手动配置的接入模式(access)端口或手动配置的中继(trunk)端口上 +Switch(config-if-range)#swi mode acc -- 设置接入模式 +Switch(config-if-range)#swi port-security -- 再一次配置就没有报错提示 +Switch(config-if-range)#swi port-security maximum 1 -- 限制端口上MAC地址最大数量 默认值为1 +Switch(config-if-range)#swi port-security violation restrict -- 设置违规模式 +Switch(config-if-range)#swi port-security mac-address sticky + +%LINK-5-CHANGED: Interface FastEthernet0/3, changed state to administratively down +%LINK-5-CHANGED: Interface FastEthernet0/4, changed state to administratively down +······ +Switch(config-if-range)#exit + +* ipconfig /all查看每台pc机的MAC地址(Physical Address)* + +Switch(config)#int f0/1 +Switch(config-if)#switchport port-security mac-address sticky MAC地址 +Switch(config-if)#exit +Switch(config)#int f0/2 +Switch(config-if)#switchport port-security mac-address sticky MAC地址 +Switch(config-if)#exit +```````````` + +### 动态获取 +````````bash +Switch(config-if)#swi port-security mac-address MAC地址 +```````` +`在执行switchport port-security之后,这个端口直接连接的设备的源MAC地址就会成为安全MAC。但是,这个地址不会添加到启动配置中,也就是说,交换机重启后必须重新学习MAC地址` + +### 动态获取-粘滞(Sticky) +````````bash +Switch(config-if)#swi port-security mac-address sticky (MAC地址) -- 将动态获取的MAC地址写入到运行配置文件中 +```````` + +### 设置端口中违规后的操作 有以下三种模式 +- swi port-security violation (shutdown) -- 如果违反规定关闭端口 +- swi port-security violation (protect) -- 当违规时 只丢弃违规的数据流量 而且不会有通知有流量违规 +- swi port-security violation (restrict) -- 当违规时 只丢弃违规的流量 不违规的正常转发 但它会产生流量违规通知 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240425\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240425\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\351\205\215\347\275\256.md" new file mode 100644 index 0000000..0457c9b --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240425\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272\351\205\215\347\275\256.md" @@ -0,0 +1,71 @@ +## 三层交换机配置 +- 开启路由功能 +```````` +Switch(config)#ip routing +```````` +- 三层交换机端口默认为二层口,如果需要启用三层功能就需要在此端口输入`no switchport`命令 +- 三层交换机设置Trunk模式 +``````` +Switch(config-if-range)#swi trunk encapsulation dot1q +Switch(config-if-range)#swi mode trunk +``````` +- 显示路由表 +`````` +Switch#show ip route +`````` +`注意:配置三层交换机通讯时一定要给pc机配置网关` + +![alt text](https://img2.imgtp.com/2024/04/27/sJ4D2O9A.png) + +### SW1 +````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#int f0/1 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config-vlan)#int f0/2 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 20 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int g0/1 +Switch(config-if)#swi mode trunk +Switch(config-if)#ex +````````` + +### SW2 +````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#exit +Switch(config)#ip routing -- 开启三层交换机路由功能 +Switch(config-vlan)#int vlan 10 -- 配置VLAN网关及子网掩码并开启 +Switch(config-if)#ip addr 192.168.1.1 255.255.255.0 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int vlan 20 +Switch(config-if)#ip addr 192.168.2.1 255.255.255.0 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int g0/1 +Switch(config-if-range)#swi trunk encapsulation dot1q -- 封装 设置Trunk模式 +Switch(config-if-range)#swi mode trunk +Switch(config-if-range)#ex +Switch(config)#int f0/1 -- 将端口划分到VLAN中并开启 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#do wr m +Building configuration... +[OK] +````````` \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240426\351\205\215\347\275\256\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272VLAN\344\271\213\351\227\264\351\200\232\350\256\257.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240426\351\205\215\347\275\256\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272VLAN\344\271\213\351\227\264\351\200\232\350\256\257.md" new file mode 100644 index 0000000..e7fc1c9 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240426\351\205\215\347\275\256\344\270\211\345\261\202\344\272\244\346\215\242\346\234\272VLAN\344\271\213\351\227\264\351\200\232\350\256\257.md" @@ -0,0 +1,91 @@ +## 配置三层交换机VLAN之间通讯 + +![alt text](https://img2.imgtp.com/2024/04/27/jFets3m8.png) + +### SW1 +````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 -- 创建VLAN10、VLAN20 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#int f0/1 -- 将端口划分到VLAN中设置模式并开启 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#int f0/2 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 20 +Switch(config-if)#no shut +Switch(config-if)#int f0/3 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#int f0/4 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 20 +Switch(config-if)#no shut +Switch(config-if)#int g0/1 -- 设置交换机为Trunk模式 +Switch(config-if)#swi mode trunk +Switch(config-if)#ex +Switch(config)# +````````` +### SW2 +````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 20 +Switch(config-vlan)#int f0/1 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 20 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int g0/2 +Switch(config-if)#swi mode trunk +Switch(config-if)#ex +Switch(config)# +````````` +`配置完两台交换机时可以测试一下同VLAN能否ping通` + +### SW3 +````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#vlan 30 +Switch(config-vlan)#exit +Switch(config)#ip routing -- 开启三层交换机路由功能 +Switch(config-vlan)#int vlan 10 -- 配置VLAN网关及子网掩码并开启 +Switch(config-if)#ip addr 192.168.1.1 255.255.255.0 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int vlan 20 +Switch(config-if)#ip addr 192.168.2.1 255.255.255.0 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int vlan 30 +Switch(config-if)#ip addr 192.168.3.1 255.255.255.0 +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#int rang g0/1-2 +Switch(config-if-range)#swi trunk encapsulation dot1q -- 封装 设置Trunk模式 +Switch(config-if-range)#swi mode trunk +Switch(config-if-range)#ex +Switch(config)#int f0/1 -- 将端口划分到VLAN中并开启 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#int f0/2 +Switch(config-if)#swi acc vlan 30 +Switch(config-if)#swi mode acc +Switch(config-if)#no shut +Switch(config-if)#ex +Switch(config)#do wr m +Building configuration... +[OK] +````````` +`配置完所有可以测试一下同VLAN能否ping通 不同VLAN能否ping通` \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240428\345\215\225\350\207\202\350\267\257\347\224\261.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240428\345\215\225\350\207\202\350\267\257\347\224\261.md" new file mode 100644 index 0000000..a40efa8 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240428\345\215\225\350\207\202\350\267\257\347\224\261.md" @@ -0,0 +1,91 @@ +## 单臂路由 +单臂路由(router-on-a-sTIck)是指在路由器的一个接口上通过配置子接口(或“逻辑接口”,并不存在真正物理接口)的方式,实现原来相互隔离的不同VLAN(虚拟局域网)之间的互联互通 + +### 为什么用单臂路由 +在没有单臂路由的情况下,不同VLAN之间的通信需要通过网络中的路由器进行,这会导致数据传输延迟并增加了网络复杂性。使用单臂路由后,可以在一个物理接口上通过配置逻辑接口的方式实现不同VLAN之间的互联互通,降低了网络设备的投入成本,简化了网络结构,并提高了网络管理效率。 + +另外,单臂路由的NAT(网络地址转换)协议功能可以对外提供访问服务,使得用户可以访问外部网络资源。同时,通过一些特定的配置,单臂路由还可以实现网络流量的监控、管理和优化,进一步提高了网络的性能和安全性。特别是在企业网络和公共网络中,它的应用非常广泛 + +### 单臂路由的子接口 +路由器的物理接口可以被划分成多个逻辑接口,这些被划分后的逻辑接口被形象的称为子接口。值得注意的是这些逻辑子接口不能被单独的开启或关闭,也就是说,当物理接口被开启或关闭时,所有的该接口的子接口也随之被开启或关闭 + +### 优缺点 +  VLAN能有效分割局域网,实现各网络区域之间的访问控制。但现实中,往往需要配置某些VLAN之间的互联互通。比如,你的公司划分为领导层、销售部、财务部、人力部、科技部、审计部,并为不同部门配置了不同的VLAN,部门之间不能相互访问,有效保证了各部门的信息安全。但经常出现领导层需要跨越VLAN访问其他各个部门,这个功能就由单臂路由来实现 + +- 优点: 实现不同vlan之间的通信,有助理解、学习VLAN原理和子接口概念 +- 缺点: 容易成为网络单点故障,配置稍有复杂,现实意义不大 + +![alt text](https://img2.imgtp.com/2024/04/28/eboM8uz8.png) + +- 交换机配置 +`````````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#vlan 30 +Switch(config-vlan)#vlan 40 +Switch(config-vlan)#exit +Switch(config)#interface fastEthernet 0/1 +Switch(config-if)#switchport mode access -- 主机与交换机之间要开启access链路模式 +Switch(config-if)#switchport access vlan 10 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface fastEthernet 0/2 +Switch(config-if)#switchport mode access +Switch(config-if)#switchport access vlan 20 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface fastEthernet 0/3 +Switch(config-if)#switchport mode access +Switch(config-if)#switchport access vlan 30 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface fastEthernet 0/4 +Switch(config-if)#switchport mode access +Switch(config-if)#switchport access vlan 40 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface fastEthernet 0/5 +Switch(config-if)#switchport mode trunk -- 路由器与交换机之间要开启trunk链路模式 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)# +`````````` + +- 路由器配置 +`````````` +Would you like to enter the initial configuration dialog? [yes/no]: no +Press RETURN to get started! + +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#interface f0/0 --Cisco路由器接口默认是关闭的 配置前先进行开启接口 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#interface fastEthernet 0/0.1 +Router(config-subif)#encapsulation dot1Q 10 -- 子接口使用了802.1Q协议进行封装 子接口后数字对应相应的VLAN +Router(config-subif)#ip address 192.168.1.1 255.255.255.0 -- 子接口分配网关以及子网掩码 +Router(config-subif)#no shutdown +Router(config-subif)#exit +Router(config)#interface fastEthernet 0/0.2 -- 子接口对应一个VLAN +Router(config-subif)#encapsulation dot1Q 20 +Router(config-subif)#ip address 192.168.2.1 255.255.255.0 +Router(config-subif)#no shutdown +Router(config-subif)#exit +Router(config)#interface fastEthernet 0/0.3 +Router(config-subif)#encapsulation dot1Q 30 +Router(config-subif)#ip address 192.168.3.1 255.255.255.0 +Router(config-subif)#no shutdown +Router(config-subif)#exit +Router(config)#interface fastEthernet 0/0.4 +Router(config-subif)#encapsulation dot1Q 40 +Router(config-subif)#ip address 192.168.4.1 255.255.255.0 +Router(config-subif)#no shutdown +Router(config-subif)#exit +Router(config)# +`````````` + +配置完成 测试不同VLAN之间能否互通 能通表示配置单臂路由成功 \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240429\351\205\215\347\275\256\345\215\225\350\207\202\351\235\231\346\200\201\350\267\257\347\224\261.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240429\351\205\215\347\275\256\345\215\225\350\207\202\351\235\231\346\200\201\350\267\257\347\224\261.md" new file mode 100644 index 0000000..27b6270 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240429\351\205\215\347\275\256\345\215\225\350\207\202\351\235\231\346\200\201\350\267\257\347\224\261.md" @@ -0,0 +1,103 @@ +### 配置单臂静态路由 + +![!\[image-20240429112512109\](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20240429112512109.png)](https://img2.imgtp.com/2024/05/05/AatgYDUT.png) + +### 交换机配置 + +`````` +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#vlan 20 +Switch(config-vlan)#int f0/1 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 10 +Switch(config-if)#no shut +Switch(config-if)#int f0/2 +Switch(config-if)#swi mode acc +Switch(config-if)#swi acc vlan 20 +Switch(config-if)#no shut +Switch(config-if)#int f0/4 +Switch(config-if)#swi mode trunk +Switch(config-if)#swi trunk all +Switch(config-if)#swi trunk allowed vlan 10,20 -- 允许所有VLAN通过 +Switch(config-if)#no shut +Switch(config-if)#exit +Switch(config)# +`````` + +### 路由器一 + +``` +Would you like to enter the initial configuration dialog? [yes/no]: no +Press RETURN to get started! + +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int f0/0 +Router(config-if)#no shut +Router(config-if)#int f0/0.1 -- 进入子接口 +Router(config-subif)#encapsulation dot1Q 10 -- 子接口封装配置网关及子网掩码 +Router(config-subif)#ip addr 192.168.1.1 255.255.255.0 +Router(config-subif)#no shut +Router(config-subif)#int f0/0.2 +Router(config-subif)#encapsulation dot1Q 20 +Router(config-subif)#ip addr 192.168.2.1 255.255.255.0 +Router(config-subif)#no shut +Router(config-subif)#exit +Router(config)#int f0/1 +Router(config-if)#ip addr 10.10.10.31 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#exit +Router(config)#ip route 192.168.3.0 255.255.255.0 10.10.10.13 -- 配置静态路由 +Router(config)#ip route 192.168.4.0 255.255.255.0 11.11.11.12 -- 目的地址 子网掩码 下一跳地址IP +Router(config)#ip route 192.168.4.0 255.255.255.0 11.11.11.30 +Router(config)# + +``` + +### 路由器二 + +````` +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int f0/0 +Router(config-if)#ip addr 10.10.10.13 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#int f0/1 +Router(config-if)#ip addr 192.168.3.1 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#exit +Router(config)#int s0/3/0 +Router(config-if)#ip addr 11.11.11.30 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#clock rate 64000 +Router(config-if)#exit +Router(config)#ip route 192.168.2.0 255.255.255.0 10.10.10.31 +Router(config)#ip route 192.168.1.0 255.255.255.0 10.10.10.31 +Router(config)#ip route 192.168.4.0 255.255.255.0 11.11.11.12 +Router(config)# +````` + +### 路由器三 + +````` +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int s0/3/1 +Router(config-if)#ip addr 11.11.11.12 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#int f0/0 +Router(config-if)#ip addr 192.168.4.1 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#exit +Router(config)#ip route 192.168.3.0 255.255.255.0 11.11.11.30 +Router(config)#ip route 192.168.2.0 255.255.255.0 10.10.10.31 +Router(config)#ip route 192.168.1.0 255.255.255.0 10.10.10.31 +Router(config)#ip route 192.168.3.0 255.255.255.0 10.10.10.13 +Router(config)# +````` \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240506RIP\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240506RIP\351\205\215\347\275\256.md" new file mode 100644 index 0000000..22a0c46 --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240506RIP\351\205\215\347\275\256.md" @@ -0,0 +1,74 @@ +# RIP配置 +`RIP(Routing Information Protocol)-路由信息协议`:是一种基于距离矢量算法的协议 以跳数(被传送数据所经过路由器的个数)为度数来衡量到达目标网络的距离 属于IGP(内部网关协议)协议 有RIP1和RIP2两个版本 基于UDP协议 端口号为520 主要用于小型网络 + +![alt text](https://img2.imgtp.com/2024/05/06/fb1PdHCz.png) + +### 配置路由器(Router0)端口 +``````````bash +Would you like to enter the initial configuration dialog? [yes/no]: no +Press RETURN to get started! + +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int g0/0/0 +Router(config-if)#ip addr 192.168.10.1 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#int g0/0/1 +Router(config-if)#ip addr 10.10.10.2 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#exit + +--配置路由器(Router0)RIP协议 + +Router(config)#route rip -- 开启RIP协议 +Router(config-router)#version 2 -- 启用RIP协议第二版 +Router(config-router)#network 192.168.10.0 -- 宣告网段 +Router(config-router)#network 10.10.10.0 +Router(config-router)#no auto-summary -- 关闭自动汇总 +Router(config-router)#do wr m +Building configuration... +[OK] +`````````` + +### 为什么要关闭自动汇总 +是因为RIP协议更新时不带子网掩码,路由器会根据IP自动判断汇总给其加上自己汇总后的子网掩码。假如有个网段是30.1.1.0/24,更新时不会带上24,路由器会认为是A类IP,通过自动汇总会把24汇总成8,这个不是我们想要的,所以要关闭自动汇总 + +### 配置路由器(Router1)端口 +``````````bash +Would you like to enter the initial configuration dialog? [yes/no]: no +Press RETURN to get started! + +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#int g0/0/0 +Router(config-if)#ip addr 192.168.20.1 255.255.255.0 +Router(config-if)#no shut +Router(config)#int g0/0/1 +Router(config-if)#ip addr 10.10.10.3 255.255.255.0 +Router(config-if)#no shut +Router(config-if)#exit + +--配置路由器(Router1)RIP协议 + +Router(config)#route rip +Router(config-router)#version 2 +Router(config-router)#network 192.168.20.0 +Router(config-router)#network 10.10.10.0 +Router(config-router)#no auto-summary +Router(config-router)#do wr m +Building configuration... +[OK] +`````````` + +### 查看路由表 +``````````bash +Router(config)#do show ip route +L-本地,C-直连,S-静态,R-RIP,以R开头的就是RIP协议的 +`````````` +![alt text](https://img2.imgtp.com/2024/05/06/8xyGLw5S.png) + +配置完成后进入主机中测试链路(此时网关以及主机都能ping通(且线路是绿灯`注意绿灯不代表一定是能通`)) + +![alt text](https://img2.imgtp.com/2024/05/06/qJoKQPiO.png) \ No newline at end of file diff --git "a/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240508RIP\345\212\240SVI\351\205\215\347\275\256.md" "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240508RIP\345\212\240SVI\351\205\215\347\275\256.md" new file mode 100644 index 0000000..7cbb12d --- /dev/null +++ "b/\346\235\216\347\216\237\347\232\204\347\254\224\350\256\260/20240508RIP\345\212\240SVI\351\205\215\347\275\256.md" @@ -0,0 +1,120 @@ +# RIP加SVI配置 +`网关:在同一网络下是不需要用到网关 而在需要访问另一个网络时用到网关来转发数据、数据包` +`实现VLAN间互通就两种方法:一种是三层交换机SVI 一种是单臂路由` + +![alt text](https://img2.imgtp.com/2024/05/08/pzfJqZD5.png) + +### 配置交换机 +````````bash +Switch>enable +Switch#configure terminal +Switch(config)#vlan 10 -- 创建VLAN10、VLAN20 +Switch(config-vlan)#exit +Switch(config)#vlan 20 +Switch(config-vlan)#exit +Switch(config)#interface range fastEthernet 0/1-2 -- 将端口加入到对应的VLAN中并开启端口 +Switch(config-if-range)#switchport mode access -- 主机与交换机连接链路设置为接入模式 +Switch(config-if-range)#switchport access vlan 10 +Switch(config-if-range)#no shutdown +Switch(config-if-range)#exit +Switch(config)#interface range fastEthernet 0/3-4 +Switch(config-if-range)#switchport mode access +Switch(config-if-range)#switchport access vlan 20 +Switch(config-if-range)#no shutdown +Switch(config-if-range)#exit +Switch(config)#interface gigabitEthernet 0/2 -- 交换机与交换机之间的链路设置为中继模式 +Switch(config-if)#switchport mode trunk +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)# +```````` + +### 配置三层交换机 +````````bash +Switch>enable +Switch#configure terminal +Switch(config)#ip routing -- 三层开启路由功能 +Switch(config)#vlan 10 -- 创建VLAN10、VLAN20 +Switch(config-vlan)#exit +Switch(config)#vlan 20 +Switch(config-vlan)#exit +Switch(config)#interface vlan 10 -- 每个VLAN配置相应网关以及子网掩码并开启端口 +Switch(config-if)#ip addr 192.168.10.1 255.255.255.0 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface vlan 20 +Switch(config-if)#ip addr 192.168.20.1 255.255.255.0 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface gigabitEthernet 0/2 +Switch(config-if)#switchport trunk encapsulation dot1q -- 交换机与交换机之间的链路设置为中继模式(三层注意先封装) +Switch(config-if)#switchport mode trunk +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#interface gigabitEthernet 0/1 -- 交换机与路由器连接(三层交换机默认为二层端口要开启路由端口) +Switch(config-if)#no switchport +Switch(config-if)#ip address 10.10.10.1 255.255.255.0 +Switch(config-if)#no shutdown +Switch(config-if)#exit +Switch(config)#route rip -- 配置RIP动态路由协议将信息传递给附近的端口 +Switch(config-router)#version 2 +Switch(config-router)#network 10.10.10.0 +Switch(config-router)#network 192.168.10.0 +Switch(config-router)#network 192.168.20.0 +Switch(config-router)#do wr m +Building configuration... +[OK] +```````` + +### 路由器配置 +- 将R1、R2的每个端口配置IP地址以及子网掩码并开启端口 +- 在R1、R2路由器配置RIP动态路由协议将信息传递给附近的端口 + +### 配置路由器一 +````````bash +Router>enbale +Router#configure terminal +Router(config)#interface gigabitEthernet 0/1 +Router(config-if)#ip address 10.10.10.2 255.255.255.0 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#interface gigabitEthernet 0/0 +Router(config-if)#ip address 192.168.30.1 255.255.255.0 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#interface gigabitEthernet 0/2 +Router(config-if)#ip address 172.16.88.13 255.255.255.0 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#route rip +Router(config-router)#version 2 +Router(config-router)#network 10.10.10.0 +Router(config-router)#network 192.168.30.0 +Router(config-router)#network 172.16.88.0 +Router(config-router)#do wr m +Building configuration... +[OK] +```````` + +### 配置路由器二 +````````bash +Router>enable +Router#configure terminal +Router(config)#interface gigabitEthernet 0/1 +Router(config-if)#ip address 172.16.88.180 255.255.255.0 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#interface gigabitEthernet 0/0 +Router(config-if)#ip address 192.168.40.1 255.255.255.0 +Router(config-if)#no shutdown +Router(config-if)#exit +Router(config)#route rip +Router(config-router)#version 2 +Router(config-router)#network 172.16.88.0 +Router(config-router)#network 192.168.40.0 +Router(config-router)#do wr m +Building configuration... +[OK] +```````` + +配置完成后进入主机中测试链路(此时网关以及主机都能ping通(且线路是绿灯`注意绿灯不代表一定是能通`)) \ No newline at end of file -- Gitee