1.配置VLAN
要求简介:通过2条主干网络使得PC机之间两两通信,A-D,B-C,其中vlan2负责AD之间的通信,vlan3负责BC之间的通信。每个主干网络都由两条网线组成。
配置规划
PC A
IP: 192.168.1.2
Submark: 255.255.255.0
Gateway: 192.168.1.1
PC B
IP: 192.168.1.3
Submark: 255.255.255.0
Gateway: 192.168.1.1
PC C
IP: 192.168.1.4
Submark: 255.255.255.0
Gateway: 192.168.1.1
PC D
IP: 192.168.1.5
Submark: 255.255.255.0
Gateway: 192.168.1.1
代码:
A:
创建vlan2和vlan3
conf
vlan 2
exit
vlan 3
exit
端口加入vlan
interface range fa 0/1-5
switch access vlan 2
exit
interface range fa 0/6-10
switch access vlan 3
exit
创建聚合端口
interface aggregateport 1
switchport mode trunk
exit
interface aggregateport 2
switchport mode trunk
exit
加入聚合端口
interface range fa 0/21-22
port-group 1
interface range fa 0/23-24
port-group 2
去除聚合端口在不必要的vlan上
interface aggregateport 1
switchport trunk allowed vlan remove 1
switchport trunk allowed vlan remove 3
exit
interface aggregateport 2
switchport trunk allowed vlan remove 1
switchport trunk allowed vlan remove 2
exit
B:
创建vlan2和vlan3
conf
vlan 2
exit
vlan 3
exit
端口加入vlan
interface range fa 0/1-5
switch access vlan 2
exit
interface range fa 0/6-10
switch access vlan 3
exit
创建聚合端口
interface aggregateport 1
switchport mode trunk
exit
interface aggregateport 2
switchport mode trunk
exit
加入聚合端口
interface range fa 0/21-22
port-group 1
interface range fa 0/23-24
port-group 2
去除聚合端口在不必要的vlan上
interface aggregateport 1
switchport trunk allowed vlan remove 1
switchport trunk allowed vlan remove 3
exit
interface aggregateport 2
switchport trunk allowed vlan remove 1
switchport trunk allowed vlan remove 2
exit
其他指令:
no vlan 1 删除vlan1
interface range fa 0/21-24
switchport mode access
exit 移除vlan中的端口
具体的安装:
PCA和PCD接在交换机的1-5或者6-10号口,必须在同一个范围内
PCB和PCC接在交换机的1-5或者6-10号口,必须在同一个范围内
交换机之间21-24端口对应连接
21-22口管理1-5号的网络连接
23-24口管理6-10号的网络连接
设备一共是4台电脑,2台交换机,每台交换机一共插上6个口。
结果:断掉一根网线不影响网络通信,断掉两根同属一个主干网络的(比如21和22同时断掉会使得1-5口的电脑无法通信)会影响所属电脑之间的通信。