两层交换机上划分VLAN借三层交换机路由功能实现跨网段访问(Cisco Packer Tracer 模拟器)

【简单拓扑图】:

两层交换机上划分VLAN借三层交换机路由功能实现跨网段访问(Cisco Packer Tracer 模拟器)_第1张图片

【注释】

这里 划分了 两个vlan 3 和 4     vlan3 分布在交换机1 和 2 中

 

【注意】

ip 与网关的  网段保持一致!!!!不要忘记设置主机网关  以及端口与命令保持一致!!!


【命令】:

交换机1:  配置 VALN 3


Switch#en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int fa0/1   // fa0/1 与fa0/2 端口接在 vlan3 上
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#int fa0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 3
Switch(config)#int fa0/24  // fa0/4路线设置成trunk模式
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport mode trunk 
Switch(config-if)#
%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)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console


交换机2:  含两个vlan  3 和 4

Switch#en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 3
Switch(config-vlan)#vlan 4
Switch(config-vlan)#exit
Switch(config)#int fa0/1    // fa0/1 与fa0/2 端口接在 vlan4 上
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 4
Switch(config-if)#exit
Switch(config)#int fa0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 4 
Switch(config)#int fa0/3  // fa0/3 端口接在 vlan3 上
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#int fa0/24  // fa0/4路线设置成trunk模式
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport mode trunk
Switch(config)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console


三层交换机: 配置vlan 3和 4 并设置网关设置为routing模式


 

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 3      // 创造 VLAN 3 和 4 
Switch(config-vlan)#vlan 4
Switch(config-vlan)#exit
Switch(config)#int vlan 3   // VLAN 3 设置网关地址
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#ip address 192.168.3.69 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int vlan 4    // VLAN 4设置网关地址
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan4, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan4, changed state to up
Switch(config-if)#ip address 192.168.4.69 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#int fa0/1    //fa0/1 和fa0/2 设置为trunk 模式
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport mode trunk 
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#exit
Switch(config)#int fa0/2   //fa0/1 和fa0/2 设置为trunk 模式
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport mode trunk 
Switch(config-if)#    
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
Switch(config-if)#ip routing      // 开启 路由功能!!!!!!!!!!!!! very important!!
Switch(config)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console

 

你可能感兴趣的:(组网技术)