网络基础应用

一、交换机 (switch)

1交换机作用
用于将多台计算机、交换机连接到一起,组件网络
交换机电脑组建局域网(组建局域网的主要设备)
2、交换机组建局域网
在这里插入图片描述ping 目标主机(测试网络连通性)
ipconfig /all查看本机IP地址信息
交换机是组建局域网的主要设备
相同网段的设备之间可以直接通信
Ping 目标主机IP(测试网络连通性)
PC1 Ping PC2
3、配置视图
使用console线一端连接交换机console口。另一端连接计算机USB或com、putty、SecureCRT、Xshell等终端程序进入设备的配置界面。

1)认识设备的配置视图
用户视图(查看运行状态)
system-view
[Huawei]系统视图(配置设备的系统参数)
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]接口视图
2)退回视图
quit退回到上一个视图(逐级退回)
3)Return或者快捷键ctrl+z直接退到用户视图
4)操作技巧
技巧1:按?可以获取到帮助信息
直接在视图上敲?(在该视图上能够执行的所有命令)
问命令的全拼(例:s?)
问命令后面能跟哪些命令(例:interface ?)
技巧2:按Tab键自动补全
技巧3:命令的简写
技巧4:命令不区分大小写
5、交换机的基本配置命令
1)display version 查看版本信息 版本 型号 已开机时间
2)display current-configuration查看当前有效配置
3)display this查看当前视图的有效配置
4) sysname更改设备名
system-view
[Huawei]sysname SW1 修改设备名为SW1
5)save 保存配置
save
The current configuration will be written to the device.
当前配置将要被写入到设备中
Are you sure to continue?[Y/N]Y你确定要继续吗?
……
Save the configuration successfully.配置保存成功
6)reboot重启设备
7)shutdown //关闭接口、undo shutdown //开启接口

基本配置命令
1、设置终端密码(console口令、本地访问口令)
[SW1]user-interface console 0 //进入终端进行配置
[SW1-ui-console0]authentication-mode password //启用密码认证
[SW1-ui-console0]set authentication password cipher 123456 //设置终端密码为123456(密文)
想要验证密码,在用户视图中直接敲入quit退出,再按回车键提示输入密码
[SW1-ui-console0]set authentication password simple 123 //设置终端密码为123 (明文)
[SW1-ui-console0]undo set authentication password 取消密码

2、设置交换机闲置会话时间
[SW1]user-interface console 0 //进终端配置
[SW1-ui-console0] idle-timeout 1 //设置闲置会话时间为1分钟
注:[SW1-ui-console0] idle-timeout 0 //永不超时
华为交换机默认闲置时间是10分钟
3、undo terminal monitor //取消终端提示 (u t m )
4、恢复出厂设置
reset saved-configuration //恢复出厂设置
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:y //是否恢复出厂 设置

reboot //重启终端
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the configuration file for the n
ext startup:, Continue?[Y/N]:n //提示是否保存当前配置,选择N

Info: If want to reboot with saving diagnostic information, input ‘N’ and then e
xecute ‘reboot save diagnostic-information’.
System will reboot! Continue?[Y/N]:y //提示是否重启,选择Y

5、辟邪剑谱
u t m关闭日志提示
dis ver显示版本
dis cu查看当前配置信息
sy进入系统视图
[Huawei]sy S1更改设备名为S1
[S1]int g0/0/1进入接口
[S1-GigabitEthernet0/0/1]sh禁用接口
[S1-GigabitEthernet0/0/1]undo sh启用接口
Ctrl+z返回用户视图
sy
[S1]user-in co 0进入console口
[S1-ui-console0]auth p启用密码认证
[S1-ui-console0]set a p c 123设置密码
[S1-ui-console0]ret返回到用户视图
sa保存
q
Please Press ENTER.
Login authentication
Password:输入123
sy
[S1]user-in co 0进入console口
[S1-ui-console0]i 1440设置超时时间24小时
res sa
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:y确认恢复
reboot
ext startup:, Continue?[Y/N]:n不保存
System will reboot! Continue?[Y/N]:y重启

二、远程控制交换机

在这里插入图片描述

1、更改设备名
1)更改SW1设备名为SW1 sysname SW1
2)更改SW2设备名为PC sysname PC
2配置管理IP
1)配置SW1管理IP
[SW1]interface vlanif 1 进入虚拟接口
[SW1-Vlanif1]ip address 192.168.1.100 255.255.255.0 配置IP地址
2)配置SW2(PC)管理IP
[PC]interface vlanif 1
[PC-Vlanif1]ip address 192.168.1.1 255.255.255.0
3、测试网络连通性
PC ping 192.168.1.100
4、被控端开启远程管理服务
[SW1]user-interface vty 0 3 配置允许4个用户会话远程访问
[SW1-ui-vty0-4]authentication-mode password 启用密码认证
[SW1-ui-vty0-4]set authentication password cipher 123 设置密文密码
[SW1-ui-vty0-4]user privilege level 3 设置权限级别,默认为权限0参观级,3为管路员级
5、PC机telnet发起远程管理
telnet 192.168.1.100
Login authentication password:输入123

注:telnet 远程管理协议,端口号23

三、路由概述

1、路由:数据从一个网络到另外一个网络之间转发数据包的过程称为路由
2、路由器:连接不同网络,实现不同网段之间的通信
3、路由表:路由器选择数据传输路径的依据
4、路由器的工作原理
路由器接受数据包
检查数据包中的目标IP
在路由表查找与目标IP相匹配的路由条目,按照此条目所指的方向将数据转发出去
四、配置直连路由通信
在这里插入图片描述

配置思路:
1、给PC1、PC2配置IP地址、子网掩码、网关地址
2、给路由器接口配置IP地址
1)配置PC1设备的网关地址:
[huawei]interface GigabitEthernet 0/0/0 //进入接口视图
[huawei-GigabitEthernet0/0/0]ip address 192.168.10.2 24
2)配置PC2设备的网关地址:
[huawei]interface GigabitEthernet0/0/1 //进入接口视图
[huawei-GigabitEthernet0/0/1]ip address 192.168.20.2 24
3)确认IP地址是否配置成功
[huawei-GigabitEthernet0/0/0]display this
[huawei-GigabitEthernet0/0/1]display this
diaplay ip interface brief //查看接口IP地址简短信息
3、验证结果:测试PC1和PC2的网络连通性
在PC1上进行操作:ping 192.168.20.1
在PC2上进行操作:ping 192.168.10.1
4、查看路由表
根据以上的拓扑图,可以查看路由器的路由表
display ip routing-table
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值