使用 HCL 模拟搭建三层网络架构
条件与需求 假设一个企业园区的建筑和部门结构为: 3 栋楼,每栋楼有 3 个部门,共 9 个部门。
需求:
希望各栋楼之间线路和核心的网络设备都有冗余。 任意一栋楼网络故障也不影响其他楼。 有一定的负载均衡。 路由器下线也不影响内网之间的访问。 有两条宽带线路冗余。
每个部门都划分一个 VLAN。 每栋楼的第 1 个部门,可以访问本楼其他部门。 第 1 栋楼的第 1 个部门,可以访问所有的部门。
规则约定 为了方便阅读理解,做出 VLAN、IP、接口之类的内容做出一定的命名及划分缩写。
3 栋楼的代号为: A、B、C 各栋楼的汇聚层交换机命名也使用楼代号。
3 栋楼下的各自的部门代号为: A: 101、102、103 B: 201、202、203 C: 301、302、303
各部门的接入层交换机命名使用部门代号。
各部门划分的 VLAN 也使用部门代号。 例如:101 -> VLAN 101
使用 VLAN 10 为作为交换机之间的通讯 VLAN。
IP 地址的划分约定: 10.x.1.0 第二位用于办公楼 / 几期 / 厂区 10.1.x.0 第三位用于楼层 / 部门 / 办公室 例如:1 期办公楼 1 楼使用 10.1.1.0
IP 地址的定义约定: 数值越小,越靠近上层。 例如:网关使用 10.x.x.1
物理网络接口、链路聚合组编号的分配约定: 在速率一致的情况下,数值越靠后,越靠近上层。 例如:常见的交换机,高速率的上联接口都是分配的在靠后的编号,所以靠后的口一般都是连上一层的。
负载均衡的分流倾向: 101-103、201-203,优先走 SW1 301-303,优先走 SW2
各个部门的 VLAN:
部门
VLAN
IP 段划分
VLAN 网关
交换机
101
101
10.1.1.0 /24
10.1.1.1
A
102
102
10.1.2.0 /24
10.1.2.1
A
103
103
10.1.3.0 /24
10.1.3.1
A
201
201
10.2.1.0 /24
10.2.1.1
B
202
202
10.2.2.0 /24
10.2.2.1
B
203
203
10.2.3.0 /24
10.2.3.1
B
301
301
10.3.1.0 /24
10.3.1.1
C
302
302
10.3.2.0 /24
10.3.2.1
C
303
303
10.3.3.0 /24
10.3.3.1
C
各路由和交换机的 VLAN 10 地址:
位置
交换机
VLAN 10 地址
路由
RT1
10.0.0.2
路由
RT2
10.0.0.3
核心层
SW1
10.0.0.10
核心层
SW2
10.0.0.11
汇聚层
A
10.0.0.20*
汇聚层
B
10.0.0.21*
汇聚层
C
10.0.0.22*
*:如果有的话
设备列表 路由器 x2 台
核心层交换机 2x2 台
汇聚层交换机 3x2 台
接入层交换机 9 台
1 2 3 101、102、103 201、202、203 301、302、303
后面的 b 表示这是堆叠的备用机
路由器均使用 HCL 中的 VSR-88 交换机均使用 HCL 中的 S6850
设备连接图 这个是物理连线上的
这是逻辑上的
文末有 HCL 模拟器和工程文件
命令操作 堆叠 如果需要设备冗余的话,建议优先考虑堆叠。
要做的话,这个要最开始就做,如果不做的话,这段可以跳过。
这里以 SW1
和 SW1b
的堆叠为例
物理连线 1 2 3 SW1 SW1b FortyGigE 1 /0 /53 <---> FortyGigE 1 /0 /53 FortyGigE 1 /0 /54 <---> FortyGigE 1 /0 /54
核心层交换机 SW1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 <H3C>system-view [H3C] hostname SW1[SW1] irf member 1 priority 32 [SW1] interface range FortyGigE 1 /0 /53 to FortyGigE 1 /0 /54 [SW1-if-range] shutdown[SW1-if-range] quit[SW1] irf-port 1 /1 [SW1-irf-port1/1] port group interface FortyGigE 1 /0 /53 [SW1-irf-port1/1] port group interface FortyGigE 1 /0 /54 [SW1-irf-port1/1] quit把端口打开 [SW1] interface range FortyGigE 1 /0 /53 to FortyGigE 1 /0 /54 [SW1-if-range] undo shutdown[SW1-if-range] quit[SW1] save[SW1] irf-port-configuration active
核心层交换机 SW1b 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <H3C>system-view [H3C] hostname SW1b[SW1b] irf member 1 renumber 2 [SW1b] quit<SW1b>reboot <SW1b>system-view [SW1b] irf member 2 priority 1 [SW1b] interface range FortyGigE 2 /0 /53 to FortyGigE 2 /0 /54 [SW1b-if-range] shutdown[SW1b-if-range] quit[SW1b] irf-port 2 /2 [SW1b-irf-port2/2] port group interface FortyGigE 2 /0 /53 [SW1b-irf-port2/2] port group interface FortyGigE 2 /0 /54 [SW1b-irf-port2/2] quit[SW1b] interface range FortyGigE 2 /0 /53 to FortyGigE 2 /0 /54 [SW1b-if-range] undo shutdown[SW1b-if-range] quit[SW1b] save[SW1b] irf-port-configuration active
SW1b 运行完 irf-port-configuration active
后,SW1b 会自动启动,可以在 SW1 上看到各种下线上线的信息。 重启完成后,再连进去 SW1b 会发现名字也变成了 SW1,后面直接操作 “SW1” 就可以了。 用 display interface brief
查看端口,也可以看到合并起来的端口列表。
设置 IRF 域编号 因为这个网络里面有多个 IRF 堆叠,而且堆叠中至少应该使用一种 MAD 检测功能。
接下来会使用链路聚合,所以直接使用 LACP MAD 检测。
1 2 3 [SW1] irf domain 1 [SW1] save
检查堆叠 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 [SW1] display irf MemberID Role Priority CPU-Mac Description +1 Standby 32 60 cf-b73c-0104 --- *2 Master 1 60 cf-ba66-0204 --- -------------------------------------------------- * indicates the device is the master. + indicates the device through which the user logs in . The bridge MAC of the IRF is: 60 cf-b73c-0100 Auto upgrade : yes Mac persistent : 6 min Domain ID : 1 [SW1] display irf configuration MemberID NewID IRF-Port1 IRF-Port2 1 1 FortyGigE1/0 /53 disable FortyGigE1/0 /54 2 2 disable FortyGigE2/0 /53 FortyGigE2/0 /54 [SW1] display irf link Member 1 IRF Port Interface Status 1 FortyGigE1/0 /53 UP FortyGigE1/0 /54 UP 2 disable -- Member 2 IRF Port Interface Status 1 disable -- 2 FortyGigE2/0 /53 UP FortyGigE2/0 /54 UP
剩下的 SW2、A、B、C 的堆叠就不演示了。
链路聚合 链路聚合提高了连接带宽,也实现了线路的冗余。
如果存在交换机及与其连接的交换机,存在逻辑结构的上下级的关系的话,这是链路聚合组的编号分配约定。
1 2 3 1 、2 、3 是给下一层的交换机用的10 、11 、12 是给同一层的交换机用的20 、21 、22 是给上一层的交换机用的
核心层交换机 SW1 因为模拟器的交换机型号有限,没有大量 10G 口的型号,所以 核心层交换机 到 路由器 这部分,就先使用千兆口了。
物理连线 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 SW1 (Bridge-Aggregation 1 ) A (Bridge-Aggregation 20 ) Ten-GigabitEthernet 1 /0 /49 <---> Ten-GigabitEthernet 1 /0 /51 Ten-GigabitEthernet 2 /0 /49 <---> Ten-GigabitEthernet 2 /0 /51 SW1 (Bridge-Aggregation 2 ) B (Bridge-Aggregation 20 ) Ten-GigabitEthernet 1 /0 /50 <----> Ten-GigabitEthernet 1 /0 /51 Ten-GigabitEthernet 2 /0 /50 <----> Ten-GigabitEthernet 2 /0 /51 SW1 (Bridge-Aggregation 3 ) C (Bridge-Aggregation 20 ) Ten-GigabitEthernet 1 /0 /51 <----> Ten-GigabitEthernet 1 /0 /51 Ten-GigabitEthernet 2 /0 /51 <----> Ten-GigabitEthernet 2 /0 /51 SW1 (Bridge-Aggregation 10 ) SW2 (Bridge-Aggregation 10 ) Ten-GigabitEthernet 1 /0 /52 <----> Ten-GigabitEthernet 1 /0 /52 Ten-GigabitEthernet 2 /0 /52 <----> Ten-GigabitEthernet 2 /0 /52 SW1 (Bridge-Aggregation 20 ) RT1 (Bridge-Aggregation 1 ) GigabitEthernet 1 /0 /48 <----> GigabitEthernet 0 /0 /0 GigabitEthernet 2 /0 /48 <----> GigabitEthernet 0 /0 /1
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 <H3C>system-view [H3C] hostname SW1 [SW1] interface Bridge-Aggregation 1 [SW1-Bridge-Aggregation1] link-aggregation mode dynamic[SW1-Bridge-Aggregation1] mad enable[SW1-Bridge-Aggregation1] quit[SW1] interface range Ten-GigabitEthernet 1 /0 /49 Ten-GigabitEthernet 2 /0 /49 [SW1-if-range] port link-aggregation group 1 [SW1-if-range] quit[SW1] interface Bridge-Aggregation 2 [SW1-Bridge-Aggregation2] link-aggregation mode dynamic[SW1-Bridge-Aggregation2] mad enable[SW1-Bridge-Aggregation2] quit[SW1] interface range Ten-GigabitEthernet 1 /0 /50 Ten-GigabitEthernet 2 /0 /50 [SW1-if-range] port link-aggregation group 2 [SW1-if-range] quit [SW1] interface Bridge-Aggregation 3 [SW1-Bridge-Aggregation3] link-aggregation mode dynamic[SW1-Bridge-Aggregation3] mad enable[SW1-Bridge-Aggregation3] quit[SW1] interface range Ten-GigabitEthernet 1 /0 /51 Ten-GigabitEthernet 2 /0 /51 [SW1-if-range] port link-aggregation group 3 [SW1] interface Bridge-Aggregation 10 [SW1-Bridge-Aggregation10] link-aggregation mode dynamic[SW1-Bridge-Aggregation10] mad enable[SW1-Bridge-Aggregation10] quit[SW1] interface range Ten-GigabitEthernet 1 /0 /52 Ten-GigabitEthernet 2 /0 /52 [SW1-if-range] port link-aggregation group 10 [SW1-if-range] quit [SW1] interface Bridge-Aggregation 20 [SW1-Bridge-Aggregation20] link-aggregation mode dynamic[SW1-Bridge-Aggregation20] mad enable[SW1-Bridge-Aggregation20] quit[SW1] interface range GigabitEthernet 1 /0 /48 GigabitEthernet 2 /0 /48 [SW1-if-range] port link-aggregation group 20 [SW1-if-range] quit[SW1] save
检查链路聚合 1 2 3 4 5 6 7 8 9 10 11 12 13 <SW1>display interface Bridge-Aggregation brief Brief information on interfaces in bridge mode: Link: ADM - administratively down; Stby - standby Speed: (a) - auto Duplex: (a)/A - auto; H - half; F - full Type: A - access; T - trunk; H - hybrid Interface Link Speed Duplex Type PVID Description BAGG1 UP 20 G (a) F (a) A 1 BAGG2 UP 20 G (a) F (a) A 1 BAGG3 UP 20 G (a) F (a) A 1 BAGG10 UP 20 G (a) F (a) A 1 BAGG20 UP 2 G (a) F (a) A 1
汇聚层交换机 A 因为模拟器的交换机型号有限,没有大量 10G 口的型号,所以 汇聚层交换机 到 接入层交换机 这部分,就先使用千兆口了。
物理连线 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 A (Bridge-Aggregation 1 ) 101 (Bridge-Aggregation 1 ) GigabitEthernet 1 /0 /1 <----> GigabitEthernet 1 /0 /47 GigabitEthernet 2 /0 /1 <----> GigabitEthernet 1 /0 /48 A (Bridge-Aggregation 2 ) 102 (Bridge-Aggregation 1 ) GigabitEthernet 1 /0 /2 <----> GigabitEthernet 1 /0 /47 GigabitEthernet 2 /0 /2 <----> GigabitEthernet 1 /0 /48 A (Bridge-Aggregation 3 ) 103 (Bridge-Aggregation 1 ) GigabitEthernet 1 /0 /3 <----> GigabitEthernet 1 /0 /47 GigabitEthernet 2 /0 /3 <----> GigabitEthernet 1 /0 /48 A (Bridge-Aggregation 10 ) Ten-GigabitEthernet 1 /0 /49 <----> Ten-GigabitEthernet 2 /0 /49 <----> A (Bridge-Aggregation 11 ) B (Bridge-Aggregation 10 ) Ten-GigabitEthernet 1 /0 /50 <----> Ten-GigabitEthernet 1 /0 /49 Ten-GigabitEthernet 2 /0 /50 <----> Ten-GigabitEthernet 2 /0 /49 A (Bridge-Aggregation 20 ) SW1 (Bridge-Aggregation 1 ) Ten-GigabitEthernet 1 /0 /50 <----> Ten-GigabitEthernet 1 /0 /49 Ten-GigabitEthernet 2 /0 /50 <----> Ten-GigabitEthernet 2 /0 /49 A (Bridge-Aggregation 21 ) SW2 (Bridge-Aggregation 1 ) Ten-GigabitEthernet 1 /0 /51 <----> Ten-GigabitEthernet 1 /0 /49 Ten-GigabitEthernet 2 /0 /51 <----> Ten-GigabitEthernet 2 /0 /49
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 <H3C>system-view [H3C] hostname A[A] interface Bridge-Aggregation 1 [A-Bridge-Aggregation1] link-aggregation mode dynamic[A-Bridge-Aggregation1] mad enable[A-Bridge-Aggregation1] quit[A] interface range GigabitEthernet 1 /0 /1 GigabitEthernet 2 /0 /1 [A-if-range] port link-aggregation group 1 [A-if-range] quit [A] interface Bridge-Aggregation 2 [A-Bridge-Aggregation2] link-aggregation mode dynamic[A-Bridge-Aggregation2] mad enable[A-Bridge-Aggregation2] quit[A] interface range GigabitEthernet 1 /0 /2 GigabitEthernet 2 /0 /2 [A-if-range] port link-aggregation group 2 [A-if-range] quit[A] interface Bridge-Aggregation 3 [A-Bridge-Aggregation3] link-aggregation mode dynamic[A-Bridge-Aggregation3] mad enable[A-Bridge-Aggregation3] quit[A] interface range GigabitEthernet 1 /0 /3 GigabitEthernet 2 /0 /3 [A-if-range] port link-aggregation group 3 [A-if-range] quit [A] interface Bridge-Aggregation 10 [A-Bridge-Aggregation10] link-aggregation mode dynamic[A-Bridge-Aggregation10] mad enable[A-Bridge-Aggregation10] quit[A] interface range Ten-GigabitEthernet 1 /0 /49 Ten-GigabitEthernet 2 /0 /49 [A-if-range] port link-aggregation group 10 [A-if-range] quit [A] interface Bridge-Aggregation 11 [A-Bridge-Aggregation11] link-aggregation mode dynamic[A-Bridge-Aggregation11] mad enable[A-Bridge-Aggregation11] quit[A] interface range Ten-GigabitEthernet 1 /0 /50 Ten-GigabitEthernet 2 /0 /50 [A-if-range] port link-aggregation group 11 [A-if-range] quit[A] interface Bridge-Aggregation 20 [A-Bridge-Aggregation20] link-aggregation mode dynamic[A-Bridge-Aggregation20] mad enable[A-Bridge-Aggregation20] quit[A] interface range Ten-GigabitEthernet 1 /0 /51 Ten-GigabitEthernet 2 /0 /51 [A-if-range] port link-aggregation group 20 [A-if-range] quit [A] interface Bridge-Aggregation 21 [A-Bridge-Aggregation21] link-aggregation mode dynamic[A-Bridge-Aggregation21] mad enable[A-Bridge-Aggregation21] quit[A] interface range Ten-GigabitEthernet 1 /0 /52 Ten-GigabitEthernet 2 /0 /52 [A-if-range] port link-aggregation group 21 [A-if-range] quit[A] save
检查链路聚合 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <A>display interface Bridge-Aggregation brief Brief information on interfaces in bridge mode: Link: ADM - administratively down; Stby - standby Speed: (a) - auto Duplex: (a)/A - auto; H - half; F - full Type: A - access; T - trunk; H - hybrid Interface Link Speed Duplex Type PVID Description BAGG1 UP 2 G (a) F (a) A 1 BAGG2 UP 2 G (a) F (a) A 1 BAGG3 UP 2 G (a) F (a) A 1 BAGG10 DOWN auto A A 1 BAGG11 UP 20 G (a) F (a) A 1 BAGG20 UP 20 G (a) F (a) A 1 BAGG21 UP 20 G (a) F (a) A 1
接入层交换机 101 物理连线 1 2 3 101 (Bridge-Aggregation 1 ) A (Bridge-Aggregation 1 ) GigabitEthernet 1 /0 /47 <----> GigabitEthernet 1 /0 /1 GigabitEthernet 1 /0 /48 <----> GigabitEthernet 2 /0 /1
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <H3C>system-view [H3C] hostname 101 [101] interface Bridge-Aggregation 1 [101-Bridge-Aggregation1] link-aggregation mode dynamic[101-Bridge-Aggregation1] quit [101] interface range GigabitEthernet 1 /0 /47 to GigabitEthernet 1 /0 /48 [101-if-range] port link-aggregation group 1 [101-if-range] quit [101] save
检查链路聚合 1 2 3 4 5 6 7 8 9 [101] display interface Bridge-Aggregation briefBrief information on interfaces in bridge mode: Link: ADM - administratively down; Stby - standby Speed: (a) - auto Duplex: (a)/A - auto; H - half; F - full Type: A - access; T - trunk; H - hybrid Interface Link Speed Duplex Type PVID Description BAGG1 UP 2 G (a) F (a) A 1
路由器 RT1 物理连线 1 2 3 RT1 (Bridge-Aggregation 1 ) SW1 (Bridge-Aggregation 20 ) GigabitEthernet 0 /0 /0 <----> GigabitEthernet 1 /0 /48 GigabitEthernet 0 /0 /1 <----> GigabitEthernet 2 /0 /48
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <H3C>system-view [H3C] hostname RT1[RT1] interface Route-Aggregation 1 [RT1-Route-Aggregation1] link-aggregation mode dynamic[RT1-Route-Aggregation1] ip address 10.0 .0.2 24 [RT1-Route-Aggregation1] quit[RT1] interface range GigabitEthernet 0 /0 /0 GigabitEthernet 0 /0 /1 [RT1-if-range] port link-aggregation group 1 [RT1-if-range] quit[RT1] save
检查链路聚合 1 2 3 4 5 6 7 [RT1] display interface Route-Aggregation brief Brief information on interfaces in route mode: Link: ADM - administratively down; Stby - standby Protocol: (s) - spoofing Interface Link Protocol Primary IP Description RAGG1 UP UP --
其他设备就不演示了。
VLAN VLAN (虚拟局域网)把一个物理 LAN 划分成多个逻辑的 LAN
核心层交换机 SW1 配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 <SW1>system-view [SW1] vlan 101 to 103 201 to 203 301 to 303 10 [SW1] interface Bridge-Aggregation 1 [SW1-Bridge-Aggregation1] port link-type trunk[SW1-Bridge-Aggregation1] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [SW1-Bridge-Aggregation1] quit[SW1] interface Bridge-Aggregation 2 [SW1-Bridge-Aggregation2] port link-type trunk[SW1-Bridge-Aggregation2] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [SW1-Bridge-Aggregation2] quit[SW1] interface Bridge-Aggregation 3 [SW1-Bridge-Aggregation3] port link-type trunk[SW1-Bridge-Aggregation3] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [SW1-Bridge-Aggregation3] quit[SW1] interface Bridge-Aggregation 10 [SW1-Bridge-Aggregation10] port link-type trunk[SW1-Bridge-Aggregation10] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [SW1-Bridge-Aggregation10] quit[SW1] interface Bridge-Aggregation 20 [SW1-Bridge-Aggregation20] port link-type access [SW1-Bridge-Aggregation20] port access vlan 10 [SW1-Bridge-Aggregation20] quit[SW1] interface vlan-interface 101 [SW1-Vlan-interface101] ip address 10.1 .1.2 24 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 102 [SW1-Vlan-interface102] ip address 10.1 .2.2 24 [SW1-Vlan-interface102] quit[SW1] interface vlan-interface 103 [SW1-Vlan-interface103] ip address 10.1 .3.2 24 [SW1-Vlan-interface103] quit[SW1] interface vlan-interface 201 [SW1-Vlan-interface101] ip address 10.2 .1.2 24 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 202 [SW1-Vlan-interface102] ip address 10.2 .2.2 24 [SW1-Vlan-interface102] quit[SW1] interface vlan-interface 203 [SW1-Vlan-interface103] ip address 10.2 .3.2 24 [SW1-Vlan-interface103] quit[SW1] interface vlan-interface 301 [SW1-Vlan-interface101] ip address 10.3 .1.2 24 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 302 [SW1-Vlan-interface102] ip address 10.3 .2.2 24 [SW1-Vlan-interface102] quit[SW1] interface vlan-interface 303 [SW1-Vlan-interface103] ip address 10.3 .3.2 24 [SW1-Vlan-interface103] quit[SW1] interface vlan-interface 10 [SW1-Vlan-interface10] ip address 10.0 .0.10 24 [SW1-Vlan-interface10] quit[SW1] save
检查 VLAN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 [SW1] display port trunInterface PVID VLAN Passing BAGG1 1 1 , 101 -103 , 201 -203 , 301 -303 BAGG2 1 1 , 101 -103 , 201 -203 , 301 -303 BAGG3 1 1 , 101 -103 , 201 -203 , 301 -303 BAGG10 1 1 , 101 -103 , 201 -203 , 301 -303 XGE1/0 /49 1 1 , 101 -103 , 201 -203 , 301 -303 XGE1/0 /50 1 1 , 101 -103 , 201 -203 , 301 -303 XGE1/0 /51 1 1 , 101 -103 , 201 -203 , 301 -303 XGE1/0 /52 1 1 , 101 -103 , 201 -203 , 301 -303 XGE2/0 /49 1 1 , 101 -103 , 201 -203 , 301 -303 XGE2/0 /50 1 1 , 101 -103 , 201 -203 , 301 -303 XGE2/0 /51 1 1 , 101 -103 , 201 -203 , 301 -303 XGE2/0 /52 1 1 , 101 -103 , 201 -203 , 301 -303 [SW1] display interface Vlan-interface brief Brief information on interfaces in route mode: Link: ADM - administratively down; Stby - standby Protocol: (s) - spoofing Interface Link Protocol Primary IP Description Vlan101 UP UP 10.1 .1.1 Vlan102 UP UP 10.1 .2.1 Vlan103 UP UP 10.1 .3.1 Vlan201 UP UP 10.2 .1.1 Vlan202 UP UP 10.2 .2.1 Vlan203 UP UP 10.2 .3.1 Vlan301 UP UP 10.3 .1.1 Vlan302 UP UP 10.3 .2.1 Vlan303 UP UP 10.3 .3.1 [SW1] display interface Bridge-Aggregation brief Brief information on interfaces in bridge mode: Link: ADM - administratively down; Stby - standby Speed: (a) - auto Duplex: (a)/A - auto; H - half; F - full Type: A - access; T - trunk; H - hybrid Interface Link Speed Duplex Type PVID Description BAGG1 UP 20 G (a) F (a) T 1 BAGG2 UP 20 G (a) F (a) T 1 BAGG3 UP 20 G (a) F (a) T 1 BAGG10 UP 20 G (a) F (a) T 1 BAGG20 UP 2 G (a) F (a) A 1
汇聚层交换机 A 配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 <A>system-view [A] vlan 101 to 103 201 to 203 301 to 303 [A] interface Bridge-Aggregation 1 [A-Bridge-Aggregation1] port link-type access [A-Bridge-Aggregation1] port access vlan 101 [A-Bridge-Aggregation1] quit[A] interface Bridge-Aggregation 2 [A-Bridge-Aggregation2] port link-type access [A-Bridge-Aggregation2] port access vlan 102 [A-Bridge-Aggregation2] quit[A] interface Bridge-Aggregation 3 [A-Bridge-Aggregation3] port link-type access [A-Bridge-Aggregation3] port access vlan 103 [A-Bridge-Aggregation3] quit [A] interface Bridge-Aggregation 10 [A-Bridge-Aggregation10] port link-type trunk[A-Bridge-Aggregation10] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [A-Bridge-Aggregation10] quit[A] interface Bridge-Aggregation 11 [A-Bridge-Aggregation11] port link-type trunk[A-Bridge-Aggregation11] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [A-Bridge-Aggregation11] quit[A] interface Bridge-Aggregation 20 [A-Bridge-Aggregation20] port link-type trunk[A-Bridge-Aggregation20] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [A-Bridge-Aggregation20] quit[A] interface Bridge-Aggregation 21 [A-Bridge-Aggregation21] port link-type trunk[A-Bridge-Aggregation21] port trunk permit vlan 101 to 103 201 to 203 301 to 303 [A-Bridge-Aggregation21] quit[A] save
检查 VLAN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 [A] display port trunk Interface PVID VLAN Passing BAGG10 1 1 , 101 -103 BAGG11 1 1 , 101 -103 BAGG20 1 1 , 101 -103 BAGG21 1 1 , 101 -103 XGE1/0 /49 1 1 , 101 -103 XGE1/0 /50 1 1 , 101 -103 XGE1/0 /51 1 1 , 101 -103 XGE1/0 /52 1 1 , 101 -103 XGE2/0 /49 1 1 , 101 -103 XGE2/0 /50 1 1 , 101 -103 XGE2/0 /51 1 1 , 101 -103 XGE2/0 /52 1 1 , 101 -103 [A] display interface Bridge-Aggregation brief Brief information on interfaces in bridge mode: Link: ADM - administratively down; Stby - standby Speed: (a) - auto Duplex: (a)/A - auto; H - half; F - full Type: A - access; T - trunk; H - hybrid Interface Link Speed Duplex Type PVID Description BAGG1 UP 2 G (a) F (a) A 101 BAGG2 UP 2 G (a) F (a) A 102 BAGG3 UP 2 G (a) F (a) A 103 BAGG10 DOWN auto A T 1 BAGG11 UP 20 G (a) F (a) T 1 BAGG20 UP 20 G (a) F (a) T 1 BAGG21 UP 20 G (a) F (a) T 1
同样的,剩下的 SW2、B、C 不演示了。
MSTP 多生成树域,用于防止环路和 VLAN 的线路的负载均衡。
共用配置命令 所有交换机必须一样的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 <XXX>system-view [XXX] stp region-configuration[XXX-mst-region] region-name tjxLanMstp[XXX-mst-region] revision-level 0 [XXX-mst-region] instance 101 vlan 101 [XXX-mst-region] instance 102 vlan 102 [XXX-mst-region] instance 103 vlan 103 [XXX-mst-region] instance 201 vlan 201 [XXX-mst-region] instance 202 vlan 202 [XXX-mst-region] instance 203 vlan 203 [XXX-mst-region] instance 301 vlan 301 [XXX-mst-region] instance 302 vlan 302 [XXX-mst-region] instance 303 vlan 303 [XXX-mst-region] active region-configuration[XXX] save
检查 MST 域 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [XXX-mst-region] check region-configuration Admin Configuration Format selector : 0 Region name : tjxLanMstp Revision level : 0 Configuration digest : 0 x15ad9f356fc65725363daf259ad33c8b Instance VLANs Mapped 0 1 to 100 , 104 to 200 , 204 to 300 , 304 to 4094 101 101 102 102 103 103 201 201 202 202 203 203 301 301 302 302 303 303
核心层交换机 SW1 根桥是 MSTP 网络的逻辑中心,用来确定生成树的最底设备。
这里为了体验差异性和实际应用中的负载均衡的需求。
A,B 楼的 VLAN,也就是 101-103,201-203,将以 SW1 做为 根桥
C 楼的 VLAN,301-303,将以 SW2 做为 根桥
配置命令 1 2 3 4 5 6 7 8 9 10 11 <SW1>system-view [SW1] stp instance 0 101 to 103 201 to 203 root primary [SW1] stp instance 301 to 303 root secondary [SW1] save
核心层交换机 SW2 配置命令 1 2 3 4 5 6 7 8 9 10 11 <SW2>system-view [SW2] stp instance 301 to 303 root primary[SW2] stp instance 0 101 to 103 201 to 203 root secondary[SW2] save
检查生成树 这里以 汇聚层交换机 A 举例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 [A] display stp brief MST ID Port Role STP State Protection 0 Bridge-Aggregation1 DESI FORWARDING NONE 0 Bridge-Aggregation2 DESI FORWARDING NONE 0 Bridge-Aggregation3 DESI FORWARDING NONE 0 Bridge-Aggregation11 DESI FORWARDING NONE 0 Bridge-Aggregation20 ROOT FORWARDING NONE 0 Bridge-Aggregation21 ALTE DISCARDING NONE 101 Bridge-Aggregation1 DESI FORWARDING NONE 101 Bridge-Aggregation11 DESI FORWARDING NONE 101 Bridge-Aggregation20 ROOT FORWARDING NONE 101 Bridge-Aggregation21 ALTE DISCARDING NONE 102 Bridge-Aggregation2 DESI FORWARDING NONE 102 Bridge-Aggregation11 DESI FORWARDING NONE 102 Bridge-Aggregation20 ROOT FORWARDING NONE 102 Bridge-Aggregation21 ALTE DISCARDING NONE 103 Bridge-Aggregation3 DESI FORWARDING NONE 103 Bridge-Aggregation11 DESI FORWARDING NONE 103 Bridge-Aggregation20 ROOT FORWARDING NONE 103 Bridge-Aggregation21 ALTE DISCARDING NONE ......
VRRP 核心层交换机 SW1 配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 [SW1] track 1 interface vlan-interface 10 [SW1-track-1] quit[SW1] interface vlan-interface 101 [SW1-Vlan-interface101] vrrp vrid 1 virtual-ip 10.1 .1.1 [SW1-Vlan-interface101] vrrp vrid 1 priority 110 [SW1-Vlan-interface101] vrrp vrid 1 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 1 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 102 [SW1-Vlan-interface101] vrrp vrid 2 virtual-ip 10.1 .2.1 [SW1-Vlan-interface101] vrrp vrid 2 priority 110 [SW1-Vlan-interface101] vrrp vrid 2 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 2 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 103 [SW1-Vlan-interface101] vrrp vrid 3 virtual-ip 10.1 .3.1 [SW1-Vlan-interface101] vrrp vrid 3 priority 110 [SW1-Vlan-interface101] vrrp vrid 3 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 3 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 201 [SW1-Vlan-interface101] vrrp vrid 4 virtual-ip 10.2 .1.1 [SW1-Vlan-interface101] vrrp vrid 4 priority 110 [SW1-Vlan-interface101] vrrp vrid 4 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 4 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 202 [SW1-Vlan-interface101] vrrp vrid 5 virtual-ip 10.2 .2.1 [SW1-Vlan-interface101] vrrp vrid 5 priority 110 [SW1-Vlan-interface101] vrrp vrid 5 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 5 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 203 [SW1-Vlan-interface101] vrrp vrid 6 virtual-ip 10.2 .3.1 [SW1-Vlan-interface101] vrrp vrid 6 priority 110 [SW1-Vlan-interface101] vrrp vrid 6 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 6 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 301 [SW1-Vlan-interface101] vrrp vrid 7 virtual-ip 10.3 .1.1 [SW1-Vlan-interface101] vrrp vrid 7 priority 100 [SW1-Vlan-interface101] vrrp vrid 7 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 7 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 302 [SW1-Vlan-interface101] vrrp vrid 8 virtual-ip 10.3 .2.1 [SW1-Vlan-interface101] vrrp vrid 8 priority 100 [SW1-Vlan-interface101] vrrp vrid 8 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 8 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] interface vlan-interface 303 [SW1-Vlan-interface101] vrrp vrid 9 virtual-ip 10.3 .3.1 [SW1-Vlan-interface101] vrrp vrid 9 priority 100 [SW1-Vlan-interface101] vrrp vrid 9 preempt-mode delay 3000 [SW1-Vlan-interface101] vrrp vrid 9 track 1 priority reduced 20 [SW1-Vlan-interface101] quit[SW1] save
检查 VRRP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [SW1] display vrrpIPv4 Virtual Router Information: Running mode : Standard Total number of virtual routers : 9 Interface VRID State Running Adver Auth Virtual Pri Timer Type IP ---------------------------------------------------------------------------- Vlan101 1 Master 110 100 Not supported 10.1 .1.1 Vlan102 2 Master 110 100 Not supported 10.1 .2.1 Vlan103 3 Master 110 100 Not supported 10.1 .3.1 Vlan201 4 Master 110 100 Not supported 10.2 .1.1 Vlan202 5 Master 110 100 Not supported 10.2 .2.1 Vlan203 6 Master 110 100 Not supported 10.2 .3.1 Vlan301 7 Backup 100 100 Not supported 10.3 .1.1 Vlan302 8 Backup 100 100 Not supported 10.3 .2.1 Vlan303 9 Backup 100 100 Not supported 10.3 .3.1 [SW1] display vrrp verboseIPv4 Virtual Router Information: Running mode : Standard Total number of virtual routers : 9 Interface Vlan-interface101 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 3000 Auth Type : Not supported Version : 3 Virtual IP : 10.1 .1.1 Virtual MAC : 0000 -5 e00-0101 Master IP : 10.1 .1.2 ...... Interface Vlan-interface301 VRID : 7 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 3000 Become Master : 0ms left Auth Type : Not supported Version : 3 Virtual IP : 10.3 .1.1 Virtual MAC : 0000 -5 e00-0107 Master IP : 10.3 .1.3 ......
核心层交换机 SW2 配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 [SW2] track 1 interface vlan-interface 10 [SW2-track-1] quit[SW2] interface vlan-interface 101 [SW2-Vlan-interface101] vrrp vrid 1 virtual-ip 10.1 .1.1 [SW2-Vlan-interface101] vrrp vrid 1 priority 100 [SW2-Vlan-interface101] vrrp vrid 1 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 1 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 102 [SW2-Vlan-interface101] vrrp vrid 2 virtual-ip 10.1 .2.1 [SW2-Vlan-interface101] vrrp vrid 2 priority 100 [SW2-Vlan-interface101] vrrp vrid 2 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 2 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 103 [SW2-Vlan-interface101] vrrp vrid 3 virtual-ip 10.1 .3.1 [SW2-Vlan-interface101] vrrp vrid 3 priority 100 [SW2-Vlan-interface101] vrrp vrid 3 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 3 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 201 [SW2-Vlan-interface101] vrrp vrid 4 virtual-ip 10.2 .1.1 [SW2-Vlan-interface101] vrrp vrid 4 priority 100 [SW2-Vlan-interface101] vrrp vrid 4 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 4 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 202 [SW2-Vlan-interface101] vrrp vrid 5 virtual-ip 10.2 .2.1 [SW2-Vlan-interface101] vrrp vrid 5 priority 100 [SW2-Vlan-interface101] vrrp vrid 5 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 5 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 203 [SW2-Vlan-interface101] vrrp vrid 6 virtual-ip 10.2 .3.1 [SW2-Vlan-interface101] vrrp vrid 6 priority 100 [SW2-Vlan-interface101] vrrp vrid 6 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 6 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 301 [SW2-Vlan-interface101] vrrp vrid 7 virtual-ip 10.3 .1.1 [SW2-Vlan-interface101] vrrp vrid 7 priority 110 [SW2-Vlan-interface101] vrrp vrid 7 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 7 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 302 [SW2-Vlan-interface101] vrrp vrid 8 virtual-ip 10.3 .2.1 [SW2-Vlan-interface101] vrrp vrid 8 priority 110 [SW2-Vlan-interface101] vrrp vrid 8 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 8 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] interface vlan-interface 303 [SW2-Vlan-interface101] vrrp vrid 9 virtual-ip 10.3 .3.1 [SW2-Vlan-interface101] vrrp vrid 9 priority 110 [SW2-Vlan-interface101] vrrp vrid 9 preempt-mode delay 3000 [SW2-Vlan-interface101] vrrp vrid 9 track 1 priority reduced 20 [SW2-Vlan-interface101] quit[SW2] save
检查 VRRP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 [SW2] display vrrp IPv4 Virtual Router Information: Running mode : Standard Total number of virtual routers : 9 Interface VRID State Running Adver Auth Virtual Pri Timer Type IP ---------------------------------------------------------------------------- Vlan101 1 Backup 100 100 Not supported 10.1 .1.1 Vlan102 2 Backup 100 100 Not supported 10.1 .2.1 Vlan103 3 Backup 100 100 Not supported 10.1 .3.1 Vlan201 4 Backup 100 100 Not supported 10.2 .1.1 Vlan202 5 Backup 100 100 Not supported 10.2 .2.1 Vlan203 6 Backup 100 100 Not supported 10.2 .3.1 Vlan301 7 Master 110 100 Not supported 10.3 .1.1 Vlan302 8 Master 110 100 Not supported 10.3 .2.1 Vlan303 9 Master 110 100 Not supported 10.3 .3.1 [SW2] display vrrp verboseIPv4 Virtual Router Information: Running mode : Standard Total number of virtual routers : 9 ...... Interface Vlan-interface103 VRID : 3 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 3000 Become Master : 0ms left Auth Type : Not supported Version : 3 Virtual IP : 10.1 .3.1 Virtual MAC : 0000 -5 e00-0103 Master IP : 10.1 .3.2 ...... Interface Vlan-interface303 VRID : 9 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 3000 Auth Type : Not supported Version : 3 Virtual IP : 10.3 .3.1 Virtual MAC : 0000 -5 e00-0109 Master IP : 10.3 .3.3
路由器 RT1(只做演示) 路由器也用 VRRP 的的话,这个划分分流有点麻烦,所以后面的演示路由器没有使用 VRRP。
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <RT1>system-view [RT1] track 1 interface GigabitEthernet 0 /0 /10 [RT1-track-1] quit[RT1] interface Route-Aggregation 1 [RT1-Route-Aggregation1] ip address 10.0 .0.2 24 [RT1-Route-Aggregation1] vrrp vrid 10 virtual-ip 10.0 .0.1 [RT1-Route-Aggregation1] vrrp vrid 10 priority 110 [RT1-Route-Aggregation1] vrrp vrid 10 preempt-mode delay 3000 [RT1-Route-Aggregation1] vrrp vrid 10 track 1 priority reduced 20 [RT1-Route-Aggregation1] quit [RT1] save
检查 VRRP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [RT1] display vrrp IPv4 virtual router information: Running mode : Standard Enhanced sending of gratuitous ARP packets : Disabled Total number of virtual routers : 1 Interface VRID State Running Adver Auth Virtual pri timer (cs) type IP --------------------------------------------------------------------- RAGG1 1 Master 110 100 None 10.0 .0.1 [RT1] display vrrp verboseIPv4 virtual router information: Running mode : Standard Enhanced sending of gratuitous ARP packets : Disabled Total number of virtual routers : 1 Interface Route-Aggregation1 VRID : 1 Adver timer : 100 centiseconds Admin status : Up State : Master Config pri : 110 Running pri : 110 Preempt mode : Yes Delay time : 3000 centiseconds Auth type : None Version : 3 Virtual IP : 10.0 .0.1 Virtual MAC : 0000 -5 e00-0101 Master IP : 10.0 .0.2 Backup ARP : Disabled VRRP track information: Track object : 1 State : Positive Pri reduced : 20
路由器 RT2(只做演示) 路由器也用 VRRP 的的话,这个划分分流有点麻烦,所以后面的演示路由器没有使用 VRRP。
配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <RT2>system-view [RT2] track 1 interface GigabitEthernet 0 /0 /10 [RT2-track-1] quit[RT2] interface Route-Aggregation 1 [RT2-Route-Aggregation1] ip address 10.0 .0.3 24 [RT2-Route-Aggregation1] vrrp vrid 1 virtual-ip 10.0 .0.1 [RT2-Route-Aggregation1] vrrp vrid 1 priority 100 [RT2-Route-Aggregation1] vrrp vrid 1 preempt-mode delay 3000 [RT2-Route-Aggregation1] vrrp vrid 1 track 1 priority reduced 20 [RT2-Route-Aggregation1] quit [RT2] save
检查 VRRP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [RT1] display vrrp verboseIPv4 virtual router information: Running mode : Load balance Total number of virtual routers : 1 Interface Route-Aggregation1 VRID : 1 Adver timer : 100 centiseconds Admin status : Up State : Master Config pri : 110 Running pri : 110 Preempt mode : Yes Delay time : 5000 centiseconds Auth type : None Version : 3 Virtual IP : 10.0 .0.1 Member IP list : 10.0 .0.2 (Local, Master) Forwarder information: 1 Forwarders 1 Active Config weight : 255 Running weight : 255 Forwarder 01 State : Active Virtual MAC : 000 f-e2ff-0011 (Owner) Owner ID : 6241 -4392 -1402 Priority : 255 Active : Local Forwarder weight track information: Track object : 1 State : Positive Weight reduced : 250
OSPF OSPF(开放最短路径优先)动态路由协议,能动态生成路由。
在复杂的网络结构中,相对于繁琐人工静态配置路由,能降低出错率、减少工作量。
但是考虑将 AB 和 C 的分流倾向,还是部分使用了静态路由为方便实现。
路由器 RT1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 <RT1>system-view [RT1] ip route-static 0.0 .0.0 0.0 .0.0 200.200 .200.1 [RT1] router id 1.1 .1.1 [RT1] ospf 1 [RT1-ospf-1] area 0 [RT1-ospf-1-area-0.0.0.0] network 10.0 .0.0 0.0 .0.255 [RT1] save
路由器 RT2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 <RT2>system-view [RT1] ip route-static 0.0 .0.0 0.0 .0.0 100.100 .100.1 [RT2] router id 2.2 .2.2 [RT2] ospf 1 [RT2-ospf-1] area 0 [RT2-ospf-1-area-0.0.0.0] network 10.0 .0.0 0.0 .0.255 [RT2] save
核心层交换机 SW1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 <SW1>system-view [SW1] ip route-static 0.0 .0.0 0.0 .0.0 10.0 .0.2 [SW1] router id 3.3 .3.3 [SW1-ospf-1] area 0 [SW1-ospf-1-area-0.0.0.0] network 10.0 .0.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.1 .1.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.1 .2.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.1 .3.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.2 .1.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.2 .2.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.2 .3.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.3 .1.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.3 .2.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] network 10.3 .3.0 0.0 .0.255 [SW1-ospf-1-area-0.0.0.0] quit[SW1-ospf-1] quit[SW1] interface Vlan-interface 301 [SW1-Vlan-interface301] ospf cost 10 [SW1-Vlan-interface301] interface Vlan-interface 302 [SW1-Vlan-interface302] ospf cost 10 [SW1-Vlan-interface302] interface Vlan-interface 303 [SW1-Vlan-interface303] ospf cost 10 [SW1-Vlan-interface303] quit [SW1] save
核心层交换机 SW2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 <SW2>system-view [SW2] ip route-static 0.0 .0.0 0.0 .0.0 10.0 .0.3 [SW2] router id 4.4 .4.4 [SW2-ospf-1] area 0 [SW2-ospf-1-area-0.0.0.0] network 10.0 .0.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.1 .1.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.1 .2.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.1 .3.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.2 .1.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.2 .2.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.2 .3.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.3 .1.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.3 .2.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] network 10.3 .3.0 0.0 .0.255 [SW2-ospf-1-area-0.0.0.0] quit[SW2-ospf-1] quit[SW2] interface Vlan-interface 101 [SW2-Vlan-interface101] ospf cost 10 [SW2-Vlan-interface101] interface Vlan-interface 102 [SW2-Vlan-interface102] ospf cost 10 [SW2-Vlan-interface102] interface Vlan-interface 103 [SW2-Vlan-interface103] ospf cost 10 [SW2-Vlan-interface102] interface Vlan-interface 201 [SW2-Vlan-interface201] ospf cost 10 [SW2-Vlan-interface201] interface Vlan-interface 202 [SW2-Vlan-interface202] ospf cost 10 [SW2-Vlan-interface202] interface Vlan-interface 203 [SW2-Vlan-interface203] ospf cost 10 [SW2-Vlan-interface203] quit[SW2] save
检查相关 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 [SW2] display ospf interface OSPF Process 1 with Router ID 4.4 .4.4 Interfaces Area: 0.0 .0.0 IP Address Type State Cost Pri DR BDR 10.1 .1.3 Broadcast BDR 10 1 10.1 .1.2 10.1 .1.3 10.1 .2.3 Broadcast BDR 10 1 10.1 .2.2 10.1 .2.3 10.1 .3.3 Broadcast BDR 10 1 10.1 .3.2 10.1 .3.3 10.2 .1.3 Broadcast BDR 10 1 10.2 .1.2 10.2 .1.3 10.2 .2.3 Broadcast BDR 10 1 10.2 .2.2 10.2 .2.3 10.2 .3.3 Broadcast BDR 10 1 10.2 .3.2 10.2 .3.3 10.3 .1.3 Broadcast BDR 1 1 10.3 .1.2 10.3 .1.3 10.3 .2.3 Broadcast BDR 1 1 10.3 .2.2 10.3 .2.3 10.3 .3.3 Broadcast BDR 1 1 10.3 .3.2 10.3 .3.3 10.0 .0.11 Broadcast DROther 1 1 10.0 .0.10 10.0 .0.2 [RT1] display ospf peer OSPF Process 1 with Router ID 1.1 .1.1 Neighbor Brief Information Area: 0.0 .0.0 Router ID Address Pri Dead-Time State Interface 2.2 .2.2 10.0 .0.3 1 35 Full/DROther RAGG1 3.3 .3.3 10.0 .0.10 1 35 Full/DR RAGG1 4.4 .4.4 10.0 .0.11 1 32 Full/DROther RAGG1 [RT1] display ospf peer verbose OSPF Process 1 with Router ID 1.1 .1.1 Neighbors Area 0.0 .0.0 interface 10.0 .0.2 (Route-Aggregation1)'s neighbors Router ID: 2.2.2.2 Address: 10.0.0.3 GR state: Normal State: Full Mode: Nbr is master Priority: 1 DR: 10.0.0.10 BDR: 10.0.0.2 MTU: 0 Options is 0x42 (-|O|-|-|-|-|E|-) Dead timer due in 33 sec Neighbor is up for 02:57:02 Authentication sequence: [ 0 ] Neighbor state change count: 10 BFD status: Disabled Router ID: 3.3.3.3 Address: 10.0.0.10 GR state: Normal State: Full Mode: Nbr is master Priority: 1 DR: 10.0.0.10 BDR: 10.0.0.2 MTU: 0 Options is 0x42 (-|O|-|-|-|-|E|-) Dead timer due in 33 sec Neighbor is up for 04:30:02 Authentication sequence: [ 0 ] Neighbor state change count: 6 BFD status: Disabled // RT1 查看路由表 [RT1]display ip routing-table Destinations : 20 Routes : 20 Destination/Mask Proto Pre Cost NextHop Interface 0.0.0.0/0 Static 60 0 200.200.200.1 GE0/0/10 10.0.0.0/24 Direct 0 0 10.0.0.2 RAGG1 10.0.0.2/32 Direct 0 0 127.0.0.1 RAGG1 10.0.0.255/32 Direct 0 0 10.0.0.2 RAGG1 10.1.1.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.1.2.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.1.3.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.2.1.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.2.2.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.2.3.0/24 O_INTRA 10 2 10.0.0.10 RAGG1 10.3.1.0/24 O_INTRA 10 2 10.0.0.11 RAGG1 // 下一跳地址可以看到这里走的是 SW2 10.3.2.0/24 O_INTRA 10 2 10.0.0.11 RAGG1 // 下一跳地址可以看到这里走的是 SW2 10.3.3.0/24 O_INTRA 10 2 10.0.0.11 RAGG1 // 下一跳地址可以看到这里走的是 SW2 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0 200.200.200.0/24 Direct 0 0 200.200.200.200 GE0/0/10 200.200.200.200/32 Direct 0 0 127.0.0.1 GE0/0/10 200.200.200.255/32 Direct 0 0 200.200.200.200 GE0/0/10 255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
ACL VLAN 之间的访问控制
ACL 是生效在接口的,但因为冗余性的设计,这个网络有非常多的接口。
综合考虑,还是直接在 VLAN 接口网关上操作比较好,但是因为 VRRP 的原因,有两份 VLAN 接口网关。
虽然做了分流,你只在分流的网关上做对应的规则也能生效,但是其中一个挂了的话,流量会迁移到剩下那一台。
所以,两台核心交换机上的 VLAN 接口网关都要做同样的配置,这里只演示一台的操作。
核心层交换机 SW1 配置命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 <SW1>system-view [SW1] acl advanced name AclVlan102[SW1-acl-ipv4-adv-AclVlan102] rule permit ip source any ip destination 10.1 .1.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule permit ip source any ip destination 10.1 .2.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.1 .3.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.2 .1.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.2 .2.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.2 .3.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.3 .1.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.3 .2.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] rule deny ip source any ip destination 10.3 .3.0 0.0 .0.255 [SW1-acl-ipv4-adv-AclVlan102] quit[SW1] interface Vlan-interface 102 [SW1-Vlan-interface102] packet-filter name AclVlan102 inbound[SW1-Vlan-interface102] quit...... [SW1] save
检查 ACL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 [SW1] display acl allAdvanced IPv4 ACL named AclVlan101, 0 rule, ACL's step is 5, start ID is 0 Advanced IPv4 ACL named AclVlan102, 9 rules, ACL' s step is 5 , start ID is 0 rule 0 permit ip destination 10.1 .1.0 0.0 .0.255 (5 times matched) rule 5 permit ip destination 10.1 .2.0 0.0 .0.255 (11 times matched) rule 10 deny ip destination 10.1 .3.0 0.0 .0.255 (5 times matched) rule 15 deny ip destination 10.2 .1.0 0.0 .0.255 rule 20 deny ip destination 10.2 .2.0 0.0 .0.255 rule 25 deny ip destination 10.2 .3.0 0.0 .0.255 rule 30 deny ip destination 10.3 .1.0 0.0 .0.255 rule 35 deny ip destination 10.3 .2.0 0.0 .0.255 rule 40 deny ip destination 10.3 .3.0 0.0 .0.255 ...... [SW1] display packet-filter interface Interface: Vlan-interface102 Inbound policy: IPv4 ACL AclVlan102 ...... 10.1 .2.10 > ping 10.1 .1.10 84 bytes from 10.1 .1.10 icmp_seq=1 ttl=63 time=1.644 ms84 bytes from 10.1 .1.10 icmp_seq=2 ttl=63 time=1.656 ms...... 10.1 .2.10 > ping 150.150 .150.150 84 bytes from 150.150 .150.150 icmp_seq=1 ttl=61 time=2.672 ms84 bytes from 150.150 .150.150 icmp_seq=2 ttl=61 time=2.196 ms...... 10.1 .2.10 > ping 10.1 .3.10 10.1 .3.10 icmp_seq=1 timeout10.1 .3.10 icmp_seq=2 timeout......
核心层交换机 SW2 也要做同样的操作。
总结 有些技术是互相冲突,更精细控制往往要放弃一部分便利性,这些网络技术还是要看实际情况来决定如何组合使用。
本次用到的 HCL 模拟器:HCL_Setup_V5.10.3 - 新华三集团 - H3C
本次的 HCL 工程文件:三层网络架构模拟 - tjxwork
原文作者:tjxwork 原文链接:https://www.tjxblog.com/blog/2024-0002 发布时间:2024-06-21