兩層交換機上劃分VLAN借三層交換機路由功能實現跨網段訪問(Cisco Packer Tracer 模擬器)


忙活了一下午 , 終於成功了  不容易啊!  測試

 仍是 發一下 博文吧,  大笑this


【簡單拓撲圖】:spa




【註釋】blog

這裏 劃分了 兩個vlan 3 和 4     vlan3 分佈在交換機1 和 2 中ip

  

【注意】路由

ip 網關的  網段保持一致!!!!不要忘記設置主機網關  以及端口與命令保持一致!!!  this very important!!terminal


【命令】:get

交換機1:  配置 VALN 3it

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 和 4io

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



【測試】

PC –1  ping -----------à  others

ping  192.168.3.2 同一換機 同一vlan 



ping   


ping 192.168.4.3  不一樣交換機 不一樣vlan   



ping   第一次 存在丟包緣由:ping第一個數據是ARP廣播包,創建MAC地址IP地址對應表,由於一開始是不知道對方的MAC地址因此丟包
第二次就能夠100%成功


ping 192.168.3.5  不一樣交換機 同一vlan 




一樣 ping 一樣  第一次存在丟包  第二次 100%成功



【完工 】


///////////////////////////////////////////////華麗分割線///////////////////////////////////////////////////////////////////////

                    各位客官老爺 若在實現過程當中 出現問題,歡迎指正錯誤。

By sizaif     version: 1.01   

///////////////////////////////////////////////華麗分割線///////////////////////////////////////////////////////////////////////

相關文章
相關標籤/搜索