1. 配置VLAN并将各接口加入VLAN
[LSW1]vlan batch 10 20
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 10
[LSW1-GigabitEthernet0/0/2]port link-type access
[LSW1-GigabitEthernet0/0/2]port default vlan 10
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[LSW1-GigabitEthernet0/0/3]port trunk pvid vlan 20
2. 配置VLANIF接口
[LSW1-Vlanif10]ip add 10.1.1.10 24
[LSW1-Vlanif10]ip add 10.1.2.10 24 sub
[LSW1-Vlanif20]ip add 10.1.20.2 24
3. 配置上行路由
[LSW1]ospf 1
[LSW1-ospf-1]area 0
[LSW1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
[LSW1-ospf-1-area-0.0.0.0]network 10.1.20.0 0.0.0.255
4.配置AR1
[AR1-GigabitEthernet0/0/0]ip add 10.1.20.1 24
[AR1]ospf 1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 10.1.20.0 0.0.0.255
5.配置PC
6.验证配置