华为eNSP实验-三层交换机的不同网段通信(通过OSPF路由方式)

1.拓扑图

华为eNSP实验-三层交换机的不同网段通信(通过OSPF路由方式)_第1张图片

2.过程如下

2.1 首先PC1和PC2配置好IP地址

2.2 在SW1上配置虚拟网关及VLAN

system-view 
[Huawei]sysname SW1
[SW1]undo info-center enable
[SW1]
[SW1]vlan batch 10 20
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access 
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access 
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1-GigabitEthernet0/0/2]quit
[SW1]interface Vlanif 10
[SW1-Vlanif10]ip address 192.168.1.254 24 
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 192.168.2.1 24

验证:配置完后,PC1可以ping通网关192.168.1.254

2.3在SW4上配置虚拟网关及VLAN

system-view 
[Huawei]sysname SW4
[SW4]undo info-center enable 
[SW4]vlan batch 20 30
[SW4]interface GigabitEthernet 0/0/2
[SW4-GigabitEthernet0/0/2]port link-type access 
[SW4-GigabitEthernet0/0/2]port default vlan 30
[SW4-GigabitEthernet0/0/2]int g0/0/1
[SW4-GigabitEthernet0/0/1]port link-type access
[SW4-GigabitEthernet0/0/1]port default vlan 20
[SW4-GigabitEthernet0/0/1]quit
[SW4]interface Vlanif 30
[SW4-Vlanif30]ip address 192.168.3.254 24
[SW4]interface Vlanif 20
[SW4-Vlanif20]ip address 192.168.2.2 24

验证:配置完后,PC2可以ping通网关192.168.3.254

但是PC1和PC2之间不能互通

2.4 SW1和SW2开启OSPF路由,使得他们之间网络互通

[SW1]ospf
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[SW4]ospf 
[SW4-ospf-1]area 0
[SW4-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0 

2.5  验证:PC1可以ping通PC2

华为eNSP实验-三层交换机的不同网段通信(通过OSPF路由方式)_第2张图片

你可能感兴趣的:(华为,网络)