两个实验,第一个实验是简单的实现vlan的互通:同vlan通,不同vlan不通,第二个实验是通过配置ospf实现全网互通。
![捕获.PNG](https://www.www.zyiz.net/i/ll/?i=img_convert/86d997599cb02e5ff0ae8cccb6ba4bc8.png#clientId=u42331768-cdc6-4&crop=0&crop=0&crop=1&crop=1&from=ui&id=uf6314797&margin=[object Object]&name=捕获.PNG&originHeight=321&originWidth=580&originalType=binary&ratio=1&rotation=0&showTitle=false&size=20698&status=done&style=none&taskId=u599146c2-d183-418f-ba46-fdeb33c7e67&title=)
sy
[switch1]sysname SW1
[SW1]interface e0/0/2
[SW1-Ethernet0/0/2]vlan 10
[SW1]interface e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 10
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]vlan 20
[SW1-vlan20]int e0/0/3
[SW1-Ethernet0/0/3]p l a
[SW1-Ethernet0/0/3]p d v 20
[SW1-Ethernet0/0/3]int e0/0/1
[SW1-Ethernet0/0/1]p l t
[SW1-Ethernet0/0/1]port trunk allow-pass vlan 10 20
sy
[Huawei]sysname SW2
[SW2]interface e0/0/2
[SW2-Ethernet0/0/2]vlan 10
[SW2]interface e0/0/2
[SW2-Ethernet0/0/2]p l a
[SW2-Ethernet0/0/2]p d v 10
[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]vlan 20
[SW2-vlan20]int e0/0/3
[SW2-Ethernet0/0/3]p l a
[SW2-Ethernet0/0/3]p d v 20
[SW2-Ethernet0/0/3]int e0/0/1
[SW2-Ethernet0/0/1]p l t
[SW2-Ethernet0/0/1]port trunk allow-pass vlan 10 20
PC1 ping PC3:
PC1 ping PC4:
[LSW2]vlan batch 10 20
[LSW2]int Vlanif 10
[LSW2-Vlanif10]ip add 192.168.1.254 24
[LSW2]int Vlanif 20
[LSW2-Vlanif20]ip add 10.1.11.1 24
[LSW2-Vlanif20]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 10
[LSW1-GigabitEthernet0/0/1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port link-type access
[LSW1-GigabitEthernet0/0/2]port default vlan 20
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 10.1.11.2 24
[AR1-GigabitEthernet0/0/0]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 10.1.12.1 24
[LSW2]vlan batch 30 40
[LSW2]int Vlanif 30
[LSW2-Vlanif30]ip add 10.1.12.2 24
[LSW2-Vlanif30]int Vlanif 40
[LSW2-Vlanif40]ip add 192.168.2.254 24
[LSW2-Vlanif40]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 30
[LSW2-GigabitEthernet0/0/1]int g0/0/2
[LSW2-GigabitEthernet0/0/2]port link-type access
[LSW2-GigabitEthernet0/0/2]port default vlan 40
[LSW2]ospf router-id 1.1.1.1
[LSW2-ospf-1]a 1
[LSW2-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.1]network 10.1.11.0 0.0.0.255
[AR1]ospf router-id 2.2.2.2
[AR1-ospf-1]a 1
[AR1-ospf-1-area-0.0.0.1]network 10.1.11.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.1]a 2
[AR1-ospf-1-area-0.0.0.2]network 10.1.12.0 0.0.0.255
[LSW2]ospf router-id 3.3.3.3
[LSW2-ospf-1]a 2
[LSW2-ospf-1-area-0.0.0.2]network 10.1.12.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.2]network 192.168.2.0 0.0.0.255
PC1 ping PC2