第一步 给 PC 配 ip
分别是:左上192.168.1.1 左下 : 192.168.1.2 右上 : 192.168.1.3 右下 : 192.168.1.4
第二步 划分 vlan
进入左侧 交换机 1
Switch>
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2 //创建 vlan 2
Switch(config-vlan)#e
Switch(config)#vlan 3 //创建 vlan 2
Switch(config-vlan)#e
Switch(config)#
// vlan 划分完成 下一步 划分vlan 绑定给 端口
Switch(config)#interface fastEthernet 0/1 //进入端口 1
Switch(config-if)#sw mo ac //设置端口模式为 access
Switch(config-if)#sw ac vlan 2 //ac模式划分到vlan 2
Switch(config-if)#exit //退出 重复
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#sw mo ac
Switch(config-if)#sw ac vlan 3
Switch(config-if)#e
Switch(config)#
进入右侧 交换机 2
Switch>
Switch>en
Switch#
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#e
Switch(config)#vlan 3
Switch(config-vlan)#e
Switch(config)#interface f0/1
Switch(config-if)#sw mo ac
Switch(config-if)#sw ac vlan 2
Switch(config-if)#e
Switch(config)#interface f0/2
Switch(config-if)#sw mo ac
Switch(config-if)#sw ac vlan 3
Switch(config-if)#e
Switch(config)#
第三步 绑定22-24端口 创建链路
进入 交换机 1
Switch(config)#interface range fastEthernet 0/22-24 //进入端口22-24
Switch(config-if-range)#channel-group 1 mode on //创建链路 1
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if-range)#exit //退出操作
Switch(config)#interface port-channel 1 //进入链路 1
Switch(config-if)#sw mo trunk //设置链路模式为 trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#sw trunk all vlan 2,3 //将vlan 2,3绑定到链路 1
Switch(config-if)#exit //退出操作
Switch(config)#
进入 交换机 2 重复相同操作
Switch(config)#interface range fastEthernet 0/22-24 //进入端口22-24
Switch(config-if-range)#channel-group 1 mode on //创建链路 1
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1
%LINK-5-CHANGED: Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if-range)#exit //退出操作
Switch(config)#interface port-channel 1 //进入链路 1
Switch(config-if)#sw mo trunk //设置链路模式为 trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel 1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#sw trunk all vlan 2,3 //将vlan 2,3绑定到链路 1
Switch(config-if)#exit //退出操作
Switch(config)#
实验结束 ,接下来测试是否 通过
测试 标准 同 vlan 可ping通 不同vlan 不通
测试结果:PC 192.168.1.1 vlan 2 用于 ping vlan 3区域的1.2 ip 不通,ping 同vlan 2的1.3 ip 通过
感谢你的阅读和观看!
Views: 24