溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

服務(wù)器中如何配置三層交換機(jī)

發(fā)布時間:2021-11-23 17:43:05 來源:億速云 閱讀:157 作者:小新 欄目:系統(tǒng)運(yùn)維

這篇文章將為大家詳細(xì)講解有關(guān)服務(wù)器中如何配置三層交換機(jī),小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

實驗拓?fù)洌?br/>服務(wù)器中如何配置三層交換機(jī)
實驗?zāi)康模簆c1、pc2、pc3、pc4、server-pt實現(xiàn)互通

實驗需求:        
pc1: ip地址:192.168.10.1
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):192.168.10.254
pc2:  ip地址:192.168.20.1
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):192.168.20.254
pc3:    ip地址:192.168.30.1
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):192.168.30.254
pc4:   ip地址:192.168.40.1
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):  192.168.40.254
server-PT:    ip地址:192.168.60.1
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):192.168.60.254

實驗步驟:
1.配置PC機(jī)
pc1
服務(wù)器中如何配置三層交換機(jī)

pc2服務(wù)器中如何配置三層交換機(jī)
pc3
服務(wù)器中如何配置三層交換機(jī)
pc4
服務(wù)器中如何配置三層交換機(jī)
serve-pt
服務(wù)器中如何配置三層交換機(jī)

2.配置二層交換機(jī)
操作內(nèi)容:
a、sw1和sw2分別創(chuàng)建vlan10、vlan20和vlan30、vlan40,并將端口加入到各自對應(yīng)的vlan中,與PC機(jī)相連的端口設(shè)置access模式且允許各自所在vlan通過,其余端口創(chuàng)建trunk模式且允許所有vlan通過
b、sw3和sw4各自創(chuàng)建vlan10、vlan20、vlan30、vlan40,將所有端口創(chuàng)建trunk鏈路且允許所有vlan通過

sw1:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw1
sw1(config)#vlan 10
sw1(config-vlan)#vlan 20
sw1(config-vlan)#exit
sw1(config)#interface fa0/1
sw1(config-if)#switchport mode access
sw1(config-if)#switchport access vlan 10
sw1(config-if)#exit
sw1(config)#interface fa0/2
sw1(config-if)#switchport mode access
sw1(config-if)#switchport access vlan 20
sw1(config-if)#exit
sw1(config)#interface fa0/3
sw1(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
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#interface fa0/4
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#interface fa0/5
sw1(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
sw1(config-if)#switchport trunk allowed vlan all
sw1(config-if)#exit
sw1(config)#exit
sw1#write

sw2:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw2
sw2(config)#vlan 30
sw2(config-vlan)#vlan 40
sw2(config-vlan)#exit
sw2(config)#interface fa0/1
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 30
sw2(config-if)#exit
sw2(config)#interface fa0/2
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 40
sw2(config-if)#exit
sw2(config)#interface fa0/3
sw2(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
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#interface fa0/4
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#interface fa0/5
sw2(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
sw2(config)#exit
sw2#write

sw3:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw3

Switch>enable
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
sw3(config)#vlan 10
sw3(config-vlan)#vlan 20
sw3(config-vlan)#vlan 30
sw3(config-vlan)#vlan 40
sw3(config-vlan)#exit
sw3(config)#interface fa0/1
sw3(config-if)#switchport mode trunk
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3(config)#int fa0/2
sw3(config-if)#switchport mode trunk
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3(config)#interface fa0/3
sw3(config-if)#switchport mode trunk
sw3(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw3(config-if)#switchport trunk allowed vlan all
sw3(config-if)#exit
sw3#write

sw4:
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw4
sw4(config)#vlan 10
sw4(config-vlan)#vlan 20
sw4(config-vlan)#vlan 30
sw4(config-vlan)#vlan 40
sw4(config-vlan)#exit
sw4(config)#interface fa0/1
sw4(config-if)#switchport mode trunk
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4(config)#int fa0/2
sw4(config-if)#switchport mode trunk
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4(config)#interface fa0/3
sw4(config-if)#switchport mode trunk
sw4(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed
sw4(config-if)#switchport trunk allowed vlan all
sw4(config-if)#exit
sw4#write

3.配置三層交換機(jī)
操作內(nèi)容:
創(chuàng)建vlan10、vlan20、vlan30、vlan40,創(chuàng)建虛擬端口并設(shè)置網(wǎng)關(guān),fa0/3設(shè)置ip地址及子網(wǎng)掩碼,開啟路由功能,配置下一跳到192.168.60.0網(wǎng)段

Switch>en
Switch#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#exit
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.10.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.30.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 40
%LINK-5-CHANGED: Interface Vlan40, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to up
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.40.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface fa0/3
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.50.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#ip route 192.168.60.0 255.255.255.0 192.168.50.2
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#write

4.配置路由器
操作內(nèi)容:配置端口的IP及子網(wǎng)掩碼,配置默認(rèn)路由

Router>en
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/1
%Invalid interface type and number
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router(config-if)#ip address 192.168.50.2 255.255.255.0
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Router(config-if)#ip address 192.168.60.254 255.255.255.0
Router(config-if)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.50.1
Router(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Router#write

驗證與測試:
服務(wù)器中如何配置三層交換機(jī)
服務(wù)器中如何配置三層交換機(jī)

關(guān)于“服務(wù)器中如何配置三層交換機(jī)”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI