HCIE(二)交换实验

交换实验

    • 实验拓扑图
    • 配置命令
      • 1、划分vlan
      • 2、STP,分流互备
      • 3、管理valn(配置三层)
      • 4、dhcp配置
      • 5、vrrp网关冗余配置
      • 6、路由配置

实验拓扑图

HCIE(二)交换实验_第1张图片

配置命令

1、划分vlan

[sw3]vlan batch 2 3
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 2
[sw3-GigabitEthernet0/0/1]int g0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 3

[sw4]vlan batch 2 3
[sw4]int g0/0/1
[sw4-GigabitEthernet0/0/1]port link-type access
[sw4-GigabitEthernet0/0/1]port default vlan 2
[sw4-GigabitEthernet0/0/1]int g0/0/2
[sw4-GigabitEthernet0/0/2]port link-type access
[sw4-GigabitEthernet0/0/2]port default vlan 3

[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]trunkport g0/0/1
[sw1-Eth-Trunk1]trunkport g0/0/2

HCIE(二)交换实验_第2张图片
trunk干道(四台交换机之间都需要通过vlan2和vlan3的流量,所以都做成trunk干道)
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pass vlan 2 to 3
其他接口也是一样的配置。

2、STP,分流互备

sw1上:主根是vlan2的,备份根是vlan3的
sw2上:主根是vlan3的,备份根是vlan2的
[sw1]stp enable
[sw1]stp mode mstp
HCIE(二)交换实验_第3张图片
[sw1]stp instance 1 priority 0
[sw1]stp instance 2 priority 4096
开启bpdu保护
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]stp enable
[sw3-GigabitEthernet0/0/3]stp edged-port enable

3、管理valn(配置三层)

[sw1]int Vlanif 2
[sw1-Vlanif2]ip add 10.2.2.1 24
[sw1-Vlanif2]int vlan 3
[sw1-Vlanif3]ip add 10.2.3.1 24

[sw2]int Vlanif 2
[sw2-Vlanif2]ip add 10.2.2.2 24
[sw2-Vlanif2]int vlan 3
[sw2-Vlanif3]ip add 10.2.3.2 24

4、dhcp配置

[sw1]dhcp enable
[sw1]ip pool vlan2
[sw1-ip-pool-vlan2]gateway-list 10.2.3.126
[sw1-ip-pool-vlan2]network 10.2.3.0 mask 255.255.255.128
[sw1-ip-pool-vlan2]dns-list 114.114.114.114
[sw1-Vlanif2]dhcp select global
[sw1]ip pool vlan3
[sw1-ip-pool-vlan3]gateway-list 10.2.3.254
[sw1-ip-pool-vlan3]network 10.2.3.254 mask 255.255.255.128
[sw1-ip-pool-vlan3]dns-list 114.114.114.114
[sw1-Vlanif3]dhcp select global

5、vrrp网关冗余配置

[sw1-Vlanif2]vrrp vrid 1 virtual-ip 10.2.2.254
[sw1-Vlanif2]vrrp vrid 1 priority 120
[sw1-Vlanif2]vrrp vrid 1 track int g0/0/5 reduced 30
[sw1-Vlanif3]vrrp vrid 1 virtual-ip 10.2.3.254

[sw2-Vlanif2]vrrp vrid 1 virtual-ip 10.2.2.254
[sw2-Vlanif3]vrrp vrid 1 virtual-ip 10.2.3.254
[sw2-Vlanif3]vrrp vrid 1 priority 120
[sw2-Vlanif3]vrrp vrid 1 track int g0/0/5 reduced 30

6、路由配置

ISP的配置IP
[iso]int LoopBack 0
[iso-LoopBack0]ip address 1.1.1.1 24
[iso-LoopBack0]int g0/0/0
[iso-GigabitEthernet0/0/0]ip address 200.1.1.1 24

R1的配置IP
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 200.1.1.2 24
[r1-GigabitEthernet0/0/1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 10.1.1.1 30
[r1-GigabitEthernet0/0/0]int g0/0/2
[r1-GigabitEthernet0/0/2]ip address 10.1.1.5 30

sw1的配置
[sw1]vlan 99
[sw1-vlan99]q
[sw1-GigabitEthernet0/0/4]port link-type access
[sw1-GigabitEthernet0/0/4]port default vlan 99
[sw1]int vlan99
[sw1-Vlanif99]ip address 10.1.1.2 30

sw2的配置
[sw2]vlan 99
[sw2-vlan99]q
[sw2]int g0/0/4
[sw2-GigabitEthernet0/0/4]port link-type access
[sw2-GigabitEthernet0/0/4]port default vlan 99
[sw2]int Vlanif 99
[sw2-Vlanif99]ip address 10.1.1.6 30

边界路由器r1启OSPF
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 10.1.0.0 0.0.255.255

sw2启OSPF,宣告直连网段
[sw2]ospf 1 router-id 11.11.11.11
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 10.1.1.6 0.0.0.0
[sw2-ospf-1-area-0.0.0.0]q
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 10.1.2.0 0.0.3.255

sw1启OSPF,宣告直连网段
[sw1]ospf 1 router-id 22.22.22.22
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 10.1.2.0 0.0.3.255

你可能感兴趣的:(HCIE)