最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

华为三层交换机配置总结

IT圈 admin 34浏览 0评论

2023年12月8日发(作者:弓兰娜)

一、 基本命令: ....................................................................................................... 1

保存当前配置:save [ configuration-file ] ...................................................................... 1

清除当前配置:reset saved-configuration ............................................. 1

重启当前设备:reboot ........................................................................... 1

取消单条配置:undo +要取消的配置命令 .................................................................... 1

[SwitchA-Ethernet0/3]undo port link-type trunk ...................................................... 1

显示命令: ....................................................................................................................... 2

配置静态路由:ip route-static 目标网段 子网掩码 下一跳地址 ........................... 2

设置trunk: ..................................................................................................................... 2

telnet登陆设置: ............................................................................................................. 2

二、配置实例 ........................................................................................................................... 3

1.实例说明 ........................................................................................................................ 3

2拓扑图如下: ................................................................................................................ 4

交换机名为zuo的配置:(华为5328设置) ....................................................... 4

9300的配置: .......................................................................................................... 8

交换机you的设置:(华为5328设置) ............................................................... 9

4.测试 .............................................................................................................................. 12

(1)vrrp正常状态下测试 ........................................................................................ 12

(2)只断a,查看俩个交换机vrrp状态并测试pc1如何到pc2 ............................. 13

(3)只断c,查看vrrp状态并测试pc1如何到pc2 ................................................. 16

一、 基本命令:

保存当前配置:save [ configuration-file ]

清除当前配置:reset saved-configuration

重启当前设备:reboot

取消单条配置:undo +要取消的配置命令

例:[SwitchA-Ethernet0/3]port link-type trunk

[SwitchA-Ethernet0/3]undo port link-type trunk 显示命令:

display interface brief ;查看端口状态

display current-configuration ;显示当前设备的所有配置信息

配置静态路由:ip route-static 目标网段 子网掩码 下一跳地址

例:ip route-static 192.168.1.0 255.255.255.0 192.168.1.2

例:ip route-static 0.0.0.0 0.0.0.0 172.16.1.2

设置trunk:

[core s9303-1]interface GigabitEthernet 1/0/5

[core s9303-1-GigabitEthernet1/0/5]combo copper ;9300端口默认是光模式,改为电模式

[core s9303-1-GigabitEthernet1/0/5]port link-type trunk

---------------------------------------------------------------------------------------

[huawei5328]interface GigabitEthernet 0/0/2

[huawei5328-GigabitEthernet0/0/2]undo port default vlan

[huawei5328-GigabitEthernet0/0/2]port link-type trunk

[huawei5328-GigabitEthernet0/0/2]port trunk allow-pass vlan all; 允许所有的vlan从g 0/0/2端口透传通过,也可以指定具体的vlan值

telnet登陆设置:

1.

2.

3.

4.

5.

6.

7.

8.

system-view

[S9300-A] vlan 60

[S9300-A-vlan2] quit

[S9300-A] interface GigabitEthernet 1/0/1

[S9300-A-GigabitEthernet1/0/1] combo copper

[S9300-A-GigabitEthernet1/0/1] port link-type access

[S9303-A-GigabitEthernet1/0/1]port default vlan 60

[S9300-A-GigabitEthernet1/0/1] quit 9. [S9300-A] interface vlanif 60

10. [S9300-A-Vlanif60] ip address 10.10.10.8 255.255.255.0

11. [S9300-A-Vlanif60] quit

12. [S9300-A]

13. [S9300-A] user-interface vty 0 4

14.[S9300-A-ui-vty0-4] authentication-mode password

15.[S9300-A-ui-vty0-4] set authentication password simple 123456

16. [S9300-A-ui-vty0-4] quit

17. [S9300-A]

二、配置实例

1.实例说明

此实例测试华为三层交换机vrrp以及rip路由协议的启用, 2拓扑图如下:

Ip:100.100.100.2网关:100.100.100.1Pc2端口0Vlan100Ip:100.100.100.1端口6Vlan60IP:60.60.609300端口5Vlan50IP:50.50.50.2c端口5Vlan50IP:50.50.50.1端口6

Vlan60Ip:60.60.60.1d端口20Vlan20Ip:20.20.20.1心跳线端口20Vlan20Ip:20.20.20.2端口12ZuoVlan1Ip:10.10.10.1虚ip:组1:10.10.10.111组2:10.10.10.112you端口12Vlan1Ip:10.10.10.2虚ip:b组1:10.10.10.111组2:10.10.10.112a接入层交换机Ip:10.10.10.9Pc13.配置命令

交换机名为zuo的配置:(华为5328设置) system-view

[Quidway]sysname zuo ;给设备命名

[zuo]vlan 20 ;创建vlan

[zuo-vlan20]port GigabitEthernet 0/0/20 ;进入端口模式

[zuo-vlan20]quit

[zuo]interface Vlanif 20 ;进入vlanif接口模式

[zuo-Vlanif20]ip address 20.20.20.1 24 ;添加ip

[zuo-Vlanif20]quit

[zuo]display ip int brief ;显示接口ip配置

[zuo]interface Vlanif 1

[zuo-Vlanif1]ip address 10.10.10.1 24

[zuo-Vlanif1]quit

[zuo]vlan 60

[zuo-vlan60]port GigabitEthernet 0/0/6 ;把端口加到vlan中

[zuo-vlan60]quit

[zuo]interface Vlanif 60

[zuo-Vlanif60]ip address 60.60.60.1 24

[zuo-Vlanif60]quit

[zuo]interface Vlanif 1

[zuo-Vlanif1]vrrp vrid 1 virtual-ip 10.10.10.111

[zuo-Vlanif1]vrrp vrid 1 priority 120 ;设置vrrp组1的优先级

[zuo-Vlanif1]vrrp vrid 1 preempt-mode timer delay 20 ;

[zuo-Vlanif1]vrrp vrid 2 virtual-ip 10.10.10.112

[zuo-Vlanif1]display vrrp ;显示vrrp配置状态

[zuo]rip ;启用rip动态路由协议

[zuo-rip-1] version 2

[zuo-rip-1]network 10.0.0.0

[zuo-rip-1]network 20.0.0.0

[zuo-rip-1]network 60.0.0.0

[zuo-rip-1]quit [zuo-Vlanif1]display ip routing-table ;查看路由表

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

Destinations : 10 Routes : 12

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.10.10.0/24 Direct 0 0 D 10.10.10.1 Vlanif1

10.10.10.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

20.20.20.0/24 Direct 0 0 D 20.20.20.1 Vlanif20

20.20.20.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

50.50.50.0/24 RIP 100 1 D 20.20.20.2 Vlanif20

RIP 100 1 D 10.10.10.2 Vlanif1

RIP 100 1 D 60.60.60.2 Vlanif60

60.60.60.0/24 Direct 0 0 D 60.60.60.1 Vlanif60

60.60.60.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

100.100.100.0/24 RIP 100 1 D 60.60.60.2 Vlanif60

127.0.0.0/8 Direct 0 0 D 127.0.0.1

InLoopBack0

127.0.0.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

display vrrp ;显示vrrp状态

Vlanif1 | Virtual Router 1 state : Master

Virtual IP : 10.10.10.111

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Backup

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

9300的配置:

system-view

[core s9303-1]vlan 60

[core s9303-1-vlan60]quit

[core s9303-1]vlan 50

[core s9303-1-vlan50]quit

[core s9303-1]interface GigabitEthernet 1/0/6

[core s9303-1-GigabitEthernet1/0/6]combo copper ;9300端口默认是光模式,改成电模式

[core s9303-1-GigabitEthernet1/0/6]port link-type access ;设接口类型为接入模式

[core s9303-1-GigabitEthernet1/0/6]port default vlan 60 ;把端口添加到vlan60中

[core s9303-1-GigabitEthernet1/0/6]quit

[core s9303-1]display vlan 60 ;查看vlan60的配置

[core s9303-1]interface GigabitEthernet 1/0/5

[core s9303-1-GigabitEthernet1/0/5]combo copper

[core s9303-1-GigabitEthernet1/0/5]port default vlan 50

[core s9303-1-GigabitEthernet1/0/5]quit

[core s9303-1]interface Vlanif 50

[core s9303-1-Vlanif50]ip address 50.50.50.2 24

[core s9303-1-Vlanif50]quit

[core s9303-1]interface Vlanif 60

[core s9303-1-Vlanif60]ip address 60.60.60.2 24

[core s9303-1-Vlanif60]quit

[core s9303-1]display vlan 50

VLAN ID Type Status MAC Learning Broadcast/Multicast/Unicast

Property

--------------------------------------------------------------------------------

50 common enable enable forward forward forward default

----------------

Untagged Port: GigabitEthernet1/0/5

----------------

Tagged Port: GigabitEthernet1/0/1

----------------

Interface Physical

GigabitEthernet1/0/1 DOWN

GigabitEthernet1/0/5 UP

[core s9303-1]interface GigabitEthernet 1/0/0

[core s9303-1-GigabitEthernet1/0/0]port default vlan 100

[core s9303-1-GigabitEthernet1/0/0]quit

[core s9303-1]rip

[core s9303-1-rip-1]network 50.0.0.0

[core s9303-1-rip-1]network 60.0.0.0

[core s9303-1-rip-1]network 100.0.0.0

-------------------------------------------------------------------------------------------------------

交换机you的设置:(华为5328设置)

system-view

[you]vlan 20

[you-vlan20]port GigabitEthernet 0/0/20 ;把端口加到vlan中

[you-vlan20]quit

[you]interface Vlanif 20

[you-Vlanif20]ip address 20.20.20.2 24

[you-Vlanif20]quit

[you]vlan 50 [you-vlan50]port GigabitEthernet 0/0/5

[you-vlan50]quit

[you]interface Vlanif 50

[you-Vlanif50]ip address 50.50.50.1 24

[you-Vlanif50]quit

[you]interface Vlanif 1

[you-Vlanif1]ip address 10.10.10.2 24

[you-Vlanif1]vrrp vrid 1 virtual-ip 10.10.10.111

[you-Vlanif1]vrrp vrid 2 virtual-ip 10.10.10.112

[you-Vlanif1]vrrp vrid 2 priority 120

[you-Vlanif1]vrrp vrid 2 preempt-mode timer delay 20

[you-Vlanif1]quit

[you]rip ;启用rip

[you-rip-1] version 2 ;用rip版本2

[you-rip-1] network 10.0.0.0 ;公布网段

[you-rip-1]network 20.0.0.0

[you-rip-1]network 50.0.0.0

[you-rip-1]quit

display vrrp ;查看vrrp

Vlanif1 | Virtual Router 1

state : Backup

Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1 Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

you>display ip routing-table ;查看路由表

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

Destinations : 10 Routes : 12

Destination/Mask Proto Pre Cost Flags NextHop

10.10.10.0/24 Direct 0 0 D 10.10.10.2

10.10.10.2/32 Direct 0 0

InLoopBack0

Interface

Vlanif1

D 127.0.0.1

20.20.20.0/24 Direct 0 0 D 20.20.20.2 Vlanif20

20.20.20.2/32 Direct 0 0 D 127.0.0.1

InLoopBack0

50.50.50.0/24 Direct 0 0 D 50.50.50.1 Vlanif50

50.50.50.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

60.60.60.0/24 RIP 100 1 D 20.20.20.1 Vlanif20

RIP 100 1 D 10.10.10.1 Vlanif1

RIP 100 1 D 50.50.50.2 Vlanif50

100.100.100.0/24 RIP 100 1 D 50.50.50.2 Vlanif50

127.0.0.0/8 Direct 0 0 D 127.0.0.1

InLoopBack0

127.0.0.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

4.测试

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

(1)vrrp正常状态下测试

pc1网关设置:10.10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由: 1 3 ms 1 ms 7 ms 10.10.10.1

2 2 ms 2 ms 2 ms 60.60.60.2

3 <1 毫秒 <1 毫秒 1 ms LJ-2400 [100.100.100.2]

跟踪完成。

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 2 ms 1 ms 1 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

注:pc1设置不同的网关,其tracert的路径也不一样,说明vrrp多组配置生效。

(2)只断a,查看俩个交换机vrrp状态并测试pc1如何到pc2

display vrrp

Vlanif1 | Virtual Router 1

state : Initialize

Virtual IP : 10.10.10.111

PriorityRun : 120 PriorityConfig : 120

MasterPriority : 0

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Initialize

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 0

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

display vrrp

Vlanif1 | Virtual Router 1

state : Master Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 100

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 2 ms 2 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

Pc1设置网关:10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(3)只断c,查看vrrp状态并测试pc1如何到pc2 display vrrp

Vlanif1 | Virtual Router 1

state : Backup

Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

zuo>display vrrp

Vlanif1 | Virtual Router 1

state : Master

Virtual IP : 10.10.10.111

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Backup

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Pc1网关设置:10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.1

2 2 ms 2 ms 2 ms 60.60.60.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.2

2 2 ms 1 ms 1 ms 10.10.10.1

3 2 ms 2 ms 2 ms 60.60.60.2

4 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

2023年12月8日发(作者:弓兰娜)

一、 基本命令: ....................................................................................................... 1

保存当前配置:save [ configuration-file ] ...................................................................... 1

清除当前配置:reset saved-configuration ............................................. 1

重启当前设备:reboot ........................................................................... 1

取消单条配置:undo +要取消的配置命令 .................................................................... 1

[SwitchA-Ethernet0/3]undo port link-type trunk ...................................................... 1

显示命令: ....................................................................................................................... 2

配置静态路由:ip route-static 目标网段 子网掩码 下一跳地址 ........................... 2

设置trunk: ..................................................................................................................... 2

telnet登陆设置: ............................................................................................................. 2

二、配置实例 ........................................................................................................................... 3

1.实例说明 ........................................................................................................................ 3

2拓扑图如下: ................................................................................................................ 4

交换机名为zuo的配置:(华为5328设置) ....................................................... 4

9300的配置: .......................................................................................................... 8

交换机you的设置:(华为5328设置) ............................................................... 9

4.测试 .............................................................................................................................. 12

(1)vrrp正常状态下测试 ........................................................................................ 12

(2)只断a,查看俩个交换机vrrp状态并测试pc1如何到pc2 ............................. 13

(3)只断c,查看vrrp状态并测试pc1如何到pc2 ................................................. 16

一、 基本命令:

保存当前配置:save [ configuration-file ]

清除当前配置:reset saved-configuration

重启当前设备:reboot

取消单条配置:undo +要取消的配置命令

例:[SwitchA-Ethernet0/3]port link-type trunk

[SwitchA-Ethernet0/3]undo port link-type trunk 显示命令:

display interface brief ;查看端口状态

display current-configuration ;显示当前设备的所有配置信息

配置静态路由:ip route-static 目标网段 子网掩码 下一跳地址

例:ip route-static 192.168.1.0 255.255.255.0 192.168.1.2

例:ip route-static 0.0.0.0 0.0.0.0 172.16.1.2

设置trunk:

[core s9303-1]interface GigabitEthernet 1/0/5

[core s9303-1-GigabitEthernet1/0/5]combo copper ;9300端口默认是光模式,改为电模式

[core s9303-1-GigabitEthernet1/0/5]port link-type trunk

---------------------------------------------------------------------------------------

[huawei5328]interface GigabitEthernet 0/0/2

[huawei5328-GigabitEthernet0/0/2]undo port default vlan

[huawei5328-GigabitEthernet0/0/2]port link-type trunk

[huawei5328-GigabitEthernet0/0/2]port trunk allow-pass vlan all; 允许所有的vlan从g 0/0/2端口透传通过,也可以指定具体的vlan值

telnet登陆设置:

1.

2.

3.

4.

5.

6.

7.

8.

system-view

[S9300-A] vlan 60

[S9300-A-vlan2] quit

[S9300-A] interface GigabitEthernet 1/0/1

[S9300-A-GigabitEthernet1/0/1] combo copper

[S9300-A-GigabitEthernet1/0/1] port link-type access

[S9303-A-GigabitEthernet1/0/1]port default vlan 60

[S9300-A-GigabitEthernet1/0/1] quit 9. [S9300-A] interface vlanif 60

10. [S9300-A-Vlanif60] ip address 10.10.10.8 255.255.255.0

11. [S9300-A-Vlanif60] quit

12. [S9300-A]

13. [S9300-A] user-interface vty 0 4

14.[S9300-A-ui-vty0-4] authentication-mode password

15.[S9300-A-ui-vty0-4] set authentication password simple 123456

16. [S9300-A-ui-vty0-4] quit

17. [S9300-A]

二、配置实例

1.实例说明

此实例测试华为三层交换机vrrp以及rip路由协议的启用, 2拓扑图如下:

Ip:100.100.100.2网关:100.100.100.1Pc2端口0Vlan100Ip:100.100.100.1端口6Vlan60IP:60.60.609300端口5Vlan50IP:50.50.50.2c端口5Vlan50IP:50.50.50.1端口6

Vlan60Ip:60.60.60.1d端口20Vlan20Ip:20.20.20.1心跳线端口20Vlan20Ip:20.20.20.2端口12ZuoVlan1Ip:10.10.10.1虚ip:组1:10.10.10.111组2:10.10.10.112you端口12Vlan1Ip:10.10.10.2虚ip:b组1:10.10.10.111组2:10.10.10.112a接入层交换机Ip:10.10.10.9Pc13.配置命令

交换机名为zuo的配置:(华为5328设置) system-view

[Quidway]sysname zuo ;给设备命名

[zuo]vlan 20 ;创建vlan

[zuo-vlan20]port GigabitEthernet 0/0/20 ;进入端口模式

[zuo-vlan20]quit

[zuo]interface Vlanif 20 ;进入vlanif接口模式

[zuo-Vlanif20]ip address 20.20.20.1 24 ;添加ip

[zuo-Vlanif20]quit

[zuo]display ip int brief ;显示接口ip配置

[zuo]interface Vlanif 1

[zuo-Vlanif1]ip address 10.10.10.1 24

[zuo-Vlanif1]quit

[zuo]vlan 60

[zuo-vlan60]port GigabitEthernet 0/0/6 ;把端口加到vlan中

[zuo-vlan60]quit

[zuo]interface Vlanif 60

[zuo-Vlanif60]ip address 60.60.60.1 24

[zuo-Vlanif60]quit

[zuo]interface Vlanif 1

[zuo-Vlanif1]vrrp vrid 1 virtual-ip 10.10.10.111

[zuo-Vlanif1]vrrp vrid 1 priority 120 ;设置vrrp组1的优先级

[zuo-Vlanif1]vrrp vrid 1 preempt-mode timer delay 20 ;

[zuo-Vlanif1]vrrp vrid 2 virtual-ip 10.10.10.112

[zuo-Vlanif1]display vrrp ;显示vrrp配置状态

[zuo]rip ;启用rip动态路由协议

[zuo-rip-1] version 2

[zuo-rip-1]network 10.0.0.0

[zuo-rip-1]network 20.0.0.0

[zuo-rip-1]network 60.0.0.0

[zuo-rip-1]quit [zuo-Vlanif1]display ip routing-table ;查看路由表

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

Destinations : 10 Routes : 12

Destination/Mask Proto Pre Cost Flags NextHop Interface

10.10.10.0/24 Direct 0 0 D 10.10.10.1 Vlanif1

10.10.10.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

20.20.20.0/24 Direct 0 0 D 20.20.20.1 Vlanif20

20.20.20.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

50.50.50.0/24 RIP 100 1 D 20.20.20.2 Vlanif20

RIP 100 1 D 10.10.10.2 Vlanif1

RIP 100 1 D 60.60.60.2 Vlanif60

60.60.60.0/24 Direct 0 0 D 60.60.60.1 Vlanif60

60.60.60.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

100.100.100.0/24 RIP 100 1 D 60.60.60.2 Vlanif60

127.0.0.0/8 Direct 0 0 D 127.0.0.1

InLoopBack0

127.0.0.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

display vrrp ;显示vrrp状态

Vlanif1 | Virtual Router 1 state : Master

Virtual IP : 10.10.10.111

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Backup

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

9300的配置:

system-view

[core s9303-1]vlan 60

[core s9303-1-vlan60]quit

[core s9303-1]vlan 50

[core s9303-1-vlan50]quit

[core s9303-1]interface GigabitEthernet 1/0/6

[core s9303-1-GigabitEthernet1/0/6]combo copper ;9300端口默认是光模式,改成电模式

[core s9303-1-GigabitEthernet1/0/6]port link-type access ;设接口类型为接入模式

[core s9303-1-GigabitEthernet1/0/6]port default vlan 60 ;把端口添加到vlan60中

[core s9303-1-GigabitEthernet1/0/6]quit

[core s9303-1]display vlan 60 ;查看vlan60的配置

[core s9303-1]interface GigabitEthernet 1/0/5

[core s9303-1-GigabitEthernet1/0/5]combo copper

[core s9303-1-GigabitEthernet1/0/5]port default vlan 50

[core s9303-1-GigabitEthernet1/0/5]quit

[core s9303-1]interface Vlanif 50

[core s9303-1-Vlanif50]ip address 50.50.50.2 24

[core s9303-1-Vlanif50]quit

[core s9303-1]interface Vlanif 60

[core s9303-1-Vlanif60]ip address 60.60.60.2 24

[core s9303-1-Vlanif60]quit

[core s9303-1]display vlan 50

VLAN ID Type Status MAC Learning Broadcast/Multicast/Unicast

Property

--------------------------------------------------------------------------------

50 common enable enable forward forward forward default

----------------

Untagged Port: GigabitEthernet1/0/5

----------------

Tagged Port: GigabitEthernet1/0/1

----------------

Interface Physical

GigabitEthernet1/0/1 DOWN

GigabitEthernet1/0/5 UP

[core s9303-1]interface GigabitEthernet 1/0/0

[core s9303-1-GigabitEthernet1/0/0]port default vlan 100

[core s9303-1-GigabitEthernet1/0/0]quit

[core s9303-1]rip

[core s9303-1-rip-1]network 50.0.0.0

[core s9303-1-rip-1]network 60.0.0.0

[core s9303-1-rip-1]network 100.0.0.0

-------------------------------------------------------------------------------------------------------

交换机you的设置:(华为5328设置)

system-view

[you]vlan 20

[you-vlan20]port GigabitEthernet 0/0/20 ;把端口加到vlan中

[you-vlan20]quit

[you]interface Vlanif 20

[you-Vlanif20]ip address 20.20.20.2 24

[you-Vlanif20]quit

[you]vlan 50 [you-vlan50]port GigabitEthernet 0/0/5

[you-vlan50]quit

[you]interface Vlanif 50

[you-Vlanif50]ip address 50.50.50.1 24

[you-Vlanif50]quit

[you]interface Vlanif 1

[you-Vlanif1]ip address 10.10.10.2 24

[you-Vlanif1]vrrp vrid 1 virtual-ip 10.10.10.111

[you-Vlanif1]vrrp vrid 2 virtual-ip 10.10.10.112

[you-Vlanif1]vrrp vrid 2 priority 120

[you-Vlanif1]vrrp vrid 2 preempt-mode timer delay 20

[you-Vlanif1]quit

[you]rip ;启用rip

[you-rip-1] version 2 ;用rip版本2

[you-rip-1] network 10.0.0.0 ;公布网段

[you-rip-1]network 20.0.0.0

[you-rip-1]network 50.0.0.0

[you-rip-1]quit

display vrrp ;查看vrrp

Vlanif1 | Virtual Router 1

state : Backup

Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1 Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

you>display ip routing-table ;查看路由表

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

Destinations : 10 Routes : 12

Destination/Mask Proto Pre Cost Flags NextHop

10.10.10.0/24 Direct 0 0 D 10.10.10.2

10.10.10.2/32 Direct 0 0

InLoopBack0

Interface

Vlanif1

D 127.0.0.1

20.20.20.0/24 Direct 0 0 D 20.20.20.2 Vlanif20

20.20.20.2/32 Direct 0 0 D 127.0.0.1

InLoopBack0

50.50.50.0/24 Direct 0 0 D 50.50.50.1 Vlanif50

50.50.50.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

60.60.60.0/24 RIP 100 1 D 20.20.20.1 Vlanif20

RIP 100 1 D 10.10.10.1 Vlanif1

RIP 100 1 D 50.50.50.2 Vlanif50

100.100.100.0/24 RIP 100 1 D 50.50.50.2 Vlanif50

127.0.0.0/8 Direct 0 0 D 127.0.0.1

InLoopBack0

127.0.0.1/32 Direct 0 0 D 127.0.0.1

InLoopBack0

4.测试

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

(1)vrrp正常状态下测试

pc1网关设置:10.10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由: 1 3 ms 1 ms 7 ms 10.10.10.1

2 2 ms 2 ms 2 ms 60.60.60.2

3 <1 毫秒 <1 毫秒 1 ms LJ-2400 [100.100.100.2]

跟踪完成。

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 2 ms 1 ms 1 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

注:pc1设置不同的网关,其tracert的路径也不一样,说明vrrp多组配置生效。

(2)只断a,查看俩个交换机vrrp状态并测试pc1如何到pc2

display vrrp

Vlanif1 | Virtual Router 1

state : Initialize

Virtual IP : 10.10.10.111

PriorityRun : 120 PriorityConfig : 120

MasterPriority : 0

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Initialize

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 0

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

display vrrp

Vlanif1 | Virtual Router 1

state : Master Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 100

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 2 ms 2 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

Pc1设置网关:10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.2

2 2 ms 2 ms 2 ms 50.50.50.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(3)只断c,查看vrrp状态并测试pc1如何到pc2 display vrrp

Vlanif1 | Virtual Router 1

state : Backup

Virtual IP : 10.10.10.111

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Master

Virtual IP : 10.10.10.112

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

zuo>display vrrp

Vlanif1 | Virtual Router 1

state : Master

Virtual IP : 10.10.10.111

PriorityRun : 120

PriorityConfig : 120

MasterPriority : 120

Preempt : YES Delay Time : 20

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Vlanif1 | Virtual Router 2

state : Backup

Virtual IP : 10.10.10.112

PriorityRun : 100

PriorityConfig : 100

MasterPriority : 120

Preempt : YES Delay Time : 0

Accept_mode : NO

V2v3interop : NO

Timer : 1

Master adver Timer : 1

Auth Type : NONE

Check TTL : YES

Pc1网关设置:10.10.10.111

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.1

2 2 ms 2 ms 2 ms 60.60.60.2

3 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

Pc1网关设置:10.10.10.112

C:Users0173>tracert 100.100.100.2

通过最多 30 个跃点跟踪

到 LJ-2400 [100.100.100.2] 的路由:

1 1 ms 1 ms 1 ms 10.10.10.2

2 2 ms 1 ms 1 ms 10.10.10.1

3 2 ms 2 ms 2 ms 60.60.60.2

4 <1 毫秒 <1 毫秒 <1 毫秒 LJ-2400 [100.100.100.2]

跟踪完成。

C:Users0173>

发布评论

评论列表 (0)

  1. 暂无评论