一、二層交換機組網(wǎng)案例
在這個實驗中,R1和R2為二層交換機,4臺PC均為同一個網(wǎng)段,但是屬于不同的vlan,實現(xiàn)PC1和PC3兩臺交換機之間實現(xiàn)互通,PC2和PC4互通。
1、配置步驟:
2、配置命令:
SW1:
vlan batch 10 20
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
SW2:
vlan batch 10 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
驗證結(jié)果:
PC1pingPC3:
PC2pingPC4:
二、三層交換機組網(wǎng)案例
這個三層組網(wǎng)之中,S1和S4為三層交換機,S2和S3為二層交換機,PC1和PC2的網(wǎng)關(guān)在 S1上,PC1屬于vlan10,pc2屬于vlan20,PC3屬于vlan30。
配置要點:
- S1配置到vlan 30網(wǎng)段的靜態(tài)路由
- S4配置一條 默認路由(或者配置兩條到vlan10,vlan20網(wǎng)段的靜態(tài)路由)
- pc3路由器必須配置一條到s4,g0/1的默認路由(相當于pc配置網(wǎng)關(guān))
配置命令:
SW1:
vlan batch 10 20
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
SW2:
vlan batch 10 20
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
**SW3:
**
vlan batch 10 20
interface Vlanif1
ip address 34.1.1.3 255.255.255.0
interface Vlanif10
ip address 10.1.1.254 255.255.255.0
interface Vlanif20
ip address 20.1.1.254 255.255.255.0
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
ip route-static 30.1.1.0 255.255.255.0 34.1.1.4
SW4:
vlan batch 30
interface Vlanif1
ip address 34.1.1.4 255.255.255.0
interface Vlanif30
ip address 30.1.1.254 255.255.255.0
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
ip route-static 10.1.1.0 255.255.255.0 34.1.1.3
ip route-static 20.1.1.0 255.255.255.0 34.1.1.3
PC5ping PC1:
PC5pingPC2:
可以看到,通過三層交換機可以通過vlanif的路由的方式配置IP地址,然后通過靜態(tài)路由或者動態(tài)路由的方式形成互通,通過查找路由表轉(zhuǎn)發(fā),讓不同網(wǎng)段互通。
-
交換機
+關(guān)注
關(guān)注
21文章
2637瀏覽量
99528 -
路由器
+關(guān)注
關(guān)注
22文章
3728瀏覽量
113701 -
VLAN技術(shù)
+關(guān)注
關(guān)注
0文章
45瀏覽量
6380
發(fā)布評論請先 登錄
相關(guān)推薦
評論