From d22211f4466780915e807fe41fd112411d2fe45c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=97=AD=E4=B8=9C?= <3228676708@qq.com> Date: Wed, 8 May 2024 09:19:56 +0000 Subject: [PATCH 1/3] ez MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马旭东 <3228676708@qq.com> --- .../2024.04.27-OSPF.md" | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 "01\351\251\254\346\227\255\344\270\234/2024.04.27-OSPF.md" diff --git "a/01\351\251\254\346\227\255\344\270\234/2024.04.27-OSPF.md" "b/01\351\251\254\346\227\255\344\270\234/2024.04.27-OSPF.md" new file mode 100644 index 0000000..23f754a --- /dev/null +++ "b/01\351\251\254\346\227\255\344\270\234/2024.04.27-OSPF.md" @@ -0,0 +1,137 @@ +# OSPF + +```html +1.OSPF(开放式最短路径优先):无类链路状态路由协议 +2.Router(config)#route ospf 1 +3.Router(config-router)#network 192.168.1.0 0.0.0.255 area 0 +``` + +### 作业 + +```HTML +PC0配置(vlan 10) + IP地址: 192.168.1.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.1.1 + +PC1配置(vlan 40) + IP地址: 192.168.2.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.2.1 + +PC2配置(vlan 20) + IP地址: 192.168.5.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.5.1 + +PC3配置(vlan 30) + IP地址: 192.168.6.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.6.1 + +PC4配置(vlan 50) + IP地址: 192.168.7.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.7.1 + +PC5配置(vlan 60) + IP地址: 192.168.8.2 + 子网掩码: 255.255.255.0 + 网关: 192.168.8.1 +``` + +```HTML +Switch1操作指令: +en +conf t +vlan 10 +exit +vlan 20 +exit +vlan 30 +exit +int f 0/1 +switch access vlan 10 +int f 0/3 +switch access vlan 20 +int f 0/4 +switch access vlan 30 +int f 0/2 +switch mode trunk +``` + +```HTML +Switch2操作指令: +en +conf t +vlan 40 +exit +vlan 50 +exit +vlan 60 +exit +int f 0/1 +switch access vlan 40 +int f 0/3 +switch access vlan 50 +int f 0/4 +switch access vlan 60 +int f 0/2 +switch mode trunk + +``` + +```HTML +Router1操作指令: +en +conf t +int f 0/0 +no shut +int f 0/1 +ip address 192.168.3.1 255.255.255.0 +no shut + +conf t +Router(config)#route ospf 1 +Router(config-route)#network 192.168.1.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.3.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.5.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.6.0 0.0.0.255 area 0 +``` + +```HTML +Router2操作指令: +en +conf t +int f 0/0 +ip address 192.168.3.2 255.255.255.0 +no shut +int f 0/1 +ip address 192.168.4.1 255.255.255.0 +no shut + +conf t +Router(config)#route ospf 1 +Router(config-route)#network 192.168.4.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.3.0 0.0.0.255 area 0 +``` + +```HTML +Router3操作指令: +en +conf t +int f 0/0 +ip address 192.168.4.2 255.255.255.0 +no shut +int f 0/1 +ip address 192.168.2.1 255.255.255.0 +no shut + +conf t +Router(config)#route ospf 1 +Router(config-route)#network 192.168.2.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.4.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.7.0 0.0.0.255 area 0 +Router(config-route)#network 192.168.8.0 0.0.0.255 area 0 +``` + -- Gitee From 8ccc33f2874a7c437ab122313874f97cf7a93cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=97=AD=E4=B8=9C?= <3228676708@qq.com> Date: Wed, 8 May 2024 09:20:54 +0000 Subject: [PATCH 2/3] ez MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马旭东 <3228676708@qq.com> --- .../2024.04.30-SSH.md" | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 "01\351\251\254\346\227\255\344\270\234/2024.04.30-SSH.md" diff --git "a/01\351\251\254\346\227\255\344\270\234/2024.04.30-SSH.md" "b/01\351\251\254\346\227\255\344\270\234/2024.04.30-SSH.md" new file mode 100644 index 0000000..47e7e3a --- /dev/null +++ "b/01\351\251\254\346\227\255\344\270\234/2024.04.30-SSH.md" @@ -0,0 +1,93 @@ +# SSH + +```html +SSH:安全外壳协议 +``` + +```html +如何设置SSH登录交换机 + +1.创建拓扑图 +2.给两端设置好IP地址 + (1).Pc机可以直接设置 + (2).交换机因为是二层网络设备,要通过给默认的VLAN1这个接口设置ip(设置后,所有的接口都共享一个IP地址) +3.修改主机名为默认名称以外的名称 +4.给交接机设置域名 +5.创建RSA的KEYS +6.开启SSH的v2版本 +7.默认情况下,特权密码是关闭了,且SSH又需要开启,所以在交换机要开启Enable的密码 +8.保存配置 +``` + +```html +如何用PC机登录交换机的SSH +C:\>ssh -l(不是1) admin 192.168.100.1 +``` + +### 练习 + +```html +1.使用SSH登录交换机 +PC机IP:192.168.1.2 +交换机IP:192.168.1.1 + + +en +conf t +int vlan 1 +no shut +ip address 192.168.1.1 255.255.255.0 +host R1 +ip domain-name ljie.online +crypto key generate rsa +How many bits in the modulus [512]: 2048 +ip ssh version 2 +line vty 0 15 +login local +transport input ssh +exit +username admin password +enable password 666 +enable secret 777 +service password-encryption +exit +R1#write memory +``` + +```html +1.使用SSH登录路由器 +PC机IP:192.168.2.2 +路由器IP:192.168.2.1 + + +en +conf t +int f 0/0 +no shut +ip address 192.168.2.1 255.255.255.0 +host R1 +ip domain-name ljie.online +crypto key generate rsa +How many bits in the modulus [512]: 2048 +ip ssh version 2 +line vty 0 15 +login local +transport input ssh +exit +username admin password +enable password 666 +enable secret 777 +service password-encryption +exit +R1#write memory +``` + +```html +3.使用SSH和TELNET登录交换机及路由器 + +line vty 0 15 +login local +transport input all +exit +``` + -- Gitee From 66ec25922fd53f8b57c773d86f28232556ecb1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=97=AD=E4=B8=9C?= <3228676708@qq.com> Date: Wed, 8 May 2024 09:21:35 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=81=87=E6=9C=9F?= =?UTF-8?q?=E5=8E=BB=E5=93=AA=E4=BA=86=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马旭东 <3228676708@qq.com> --- ...32\345\220\210\350\256\276\347\275\256.md" | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 "01\351\251\254\346\227\255\344\270\234/2024.05.07-STP\345\222\214\344\272\244\346\215\242\346\234\272\347\232\204\347\253\257\345\217\243\350\201\232\345\220\210\350\256\276\347\275\256.md" diff --git "a/01\351\251\254\346\227\255\344\270\234/2024.05.07-STP\345\222\214\344\272\244\346\215\242\346\234\272\347\232\204\347\253\257\345\217\243\350\201\232\345\220\210\350\256\276\347\275\256.md" "b/01\351\251\254\346\227\255\344\270\234/2024.05.07-STP\345\222\214\344\272\244\346\215\242\346\234\272\347\232\204\347\253\257\345\217\243\350\201\232\345\220\210\350\256\276\347\275\256.md" new file mode 100644 index 0000000..d666aaa --- /dev/null +++ "b/01\351\251\254\346\227\255\344\270\234/2024.05.07-STP\345\222\214\344\272\244\346\215\242\346\234\272\347\232\204\347\253\257\345\217\243\350\201\232\345\220\210\350\256\276\347\275\256.md" @@ -0,0 +1,65 @@ +# STP和交换机的端口聚合设置 + +```html +STP:生成树协议(spanning Tree Protocol) +交换机,默认有生成协议STP在工作,收敛时间50s,太慢快速生成树协议,收敛时间1s +生成树协议作用:防止冗余链路形成环路 +switch#show spanning-tree summary //以汇总形式查看 +``` + +```html +端口/链路聚合,是指把交换机上多个物理端口捆绑合成一个逻辑端口,这样在交换机之间形成一条拥有较大宽带的链路,还可以实现负载均衡,并提供冗余链路。 +1.提高链路宽带 +2.支持负载均衡 +3.提供链路备份 +4.防止网络环路 +``` + +```html +交换机的STP + +Switch>en +Switch#show spanning-tree //査看交换机生成树运行状态 +Switch#show spanning-tree summary //査看生成树的配置信息 +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 range f0/3-4 +Switch(config-if)#switch mode trunk +Switch(config-if)#exit +Switch(config)#spanning-tree mode rapid-pvst //指定生成树协议的类型为RSTP +Switch(config)#end +Switch#show spanning-tree //判断根交换机、端口角色、端口状态等 + +PC0(命令提示符CMD下)ping 192.168.1.4 //链路通 +Switch0Switch>en +Switch#conf t +Switch(config)#inter f0/3 //关闭主链路上的端口 +Switch(config-if)#shutdown +PC0(命令提示符CMD下) +ping 192.168.1.4 //链路通 +//备份链路标记由×变为绿色,表明备份链路已启用 +``` + +```html +交换机的端口聚合 + +Switch>en +Switch#conf t +Switch(config)#inter range f0/3-4 +Switch(config-if-range)#switch mode trunk //将端口配置为Trunk模式 +Switch(config-if-range)#channel-group 1 mode on //加入链路组1并开启 +Switch(config-if-range)#ex +Switch(config)#port-channel load-balance dst-ip //按目的IP地址来实现负载均衡 +Switch(config)#ex +Switch#show etherchannel summary //显示以太通道信息 +Switch#show interfaces etherchannel //显示聚合端口信息 + +ping 192.168.1.3 //链路通 +ping 192.168.1.4 //链路通 +``` + -- Gitee