交换机

1.交换机工作原理: MAC地址(物理地址/硬件地址)
学习(源MAC地址), 广播(除了数据来源的接口), 转发, 更新(超过300秒)
[Huawei]display mac-address //查看mac地址表

2.交换机的命令行
1)用户视图
标志:
作用:查看设备配置
2)系统视图
标志:[huawei]
命令:system-view
作用:对设备进行一些基本的配置(修改设备的基本配置)
sysname #修改设备名称
ctrl+z #返回用户视图
quit #返回上一视图
display current-configuration #查看设备当前配置
ctrl+w #删除一个单词
ctrl+u #删除一行
3)接口视图
标志:[huawei-ethernet0/0/1]
命令:interface Ethernet0/0/1
作用:对设备接口进行配置
undo negotiation auto
speed 10 #修改接口速率为10M
diaplay this #查看当前模式下的配置
diaplay interface Ethernet 0/0/1 #查看接口详细的信息
shutdown #关闭接口
undo shutdown #取消关闭接口(开启接口)
4)协议视图 ospf

system-view //进入系统视图
[Huawei]interface Ethernet0/0/1 //进入接口视图
[Huawei-Ethernet0/0/1]quit //返回上一视图
[Huawei-Ethernet0/0/1]return //返回用户视图

[Huawei]sysname SW1 //修改主机名
[Huawei]display version //查看系统版本与硬件型号
[Huawei]display current-configuration //查看当前配置

3.创建用户
[huawei]aaa //进入3a认证
[huawei-aaa]local-user 用户名 password cipher/simple 密码 //创建用户并选择加密方式:cipher加密/simple不加密
[huawei-aaa]quit //返回上一视图
[Huawei]user-interface console 0 //进入用户控制台
[Huawei-ui-console0]authentication-mode aaa //激活配置

save //保存
reboot //重启

5.交换机设置本地密码
user-interface console 0 #进入console模式
authentication-mode password #设置认证模式为密码模式
set authentication password simple *** #设置设备密码为***,简单模式
set authentication password cipher *** #设置设备密码为***,加密模式

6.VLAN
Virtual LAN(虚拟局域网) 是物理设备上连接的不受物理位置限制的用户的一个逻辑组
使用VLAN的原因: 交换机的所有接口属于同一个广播域,随着接入设备的增多,降低了网络的效率,为了分割广播域,引入了VLAN
VLAN作用: 1广播控制 2增加安全 3提高带宽利用 4降低延迟
1)LAN配置
vlan 2 //创建vlan2
in e0/0/3 //进入接口
port link-type access //将3口设置为接入链路(即将为某个vlan服务)
port default vlan 2 //加入vlan2(此接口为vlan2服务)
display vlan //检查结果
2)接口组,可以将多个接口加入到接口组,然后对组的配置都会应用到该组的接口中
port-group 1 //创建1号接口组
group-member e 0/0/3 e 0/0/4 //加接口
port link-type access //此设置会应用到组中所有接口
port default vlan 2 //此设置会应用到组中所有接口
dis this //查看当前视图的配置
// access: 接入链路 为1个vlan服务
trunk: 中继链路 为多个vlan服务
3)配置trunk中继链路:
[Huawei]interface Ethernet0/0/7
[Huawei-Ethernet0/0/7]port default vlan 1
[Huawei-Ethernet0/0/7]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
4)链路聚合 : Eth-trunk
[Huawei]clear configuration interface Ethernet0/0/7 //清空7口所有配置(配置trunk或者链路聚合时,接口必须恢复默认配置)
in e0/0/7 //进入7口
undo shutdown //开启(接口配置被清空后会自动关闭)
[Huawei]interface Eth-trunk 1 //创建虚拟接口(同时进入该接口)
[Huawei- Eth-trunk1]trunkport ethernet 0/0/7 0/0/8 //把7口与8口捆绑
dis cur //找到7口和8口,查询捆绑情况
port link-type trunk //将虚拟接口配置成中继链路
port trunk allow-pass vlan all //放行所有vlan

7.三层交换机
三层交换机=二层交换+三层转发
路由器配置ip在物理接口
三层交换机在虚拟接口配置ip 路由器在物理接口配置ip
in vlan 1 //进入vlan1的虚拟接口
ip add 192.168.1.254 24 //配置ip作为所有vlan1设备的网关
三层交换机使用思路
1)规划vlan
2)为所在vlan的设备配置网关ip
3)必要时使用trunk合理利用接口
三层交换机接口配置ip思路:
1)创建新vlan
2)为此vlan配置ip
3)将接口加入此vlan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值