实验拓扑图 二层交换机设置模式,三层交换,静态路由,和单臂路由笔记给每台pc设置设置ip和网关
LSW2二层交换机和pc之间的接口设置access模式和trunk模式
<Huawei>undo terminal monitor //用户视图设置禁消息弹出
Info: Current terminal monitor is off.
<Huawei>system-view //进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname sw2 //修改名字
[sw2]vlan batch 10 20 //创建多个vlan
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]int e0/0/2 //进入sw2-Ethernet0/0/2这个接口
[sw2-Ethernet0/0/2]port link-type access //设置端口模式为access
[sw2-Ethernet0/0/2]port default vlan 10 //把端口加入vlan10
进入sw2-Ethernet0/0/3口
[sw2-Ethernet0/0/2]int e0/0/3 //进入sw2-Ethernet0/0/3这个接
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 20
进入sw2-Ethernet0/0/1口
[sw2-Ethernet0/0/3]int e0/0/1 //进入sw2-Ethernet0/0/1这个接口
[sw2-Ethernet0/0/1]port link-type trunk //设置端口为trunk模式
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all //允许所有vlan的数据帧通过
//交换机和交换机之间设置trunk模式
//交换机与不同设备设置access模式
交换机的LW2,LSW3,LSW4,LSW5,LSW6设自模式都是一样的添加不同的vlan。
sw3-Ethernet0/0/1口和sw3-Ethernet0/0/2口设自access模式
sw3-Ethernet0/0/3口设自trunk模式
LW3命令
[sw3]vlan batch 30 40
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type access
[sw3-Ethernet0/0/1]port default vlan 30
[sw3-Ethernet0/0/1]int e0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 40
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type trunk
[sw3-Ethernet0/0/3]port trunk allow-pass vlan all
交换机4
[Huawei]sys sw4
[sw4]vlan batch 50 60
[sw4]int e0/0/1
[sw4-Ethernet0/0/1]port link-type access
[sw4-Ethernet0/0/1]port default vlan 50
[sw4-Ethernet0/0/1]int e0/0/2
[sw4-Ethernet0/0/2]port link-type access
[sw4-Ethernet0/0/2]port default vlan 60
[sw4-Ethernet0/0/2]int e0/0/3
[sw4-Ethernet0/0/3]port link-type trunk
[sw4-Ethernet0/0/3]port trunk allow-pass vlan all
sw5
sys sw5
[sw5]vlan ba
[sw5]vlan batch 70 80
[sw5]int e0/0/2
[sw5-Ethernet0/0/2]port link-type access
[sw5-Ethernet0/0/2]port default vlan 70
[sw5-Ethernet0/0/2]int e0/0/1
[sw5]int e0/0/1
[sw5-Ethernet0/0/1]port link-type trunk
[sw5-Ethernet0/0/1]port trunk allow-pass vlan all
单臂路由是个特例交换机和路由之间需要trunk模式
sw6
sw6
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw6
[sw6]vlan 80
[sw6-vlan80]int e0/0/2
[sw6-Ethernet0/0/2]port link-type access
[sw6-Ethernet0/0/2]port default vlan 80
[sw6-Ethernet0/0/2]int e0/0/1
[sw6-Ethernet0/0/1]port link-type trunk
[sw6-Ethernet0/0/1]port trunk allow-pass vlan 80
三层交换机5700个个接口设置模式
[RSW1]vlan batch 4 10 20 30 40 50 60 // 创建多个vlan
[RSW1]port-group 1 //创建组
[RSW1-port-group-1]group-member g0/0/1 to g0/0/3 //将添加的接口放进组
[RSW1-port-group-1]port link-type trunk //给这个组的接口设置模式
[RSW1-port-group-1]port trunk allow-pass vlan all//允许所有vlan通过
将所有的vlan设置网关
int vlanif 10
[RSW1-Vlanif10]ip add
[RSW1-Vlanif10]ip address 192.168.10.1 24
[RSW1-Vlanif10]int vlanif 20
[RSW1-Vlanif20]ip address 192.168.20.1 24
[RSW1-Vlanif20]int vlanif 30
[RSW1-Vlanif30]ip address 192.168.30.1 24
[RSW1-Vlanif30]int vlanif 40
[RSW1-Vlanif40]ip address 192.168.40.1 24
[RSW1-Vlanif40]int vlanif 50
[RSW1-Vlanif50]ip address 192.168.50.1 24
[RSW1-Vlanif50]int vlanif 60
[RSW1-Vlanif60]ip address 192.168.60.1 24
[RSW1-Vlanif80]int vlanif 4
[RSW1-Vlanif4]ip address 192.168.1.1 24
三层交换机接口4要设置模式access
int g0/0/4
[RSW1-GigabitEthernet0/0/4]port link-type access
[RSW1-GigabitEthernet0/0/4]port default vlan 4
AR1路由器3个接口设置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.90.1 24
[Huawei-GigabitEthernet0/0/1]int g2/0/0
[Huawei-GigabitEthernet2/0/0]ip address 192.168.3.2 24
单臂
[Huawei]int g0/0/0.1 //进入单臂路由子接口
[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 70 // 添加vlan的名字
[Huawei-GigabitEthernet0/0/0.1]ip address 192.168.70.1 24 //添加IP地址
[Huawei-GigabitEthernet0/0/0.1]arp broadcast enable //命令用来使能终结子接口的ARP广播功能
[Huawei-GigabitEthernet0/0/0.1]int g0/0/0.2 //进入单臂路由子接口
[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 80// 添加vlan的名字
[Huawei-GigabitEthernet0/0/0.2]ip address 192.168.80.1 24 ////添加IP地址
[Huawei-GigabitEthernet0/0/0.2]arp broadcast enable
//
命令用来使能终结子接口的ARP广播功能
来源:CSDN
作者:时佃鹏
链接:https://blog.csdn.net/qq_40201534/article/details/104425466