diff --git "a/12 \350\251\271\345\256\207\350\210\252/20250411-\350\267\257\347\224\261\345\231\250\345\237\272\346\234\254\351\205\215\347\275\256\345\222\214\345\215\225\350\207\202\350\267\257\347\224\261.md" "b/12 \350\251\271\345\256\207\350\210\252/20250411-\350\267\257\347\224\261\345\231\250\345\237\272\346\234\254\351\205\215\347\275\256\345\222\214\345\215\225\350\207\202\350\267\257\347\224\261.md" new file mode 100644 index 0000000000000000000000000000000000000000..1e6d4720a535b502c9d2d3fd58fa0ada6c2e1a75 --- /dev/null +++ "b/12 \350\251\271\345\256\207\350\210\252/20250411-\350\267\257\347\224\261\345\231\250\345\237\272\346\234\254\351\205\215\347\275\256\345\222\214\345\215\225\350\207\202\350\267\257\347\224\261.md" @@ -0,0 +1,242 @@ +## 路由器基本配置(Telnet) + +### 步骤 + +- 按下图配置路线 + +![20240424233234](https://oss.9ihub.com/test/20240424233234.png) + +- 开启Telnet连接 + + ```cmd + Router>enable + Router#conf t + Router(config)#inter g0/0 //路由器的端口号默认从0开始,网卡类型可能是G口 + Router(config-if)#ip address 192.168.10.254 255.255.255.0 //配置路由器的端口IP + Router(config-if)#no shutdown //开启端口 + Router(config-if)#exit + Router(config)#line vty 0 4 //进入编号为0~4的vty线路配置模式 + Router(config-line)#password 123 //设置密码为123 + Router(config-line)#exit + Router(config)#service password-encryption //启用全局密码加密功能 + Router(config)#enable secret 456 //设置特权模式的密码 + Router#show r + ``` + +### 验证是否可以远程连接 + +```cmd +ping 192.168.10.1 # ping通自身 +ping 192.168.10.254 # ping通网关 +telnet 192.168.10.254 # 远程登录 +password: 123 #输入telnet vty的密码 +Router>enable +password: 123 #输入 特权模式 密 +``` + +## 路由器基本配置(SSH) + +### 步骤(Telnet远程访问是一种不安全的方式,换成SSH是一种不错的选择) + +- 按下图配置路线 + +![image-20250410103622132](https://gitee.com/onesheet/images_backup/raw/master/img/upgit_20250410_1744252582.png) + +- 配置设备名称 + + ```cmd + Router(config)#hostname RT100 + ``` + +- 配置设备域名 + + ```cmd + RT100(config)#ip domain-name qq.com + ``` + +- 生成密钥对 + + ```cmd + RT100(config)#crypto key generate rsa + The name for the keys will be: RT100.qq.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 #选择密钥位数(默认512位) + % Generating 2048 bit RSA keys, keys will be non-exportable...[OK] + ``` + +- 启用SSH版本,并设置本地用户登录,同时设置本地用户和密码 + + ```cmd + RT100(config)#username admin secret 789 // 设置 用户名admin \ 密码789 + RT100(config)#enable secret 110 // 设置 特权密码 110 + RT100(config)#ip ssh version 2 // 启用ssh版本,建议2这个版本,更加安全 + ``` + +- 选择端口,配置ip地址 + + - 如果是交换机,是配置其vlan的管理地址 + + + - 如果是路由器,则直接配置接口地址 + + ```cmd + RT100(config)#interface g0/0/0 // 选端口,注意分辨是F口还是G口 + RT100(config-if)#ip address 192.168.20.254 255.255.255.0 // 绑定IP + RT100(config-if)#no shutdown // 启用端口 + RT100(config-if)#exit // 返回上一级 + ``` + +- 为SSH开启VTY通道,并允许本地账户登录 + + ```cmd + RT100(config)#line vty 0 15 // 设置0~15的虚拟线路(其实就是所有的线路) + RT100(config-line)#transport input ssh // 用于指定SSH协议来访问终端 + RT100(config-line)#login local // 允许本地账户登录 + ``` + +- 设置特权模式的密码 + + ```cmd + Router(config)#enable secret 456 + ``` + +- 保存配置 + + ```cmd + RT100#write + ``` + +### 验证是否可以远程连接 + +```cmd +ssh -l admin 192.168.20.254 # 使用SSH连接路由器 +Password: # 输入admin的密码789 +RT100>en # 进入特权模式 +Password: # 输入特权模式的密码456 +RT100# +``` + +## 路由器基本配置(单臂路由) + +### 各部门网络配置 + +| 部门 | 网络 | 网关 | +| ------ | --------------- | -------------- | +| 市场部 | 192.168.50.0/24 | 192.168.50.254 | +| 财务部 | 192.168.60.0/24 | 192.168.60.254 | +| 研发部 | 192.168.70.0/24 | 192.168.70.254 | + +### 步骤 + +- 按下图配置路线 + +![image-20250411160736329](https://gitee.com/zhan-yu-hang/picture/raw/master/image/2025041101.png) + +- 汇编交换机的配置步骤 + + ```cmd + Switch(config)# vlan 10 //分别创建VLAN 10、20、30 + Switch(config-vlan)# exit + Switch(config)# vlan 20 + Switch(config-vlan)# exit + Switch(config)# vlan 30 + Switch(config-vlan)# exit + Switch(config)# interface f0/1 //分别将端口f0/1-3加入到VLAN 10-30 中 + Switch(config-if)# switchport mode access vlan 10 + Switch(config-if)# exit + Switch(config)# interface f0/2 + Switch(config-if)# switchport mode access vlan 20 + Switch(config-if)# exit + Switch(config)# interface f0/3 + Switch(config-if)# switchport mode access vlan 30 + Switch(config-if)# exit + Switch(config)# interface f0/24 //选择与路由器相连的端口f0/24 + Switch(config-if)# switchport mode trunk //开启trunk模式 + Switch(config-if)# exit + Switch(config)# end + Switch# write + ``` + +- 路由启配置 + + ```cmd + Router(config)# interface g0/0/0 + Router(config-if)# no shutdown + Router(config-if)# exit + Router(config)# interface g0/0/0.1 //创建子接口(对应VLAN 10) + Router(config-subif)# encapsulation dot1Q 10 //封装VLAN 10协议 + Router(config-subif)# ip address 192.168.50.254 255.255.255.0 //网关IP + Router(config-subif)# exit + Router(config)# interface g0/0/0.2 //创建子接口(对应VLAN 10) + Router(config-subif)# encapsulation dot1Q 20 //封装VLAN 10协议 + Router(config-subif)# ip address 192.168.60.254 255.255.255.0 //网关IP + Router(config-subif)# exit + Router(config)# interface g0/0/0.3 //创建子接口(对应VLAN 10) + Router(config-subif)# encapsulation dot1Q 30 //封装VLAN 10协议 + Router(config-subif)# ip address 192.168.70.254 255.255.255.0 //网关IP + Router(config-subif)# exit + Router(config)# end + Router# write + ``` + +### 验证是否连接 + +- 选择财务部电脑 + + ``` cmd + ping 192.168.50.1 # ping通自身 + ping 192.168.50.254 # ping通网关 + ping 192.168.60.254 # 跨网连接 + ``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +