电子说
一、二层交换机组网案例
在这个实验中,R1和R2为二层交换机,4台PC均为同一个网段,但是属于不同的vlan,实现PC1和PC3两台交换机之间实现互通,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
验证结果:
PC1pingPC3:
PC2pingPC4:
二、三层交换机组网案例
这个三层组网之中,S1和S4为三层交换机,S2和S3为二层交换机,PC1和PC2的网关在 S1上,PC1属于vlan10,pc2属于vlan20,PC3属于vlan30。
配置要点:
配置命令:
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地址,然后通过静态路由或者动态路由的方式形成互通,通过查找路由表转发,让不同网段互通。
全部0条评论
快来发表一下你的评论吧 !