华为HCNP认证综合实验单线路V1.0,文章为路由交换阶段。
Section 1交换部分
Section 1.1创建VLAN与接口配置
Core-01、Core-02
vlan batch 10 20 30 40 /*批量创建VLAN*/
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20 /*这个trunk接口只允许通过VLAN10与20 */
#
/*此步需要在配置完链路捆绑后配置*/
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094 /* 这个trunk接口允许通过所有VLAN*/
Access-01:
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/3
port link-type access
port default vlan 10
stp edged-port enable /*配置连接PC的接口为边缘端口,加速快速转发*/
Access-02:
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface Ethernet0/0/3
port link-type access
port default vlan 20
stp edged-port enable /*配置连接PC的接口为边缘端口,加速快速转发*/
Section 1.3链路捆绑
Core-01、Core-02
interface Eth-Trunk1 /*创建虚拟捆绑接口,此后所有配置都做这个接口上 */
interface GigabitEthernet0/0/2
eth-trunk 1 /*将此物理接口划分到捆绑接口,以后这个接口不做任何单独操作 */
#
interface GigabitEthernet0/0/3
eth-trunk 1
Section 1.4MSTP生成树
Core-01、Core-02、Access-01、Access-02:
stp region-configuration /* 生成树相关配置,所有交换机都要配置*/
region-name h3c /* 域名一定要一样*/
revision-level 1
instance 1 vlan 1 10 /* 将VLAN1与VLAN10划分到实例1中*/
instance 2 vlan 20 /*将VLAN1与VLAN20划分到实例2中*/
active region-configuration /*激活前面的配置 */
Core-01:
stp instance 1 root primary /*配置Core-01为实例1的主根,实例2的备根 */
stp instance 2 root secondary
Core-02:
stp instance 2 root primary /* 配置Core-02为实例2的主根,实例1的备根*/
stp instance 1 root secondary