實(shí)驗(yàn)要求
1,PC1,PC2,PC3,PC4分別屬于VLAN10,20,30,40
2,PC1,PC2,PC3,PC4互通


步驟1:PC1,2,3,4分別配置IP,并在SW6,SW7分別配置網(wǎng)關(guān),并都可以PING通自己的網(wǎng)關(guān)
連接終端一般情況多用access,連接網(wǎng)絡(luò)設(shè)備多用trunk,所以SW2,3,4,5的g0/0/1口為access,g0/0/2口為trunk.
SW2的配置SW3,4,5類似
#
vlan batch 10 20 30 40//因?yàn)橐驪C互通所以每一個(gè)需要經(jīng)過的交換機(jī)都需要建立所有PC的對(duì)應(yīng)VALN
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10//每個(gè)交換機(jī)的端口加入相應(yīng)VLAN
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40//要求PC互通所以需要放行相應(yīng)VLAN
SW6配置,SW7類似
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
ip address 20.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan all//放行所有VLAN


2,網(wǎng)關(guān)可以通訊后,就要配置SW8,寫靜態(tài)路由(因?yàn)镻C所在網(wǎng)段不同,所以需要靜態(tài)路由)
因?yàn)樾枰缇W(wǎng)段傳輸數(shù)據(jù),所已SW6,SW7的上行接口也需要接口地址,于是分別建立VLAN2,VLAN3
SW8也需要建立SW6和SW7的VLAN2,VLAN3并且對(duì)應(yīng)VLANIF地址要和SW6,SW7VLANIF在相同網(wǎng)段

SW6配置
#
vlan batch 2
#
interface Vlanif2
ip address 2.2.2.6 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 2.2.2.8//缺省路由
SW7配置
#
vlan batch 3
#
interface Vlanif3
ip address 3.3.3.7 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 3.3.3.8
SW8配置
#
vlan batch 2 to 3 10 20 30 40
#
interface Vlanif2
ip address 2.2.2.8 255.255.255.0
#
interface Vlanif3
ip address 3.3.3.8 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan all
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan all
#
ip route-static 10.1.1.0 255.255.255.0 2.2.2.6//明細(xì)路由
ip route-static 20.1.1.0 255.255.255.0 2.2.2.6
ip route-static 30.1.1.0 255.255.255.0 3.3.3.7
ip route-static 40.1.1.0 255.255.255.0 3.3.3.7
驗(yàn)證:PC1可以ping通PC2,PC3,PC4

==========================
作者:暖巷尋故人

浙公網(wǎng)安備 33010602011771號(hào)