1. 网络拓扑
2.接入层交换机配置
AS-SW1配置
[AS-SW1] vlan batch 10
[AS-SW1-GigabitEthernet0/0/1] port link-type access
[AS-SW1-GigabitEthernet0/0/1] port default vlan 10
[AS-SW1-GigabitEthernet0/0/20] port link-type trunk
[AS-SW1-GigabitEthernet0/0/20] port trunk allow-pass vlan 10
AS-SW2配置
[AS-SW2] vlan batch 20
[AS-SW2-GigabitEthernet0/0/1] port link-type access
[AS-SW2-GigabitEthernet0/0/1] port default vlan 20
[AS-SW2-GigabitEthernet0/0/20] port link-type trunk
[AS-SW2-GigabitEthernet0/0/20] port trunk allow-pass vlan 20
3. 核心交换机配置
Core-SW1
[Core-SW1] vlan batch 10 12
[Core-SW1-GigabitEthernet0/0/20] port link-type trunk
[Core-SW1-GigabitEthernet0/0/20] port trunk allow-pass vlan 10
[Core-SW1-GigabitEthernet0/0/24] port link-type trunk
[Core-SW1-GigabitEthernet0/0/24] port trunk allow-pass vlan 12
[Core-SW1-GigabitEthernet0/0/24] undo port trunk allow-pass vlan 1
#配置Vlanif10作为VLAN10的网关,配置Vlanif12用来与Core-SW2对接:
[Core-SW1] interface Vlanif 10
[Core-SW1-Vlanif10] ip address 192.168.10.254 24
[Core-SW1] interface Vlanif 12
[Core-SW1-Vlanif12] ip address 10.1.12.1 24
[Core-SW1] interface LoopBack 0
[Core-SW1-LoopBack0] ip address 1.1.1.1 32
#创建OSPF进程1,并且在area0中激活接口Vlanif12及Vlanif10:
[Core-SW1] ospf 1 router-id 1.1.1.1
[Core-SW1-ospf-1] area 0
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255
[Core-SW1-ospf-1-area-0.0.0.0] network 10.1.12.0 0.0.0.255
Core-SW2的配置如下:
[Core-SW2] vlan batch 20 12
[Core-SW2-GigabitEthernet0/0/20] port link-type trunk
[Core-SW2-GigabitEthernet0/0/20] port trunk allow-pass vlan 20
[Core-SW2-GigabitEthernet0/0/24] port link-type trunk
[Core-SW2-GigabitEthernet0/0/24] port trunk allow-pass vlan 12
[Core-SW2-GigabitEthernet0/0/24] undo port trunk allow-pass vlan 1
[Core-SW2] interface Vlanif 20
[Core-SW2-Vlanif20] ip address 192.168.20.254 24
[Core-SW2] interface Vlanif 12
[Core-SW2-Vlanif12] ip address 10.1.12.2 24
[Core-SW2] interface LoopBack 0
[Core-SW2-LoopBack0] ip address 2.2.2.2 32
[Core-SW2] ospf 1 router-id 2.2.2.2
[Core-SW2-ospf-1] area 0
[Core-SW2-ospf-1-area-0.0.0.0] network 192.168.20.0 0.0.0.255
[Core-SW2-ospf-1-area-0.0.0.0] network 10.1.12.0 0.0.0.255
4. 查看配置