网络作业之思科配置交换机
怎样创建
进入之后,先拖出来一个交换机,可以顺手拖两个主机

连上线之后双击就可以了


输入一下代码
Switch> enable
Switch# configure terminal
Switch(config)# enable password <使能普通密码>
Switch(config)# enable secret <使能加密密码>
Switch(config)# line console 0
Switch(config-line)# password <登录密码>
Switch(config-line)# login
Switch(config-line)# exit
Switch(config)# line vty 0 15
Switch(config-line)# password <远程密码>
Switch(config-line)# login
Switch(config-line)# transport input ssh
Switch(config-line)# exit
Switch(config)# service password-encryption
Switch(config)# end
Switch# copy run start
如图所示

之后,就是第二部分,开始部署局域网!
以下是搭建 192.168.86.0 局域网的详细步骤,涵盖网络规划、设备配置和安全设置:
二、配置交换机
1. 基本设置(VLAN 1 默认局域网)
Switch> enable
Switch# configure terminal
Switch(config)# interface vlan 1 # 配置管理VLAN
Switch(config-if)# ip address 192.168.86.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# ip default-gateway 192.168.86.1 # 设置默认网关(指向路由器)
三、配置终端设备
2. 手动设置IP(静态地址)
- IP地址:
192.168.86.x(如192.168.86.10) - 子网掩码:
255.255.255.0 - 默认网关:
192.168.86.1 - DNS服务器:
8.8.8.8(或本地DNS)
Switch> enable
Swirch# show ip interface brief #这个可以显示所有的接口
Switch# configure terminal
Switch(config)# interface range <这里是你的交换机的名字>/10086-114514 # 选择你要配置的端口
Switch(config-if-range)# switchport mode access # 设置为接入模式
Switch(config-if-range)# no shutdown
设置后记得把终端的ip设置一下

ping通了

以下是完全的搭建 **192.168.86.0** 局域网的详细步骤,涵盖网络规划、设备配置和安全设置:
---
### **一、网络规划**
#### 1. **IP地址分配**
- **网络地址**:`192.168.86.0/24`(子网掩码 `255.255.255.0`)
- **可用主机范围**:`192.168.86.1` ~ `192.168.86.254`
- **默认网关**:建议分配为 `192.168.86.1`(通常为路由器接口IP)
- **DHCP 地址池**:`192.168.86.100` ~ `192.168.86.200`(自动分配)
#### 2. **网络拓扑**
- **设备清单**:
- 路由器(用于连接外网或作为网关)
- 交换机(连接终端设备)
- 终端设备(PC、服务器等)
---
### **二、配置路由器(网关)**
#### 1. **设置接口IP(作为网关)**
```bash
Router> enable
Router# configure terminal
Router(config)# interface GigabitEthernet0/0 # 连接局域网的接口
Router(config-if)# ip address 192.168.86.1 255.255.255.0
Router(config-if)# no shutdown # 启用接口
Router(config-if)# exit
2. 配置DHCP服务(可选)
Router(config)# ip dhcp pool LAN_POOL # 创建DHCP地址池
Router(dhcp-config)# network 192.168.86.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.86.1
Router(dhcp-config)# dns-server 8.8.8.8 # 设置DNS服务器
Router(dhcp-config)# exit
Router(config)# ip dhcp excluded-address 192.168.86.1 192.168.86.99 # 排除静态IP段
三、配置交换机
1. 基本设置(VLAN 1 默认局域网)
Switch> enable
Switch# configure terminal
Switch(config)# interface vlan 1 # 配置管理VLAN
Switch(config-if)# ip address 192.168.86.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# ip default-gateway 192.168.86.1 # 设置默认网关(指向路由器)
2. 配置端口(连接设备)
Switch(config)# interface range GigabitEthernet0/1-24 # 批量配置端口
Switch(config-if-range)# switchport mode access # 设置为接入模式
Switch(config-if-range)# no shutdown
四、配置终端设备
1. 自动获取IP(DHCP)
- 确保终端设备网络设置选择 自动获取IP 和 自动获取DNS。
2. 手动设置IP(静态地址)
- IP地址:
192.168.86.x(如192.168.86.10) - 子网掩码:
255.255.255.0 - 默认网关:
192.168.86.1 - DNS服务器:
8.8.8.8(或本地DNS)
五、安全配置
1. 路由器/交换机密码
Router(config)# enable secret Admin@123 # 加密特权密码
Router(config)# line console 0
Router(config-line)# password Console@123
Router(config-line)# login
Router(config)# line vty 0 4
Router(config-line)# password Remote@123
Router(config-line)# login
2. 禁用Telnet,启用SSH(推荐)
Router(config)# hostname R1
Router(config)# ip domain-name example.com
Router(config)# crypto key generate rsa # 生成RSA密钥(至少2048位)
Router(config)# line vty 0 4
Router(config-line)# transport input ssh # 仅允许SSH
六、测试连通性
-
检查IP分配:
PC> ipconfig # 查看终端IP是否在DHCP范围内或静态配置正确 -
测试网关连通性:
PC> ping 192.168.86.1 # 测试与路由器的通信 -
跨设备通信:
PC> ping 192.168.86.10 # 测试与其他终端的连通性
七、扩展功能(可选)
- VLAN划分:若需隔离不同部门,可在交换机上配置VLAN。
Switch(config)# vlan 10 Switch(config-vlan)# name Sales Switch(config)# interface GigabitEthernet0/1 Switch(config-if)# switchport access vlan 10 - 防火墙规则:在路由器上配置ACL限制流量。
- 互联网访问:配置NAT将局域网IP转换为公网IP(需外网接口)。
</details>

浙公网安备 33010602011771号