三層交換機配置實例詳解
在校園網(wǎng)、城域教育網(wǎng)中,從骨干網(wǎng)、城域網(wǎng)骨干、匯聚層都有三層交換機的用武之地,尤其是核心骨干網(wǎng)一定要用三層交換機,否則整個網(wǎng)絡(luò)成千上萬臺的計算機都在一個子網(wǎng)中,不僅毫無安全可言,也會因為無法分割廣播域而無法隔離廣播風(fēng)暴。如果采用傳統(tǒng)的路由器,雖然可以隔離廣播,但是性能又得不到保障。而三層交換機的性能非常高,既有三層路由的功能,又具有二層交換的網(wǎng)絡(luò)速度。二層交換是基于MAC尋址,三層交換則是轉(zhuǎn)發(fā)基于第三層地址的業(yè)務(wù)流;除了必要的路由決定過程外,大部分數(shù)據(jù)轉(zhuǎn)發(fā)過程由二層交換處理,提高了數(shù)據(jù)包轉(zhuǎn)發(fā)的效率。三層交換機通過使用硬件交換機構(gòu)實現(xiàn)了IP的路由功能,其優(yōu)化的路由軟件使得路由過程效率提高,解決了傳統(tǒng)路由器軟件路由的速度問題。因此可以說,三層交換機具有“路由器的功能、交換機的性能”。
另外,連接子網(wǎng)少不了三層交換換。同一網(wǎng)絡(luò)上的計算機如果超過一定數(shù)量(通常在200臺左右,視通信協(xié)議而定),就很可能會因為網(wǎng)絡(luò)上大量的廣播而導(dǎo)致網(wǎng)絡(luò)傳輸效率低下。為了避免在大型交換機上進行廣播所引起的廣播風(fēng)暴,可將其進一步劃分為多個虛擬網(wǎng)(VLAN)。但是這樣做將導(dǎo)致一個問題:VLAN之間的通信必須通過路由器來實現(xiàn)。但是傳統(tǒng)路由器也難以勝任VLAN之間的通信任務(wù),因為相對于局域網(wǎng)的網(wǎng)絡(luò)流量來說,傳統(tǒng)的普通路由器的路由能力太弱。 而且千兆級路由器的價格也是非常難以接受的。如果使用三層交換機上的千兆端口或百兆端口連接不同的子網(wǎng)或VLAN,就在保持性能的前提下,經(jīng)濟地解決了子網(wǎng)劃分之后子網(wǎng)之間必須依賴路由器進行通信的問題,因此三層交換機是連接子網(wǎng)的理想設(shè)備。
三層交換機詳細配置實例
一:二層交換機的配置:
在三個二層交換機上分別劃出兩VLAN,并將二層交換機上與三層交換或路由器上的接線設(shè)置為trunk接口
二:三層交換機的配置:
1:首先在三層交換上劃出兩個VLAN,并進入VLAN為其配置IP,此IP將作為與他相連PC的網(wǎng)關(guān)。
2:將與二層交換機相連的線同樣設(shè)置為trunk接線,并將三層交換與路由器連接的線設(shè)置為路由接口(no switchsport)
3:將路由器和下面的交換機進行單臂路由的配置 實驗最終結(jié)果:拓撲圖下各個PC均能相互通信
交換機的配置命令:
SW 0:
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 Switch(config-vlan)#exit Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2 Switch(config-if)#no shut Switch(config-if)#int f0/3
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
Switch(config-if)#exit Switch(config)#
SW 1:
Switch》en Switch#conf
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2 % Access VLAN does not exist. Creating vlan 2 Switch(config-if)#no shut Switch(config-if)#exit Switch(config)#int f0/3
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
Switch(config-if)#
SW 2:
Switch》en
Switch#conf
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2 % Access VLAN does not exist. Creating vlan 2 Switch(config-if)#exit
Switch(config)#int f0/3
Switch(config-if)#switchport mode trunk Switch(config-if)#
三層交換的配置命令:
Switch》en Switch#conf
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#int f0/1
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
Switch(config-if)#exit Switch(config)#int f0/2
Switch(config-if)#switchport mode trunk Switch(config-if)#exit Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#int vlan 1 Switch(config-if)#no shut
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up Switch(config-if)#ip address 192.168.1.168 255.255.255.0 Switch(config-if)#exit Switch(config)#int vlan 2
%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upSwitch(config-if)#ip add
Switch(config-if)#ip address 192.168.2.168 255.255.255.0 Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
Switch(config-if)#exit Switch(config)#int f0/3
Switch(config-if)#no switchport
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to upSwitch(config-if)#
Switch(config-if)#ip address 192.168.10.1 255.255.255.0 Switch(config-if)#no shut Switch(config-if)#exit Switch(config)#ip routing Switch(config-if)#exit
Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.2 Switch(config)# 路由器的配置:
Router》en Router#conf
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int f0/0 Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up Router(config-if)#exit Router(config)#int f0/1 Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit Router(config)#int f0/0 Router(config-if)#no shut Router(config-if)#exit Router(config)#int f0/0.1
Router(config-subif)#encapsulation dot1Q 1
Router(config-subif)#ip address 192.168.3.168 255.255.255.0 Router(config-subif)#exit Router(config)#int f0/0.2
Router(config-subif)#encapsulation dot1Q 2 Router(config-subif)#ip add
Router(config-subif)#ip address 192.168.4.168 255.255.255.0 Router(config-subif)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.1 Router(config)#exit
%SYS-5-CONFIG_I: Configured from console by console Router#conf
Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#ip add
Router(config-if)#ip address 192.168.10.2 255.255.255.0
Router(config-if)#
- 第 1 頁:三層交換機配置實例詳解
- 第 2 頁:H3C配置三層交換機配置實例
本文導(dǎo)航
非常好我支持^.^
(143) 44%
不好我反對
(182) 56%
相關(guān)閱讀:
- [電子說] 邁威通信MISCOM8220GX三層交換機強勢登場 2023-10-19
- [電子說] 三層交換機的工作原理和實現(xiàn)方式 2023-10-16
- [電子說] 三層交換機到底要怎么配置 有哪些常用的配置命令 2023-08-09
- [通信網(wǎng)絡(luò)] 什么是三層交換機?三層交換機和路由器有什么不同? 2023-08-04
- [通信網(wǎng)絡(luò)] 三層交換機如何實現(xiàn)不同VLAN間路由 2023-07-14
- [電子說] 軟路由ROS與H3C三層交換機組網(wǎng)配置步驟 2023-07-12
- [電子說] 三層交換機企業(yè)應(yīng)用配置實例 2023-06-21
- [電子說] 深入解讀路由器、交換機、三層交換機的區(qū)別 2022-09-29
( 發(fā)表人:李倩 )