目标:
SW1
SW1
创建eth-trunk使两个物理接口逻辑成一个
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW1
[SW1]int Eth-Trunk 0
[SW1-Eth-Trunk0]q
[SW1]int g 0/0/4
[SW1-GigabitEthernet0/0/4]eth-trunk 0
[SW1-GigabitEthernet0/0/4]int g 0/0/5
[SW1-GigabitEthernet0/0/5]eth-trunk 0
做trunk干道
[SW1]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 Eth-Trunk 0
//这个组包括g0/0/2和g0/0/3接口以及eth-trunk 0
[SW1-Eth-Trunk0]port link-type trunk
//把这个组所有的接口定义为trunk。这个可以一次性把三个接口做成trunk干道
[SW1-Eth-Trunk0]port trunk allow-pass vlan 1 to 2
//允许vlan1和vlan2通过
VLAN的创建和划分
[SW1]vlan 2
[SW1-vlan2]q
配置stp
[SW1]stp mode mstp
[SW1]stp enable
[SW1]stp region-configuration
[SW1-mst-region]region-name a 创建a
[SW1-mst-region]instance 1 vlan 1 组1放vlan1
[SW1-mst-region]instance 2 vlan 2
[SW1-mst-region]active region-configuration 激活配置
sw1和sw2之间互为备份
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
启动SVI
[SW1]int vlan 1
[SW1-Vlanif1]ip add 172.16.1.1 25
[SW1-Vlanif1]int vlan 2
[SW1-Vlanif2]ip add 172.16.1.129 25
VRRP
[SW1]int vlan 1
[SW1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[SW1-Vlanif1]vrrp vrid 1 priority 120
[SW1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30
[SW1-Vlanif1]int vlan 2
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
DHCP
[SW1]dhcp enable
[SW1]ip pool v1
[SW1-ip-pool-v1]network 172.16.1.0 mask 25
[SW1-ip-pool-v1]gateway-list 172.16.1.126
[SW1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[SW1-ip-pool-v1]q
[SW1]ip pool v2
[SW1-ip-pool-v2]network 172.16.1.128 mask 25
[SW1-ip-pool-v2]gateway-list 172.16.1.254
[SW1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
[SW1-ip-pool-v2]q
[SW1]int v 1
[SW1-Vlanif1]dhcp select global
[SW1-Vlanif1]int v 2
[SW1-Vlanif2]dhcp select global
配置路由
[SW1]vlan 100
[SW1-vlan100]q
[SW1]int g 0/0/1
[SW1-GigabitEthernet0/0/1]p l a
[SW1-GigabitEthernet0/0/1]p d v 100
[SW1-GigabitEthernet0/0/1]int v 100
[SW1-Vlanif100]ip add 172.16.0.1 30
ospf
[sw1]ospf 1 router-id 1.1.1.2
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]q
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.129 0.0.0.0
汇总
[sw1]ospf 1
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
[sw1]ospf 1
[sw1-ospf-1]silent-interface all
[sw1-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw1-ospf-1]undo silent-interface Eth-Trunk 0
[sw1-ospf-1]undo silent-interface vlanif 1
[sw1-ospf-1]undo silent-interface vlanif 100
创建eth-trunk使两个物理接口逻辑成一个
做trunk干道
VLAN的创建和划分
配置stp
sw1和sw2之间互为备份
启动SVI(测试是否成功)
VRRP
DHCP
缺省路由
SW2
SW2
创建eth-trunk使两个物理接口逻辑成一个
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW2
[SW2]int Eth-Trunk 0
[SW2-Eth-Trunk0]q
[SW2]int g 0/0/4
[SW2-GigabitEthernet0/0/4]eth-trunk 0
[SW2-GigabitEthernet0/0/4]int g 0/0/5
[SW2-GigabitEthernet0/0/5]eth-trunk 0
做trunk干道
[SW2]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 Eth-Trunk 0
//这个组包括g0/0/2和g0/0/3接口以及eth-trunk 0
[SW2-Eth-Trunk0]port link-type trunk
//把这个组所有的接口定义为trunk。这个可以一次性把三个接口做成trunk干道
[SW2-Eth-Trunk0]port trunk allow-pass vlan 1 to 2
//允许vlan1和vlan2通过
VLAN的创建和划分
[SW1]vlan 2
[SW1-vlan2]q
配置stp
[SW2]stp mode mstp
[SW2]stp enable
[SW2]stp region-configuration
[SW2-mst-region]region-name a 创建a
[SW2-mst-region]instance 1 vlan 1 组1放vlan1
[SW2-mst-region]instance 2 vlan 2
[SW2-mst-region]active region-configuration 激活配置
sw1和sw2之间互为备份
[SW2]stp instance 2 root primary
[SW2]stp instance 1 root secondary
启动SVI
[SW2]int vlan 1
[SW2-Vlanif1]ip add 172.16.1.2 25
[SW2-Vlanif1]int vlan 2
[SW2-Vlanif2]ip add 172.16.1.130 25
VRRP
[SW2]int vlan 1
[SW2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[SW2-Vlanif1]int vlan 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[SW2-Vlanif2]vrrp vrid 1 priority 120
[SW2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30
DHCP
[SW2]dhcp enable
[SW2]ip pool v1
[SW2-ip-pool-v1]network 172.16.1.0 mask 25
[SW2-ip-pool-v1]gateway-list 172.16.1.126
[SW2-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[SW2-ip-pool-v1]ip pool v2
[SW2-ip-pool-v2]network 172.16.1.128 mask 25
[SW2-ip-pool-v2]gateway-list 172.16.1.254
[SW2-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
[SW2-ip-pool-v2]int v 1
[SW2-Vlanif1]dhcp select global
[SW2-Vlanif1]int v 2
[SW2-Vlanif2]dhcp select global
配置路由
[SW2]vlan 100
[SW2-vlan100]q
[SW2]int g 0/0/1
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/1]p d v 100
[SW2-GigabitEthernet0/0/1]int v 100
[SW2-Vlanif100]ip add 172.16.0.5 30
ospf
[sw2]ospf 1 router-id 2.2.2.2
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0
[sw2-ospf-1-area-0.0.0.0]q\n[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.130 0.0.0.0
汇总
[sw2]ospf 1
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
[sw2]ospf 1
[sw2-ospf-1]silent-interface all
[sw2-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw2-ospf-1]undo silent-interface Eth-Trunk 0
[sw2-ospf-1]undo silent-interface vlanif 1
[sw2-ospf-1]undo silent-interface vlanif 100
做nat
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r2-acl-basic-2000]int g0/0/1
[r2-GigabitEthernet0/0/1]nat outbound 2000
创建eth-trunk使两个物理接口逻辑成一个
做trunk干道
VRRP
置路由
汇总
SW3
SW3
做trunk干道
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW3
[SW3]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[SW3-port-group]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan 2
//默认有vlan1,可以不写了
VLAN的创建和划分
[SW1]vlan 2
[SW1-vlan2]q
[SW3]int Eth 0/0/2
[SW3-Ethernet0/0/2]port link-type access
[SW3-Ethernet0/0/2]port default vlan 2
配置stp
[SW3]stp mode mstp
[SW3]stp enable
[SW3]stp region-configuration
[SW3-mst-region]region-name a 创建a
[SW3-mst-region]instance 1 vlan 1 组1放vlan1
[SW3-mst-region]instance 2 vlan 2
[SW3-mst-region]active region-configuration 激活配置
配置stp
[SW3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW3-port-group]stp edged-port enable
做trunk干道
SW4
SW4
做trunk干道
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW4
[SW4]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[SW4-port-group]port link-type trunk
[SW4-port-group]port trunk allow-pass vlan 2
VLAN的创建和划分
[SW1]vlan 2
[SW1-vlan2]q
[SW4]int e 0/0/2
[SW4-Ethernet0/0/2]p l a
[SW4-Ethernet0/0/2]p d v 2
配置stp
[SW4]stp mode mstp
[SW4]stp enable
[SW4]stp region-configuration
[SW4-mst-region]region-name a 创建a
[SW4-mst-region]instance 1 vlan 1 组1放vlan1
[SW4-mst-region]instance 2 vlan 2
[SW4-mst-region]active region-configuration 激活配置
配置stp
[SW3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW3-port-group]stp edged-port enable
做trunk干道
R1
R1
配置路由
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int lo0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.2 24
R2
R2
配置路由
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.0.2 30
[R2-GigabitEthernet0/0/0]int g 0/0/2
[R2-GigabitEthernet0/0/2]ip add 172.16.0.6 30
[R2-GigabitEthernet0/0/2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 12.1.1.1 24
ospf
[r2]ospf 1 router-id 1.1.1.1
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
缺省路由
[r2]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
[r2]ospf 1
[r2-ospf-1]default-route-advertise
测试: