diff --git "a/\351\231\210\347\247\221\345\220\211/20240418\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" "b/\351\231\210\347\247\221\345\220\211/20240418\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..ff92e40eea2dc595ce2b23485921620bcd87558d --- /dev/null +++ "b/\351\231\210\347\247\221\345\220\211/20240418\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.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/\351\231\210\347\247\221\345\220\211/20240419\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" "b/\351\231\210\347\247\221\345\220\211/20240419\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..90515e954c65150e5b2e521af3780ba22ac4691c --- /dev/null +++ "b/\351\231\210\347\247\221\345\220\211/20240419\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.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/\351\231\210\347\247\221\345\220\211/20240421\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" "b/\351\231\210\347\247\221\345\220\211/20240421\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..2271560b141f7966ecef566f6a1f5fbc65d00e0a --- /dev/null +++ "b/\351\231\210\347\247\221\345\220\211/20240421\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" @@ -0,0 +1,45 @@ +# 三层交换机的基本配置 + +## 实验步骤: + +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/\351\231\210\347\247\221\345\220\211/20240422\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" "b/\351\231\210\347\247\221\345\220\211/20240422\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..e95d0468839f94a3db44ec99847a87474bd423a6 --- /dev/null +++ "b/\351\231\210\347\247\221\345\220\211/20240422\350\256\241\347\256\227\346\234\272\347\254\224\350\256\260.md" @@ -0,0 +1,125 @@ +## 交换机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