在华为的交换机上,一般采用VRRP的技术来实现交换机的冗余,但是VRRP本身无法感知故障、自动切换,因此需要配置VRRP与接口状态联动,以实现设备或者链路故障时,交换机自动切换,从而保证数据流量的正常转发。
本文主要涉及华为交换机的以下几个技术点:Eth-Trunk、VRRP、Super-VLAN。
Super VLAN又称为VLAN聚合(VLAN Aggregation),一个Super VLAN中包含多个Sub VLAN,每个Sub VLAN是一个广播域,不同Sub VLAN之间二层相互隔离,只能三层通讯。
看上去有点乱,像只丑陋的虫子,不过大致还原了客户环境,将就着看吧。
按照从上到下的配置顺序,演示一下Eth-Trunk、VRRP和Super-VLAN相结合的配置。
路由器和两台核心之间,跑的是OSPF协议,区域0。各交换机之间,都是双链路,全部需要配置Eth-Trunk,有点烦,先规划好再动手。
一、路由器的配置
interface GigabitEthernet0/0/0
ip address 1.1.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 2.1.1.1 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 222.92.xx.xx 255.255.255.248
#
ospf 1
area 0
network 1.1.1.1 0.0.0.0
network 2.1.1.1 0.0.0.0
network 222.92.xx.xx 0.0.0.0
二、核心交换机的配置
两台交换机差不多,就是关键部位需要做一下小修改,所以只贴出来核心1的配置了:
Sysname Core1
#
interface GigabitEthernet0/0/1
ip address 1.1.1.2 255.255.255.252
#
vlan batch 11 to 15 101 to 180 301 to 305 400 //指创建VLAN
#
vlan 11
aggregate-vlan //配置聚合VLAN
access-vlan 101 to 116 301
vlan 12
aggregate-vlan
access-vlan 117 to 132 302
vlan 13
aggregate-vlan
access-vlan 133 to 148 303
vlan 14
aggregate-vlan
access-vlan 149 to 164 304
vlan 15
aggregate-vlan
access-vlan 165 to 180 305
#
interface Vlanif11
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.1 //vrrp1的虚拟IP为10.1.1.1
vrrp vrid 1 priority 120 //vrrp1的优先级为120
vrrp vrid 1 preempt-mode timer delay 20 //vrrp1的抢占时间为20秒
vrrp vrid 1 track interface gigabitethernet1/0/1 reduced 100 //监视上行接口,一旦断开就降优先级,让核心2顶上
vrrp vrid 1 track interface eth-trunk 13 reduced 100 //监视下行接口,目的同上
vrrp advertise send-mode 301
#
interface Vlanif12
ip address 10.1.2.2 255.255.255.0
vrrp vrid 2 virtual-ip 10.1.2.1
vrrp vrid 2 priority 120
vrrp vrid 2 preempt-mode timer delay 20
vrrp vrid 2 track interface gigabitethernet1/0/1 reduced 100
vrrp vrid 2 track interface eth-trunk 13 reduced 100
vrrp advertise send-mode 302
#
interface Vlanif13
ip address 10.1.3.2 255.255.255.0
vrrp vrid 3 virtual-ip 10.1.3.1
vrrp vrid 3 priority 120
vrrp vrid 3 preempt-mode timer delay 20
vrrp vrid 3 track interface gigabitethernet1/0/1 reduced 100
vrrp vrid 3 track interface eth-trunk 13 reduced 100
vrrp advertise send-mode 303
#
interface Vlanif14
ip address 10.1.4.2 255.255.255.0
vrrp vrid 4 virtual-ip 10.1.4.1
vrrp vrid 4 priority 120
vrrp vrid 4 preempt-mode timer delay 20
vrrp vrid 4 track interface gigabitethernet1/0/1 reduced 100
vrrp vrid 4 track interfaceeth-trunk 13 reduced 100
vrrp advertise send-mode 304
#
interface Vlanif15
ip address 10.1.5.2 255.255.255.0
vrrp vrid 5 virtual-ip 10.1.5.1
vrrp vrid 5 priority 120
vrrp vrid 5 preempt-mode timer delay 20
vrrp vrid 5 track interface gigabitethernet1/0/1 reduced 100
vrrp vrid 5 track interface eth-trunk 13 reduced 100
vrrp advertise send-mode 305
#
interface Eth-Trunk12 //创建eth-trunk,其实是先创建再调用的,只是在配置文件里面排在后面而已
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 301 to 305
mode lacp
#
interface GigabitEthernet1/0/2
eth-trunk 12
#
interface GigabitEthernet1/0/3
eth-trunk 12
#
interface Eth-Trunk13
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 301 to 305
mode lacp
#
interface GigabitEthernet1/0/4
eth-trunk 13
#
interface GigabitEthernet1/0/5
eth-trunk 13
#
ospf 1
area 0.0.0.0
network 1.1.1.2 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
network 10.1.3.0 0.0.0.255
network 10.1.4.0 0.0.0.255
network 10.1.5.0 0.0.0.255
#
相信大伙儿都看出来了,平时流量全都在Master上面跑呢,核心2只是个打酱油的角色,哪天核心1出问题了,才轮到它上;
按照我平时的配置习惯,肯定不是这样的,但是客户说,这样的优点是:核心2不会有损耗,哪天核心1跑累了,可以切换一下角色……好吧,只能说也挺有想法的。
三、汇聚交换机的配置
以下是配置命令,不是配置完成后的配置文件——配置的时候,先在记事本里面写好,然后直接粘贴到交换机上的,所以也就很方便地粘贴在文档中了。
vlan bat 11 to 15 101 to 180
int Eth-Trunk 13
mode lacp-static
p l t
p t a v a
int g0/0/3
eth-trunk 13
int g0/0/4
eth-trunk 13
int Eth-Trunk 34
mode lacp-static
p l t
p t a v a
int g0/0/1
eth-trunk 34
int g0/0/2
eth-trunk 34
int Eth-Trunk 35
mode lacp-static
p l t
p t a v a
int g0/0/5
eth-trunk 35
int g0/0/6
eth-trunk 35
int Eth-Trunk 36
mode lacp-static
p l t
p t a v a
int g0/0/7
eth-trunk 36
int g0/0/8
eth-trunk 36
int Eth-Trunk 37
mode lacp-static
p l t
p t a v a
int g0/0/9
eth-trunk 37
int g0/0/10
eth-trunk 37
int Eth-Trunk 38
mode lacp-static
p l t
p t a v a
int g0/0/11
eth-trunk 38
int g0/0/12
eth-trunk 38
全是Eth-Trunk,头都晕了,我配置之前,是先在图上标好的,建议你也这么做,不然很容易搞错的;如下图所示,红色数字表示Eth-Trunk编号
四、接入交换机的配置
此处省略500字,反正就是继续Eth-Trunk,然后划分VLAN,终端接口配置为access……这个简单,前面好多文章里面都有。
总算配置完了,回头再看上面的拓扑图,感觉更像是架飞机,也许是因为带上了红色的标识?