三层交换VLAN路由配置技巧详解
三层交换VLAN路由配置技巧详解
在华为三层交换机上创建VLAN,端口划分,三层VLAN接口地址配置,静态路由或是RIP协议配置。跟我来学习一下配置过程。
静态路由配置过程:
PCA:ip address:10.1.1.2/24 gw:10.1.1.1/24(VLAN2路由接口IP地址)
PCB:ip address:10.1.2.2/24 gw:10.1.2.1/24(VLAN3路由接口IP地址)
PCC:ip address:10.1.3.2/24 gw:10.1.3.1/24(VLAN2路由接口IP地址)
S3526A和S352B之间的互联网段为10.1.4.0、24
分配S3526A VLAN4路由接口IP地址为10.1.4.1/24,S3526B VLAN4路由接口IP地址为10.1.4.2/24
三层交换机配置
创建VLAN,把PC划到特定VLAN中:
//创建VLAN
[S3526A]vlan 2
//把端口划到VLAN中
[S3526A-VLAN 2]port ethernet0/9 to ethernet0/12
[S3526A-VLAN 2]vlan 3
[S3526A-VLAN 2]port ethernet0/13 to ethernet0/16
[S3526A-VLAN 2]vlan 4
//交换机B的配置:
[S3526B]vlan 2
[S3526B-VLAN 2]port ethernet0/9 to ethernet0/12
[S3526B-VLAN 2]vlan 4
配置各台PC的网关地址和交换机之间的`网段地址:
//进入VLAN接口配置模式:
[S3526A]interface Vlan-interface 2
//配置三层VLAN路由接口地址
[S3526A-Vlan-interface2]ip address 10.1.1.1 255.255.255.0
[S3526A-Vlan-interface2] interface Vlan-interface 3
[S3526A-Vlan-interface3]ip address 10.1.2.1 255.255.255.0
[S3526A-Vlan-interface3] interface Vlan-interface 4
[S3526A-Vlan-interface4]ip address 10.1.4.1 255.255.255.0
[S3526B]interface Vlan-interface 2
[S3526B-Vlan-interface2]ip address 10.1.3.1 255.255.255.0
[S3526B-Vlan-interface2] interface Vlan-interface 4
[S3526B-Vlan-interface4]ip address 10.1.4.2 255.255.255.0
在二台三层交换机上配置非直连网段静态路由:
[S3526A]ip route-static 10.1.3.0 255.255.255.0 10.1.4.2
[S3526B]ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
[S3526B]ip route-static 10.1.2.0 255.255.255.0 10.1.4.1
查看路由表,查看网络互通情况:
[S3526B]display ip routing-table
Routing Table: public net
Destination/Mask Proto Pre Cost Nexthop Interface
10.1.1.0/24 STATIC 60 0 10.1.4.1 Vlan-interface4
10.1.2.0/24 STATIC 60 0 10.1.4.1 Vlan-interface4
10.1.3.0/24 DIRECT 0 0 10.1.3.1 Vlan-interface2
10.1.3.1/32 DIREC T 0 0 127.0.0.1 InLoopBack0
10.1.4.0/24 DIRECT 0 0 10.1.4.2 Vlan-interface4
0.1.4.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
RlP协议在三层交换机上的配置
1.继续上面的,删除前面配置的静态路由。
[S3526A]undo ip route-static 10.1.3.0 255.255.255.0
[S3526B]undo ip route-static 10.1.1.0 255.255.255.0
[S3526B]undo ip route-static 10.1.2.0 255.255.255.0
2.配置RIP协议:
//交换机B上启用RIP协议
[S3526A]rip
[S3526A-rip]network 10.1.1.0
[S3526A-rip]network 10.1.2.0
[S3526A-rip]network 10.1.4.0
//交换机B上启用RIP协议
[S3526B]rip
[S3526B-rip]network 10.1.3.0
[S3526B-rip]network 10.1.4.0
配置完成即可实现网络互通
查看路由表,查看网络互通情况:
[S3526B]display ip routing-table
Routing Table: public net
Destination/Mask Proto Pre Cost Nexthop Interface
10.1.1.0/24 STATIC 60 0 10.1.4.1 Vlan-interface4
10.1.2.0/24 STATIC 60 0 10.1.4.1 Vlan-interface4
10.1.3.0/24 DIRECT 0 0 10.1.3.1 Vlan-interface2
10.1.3.1/32 DIREC T 0 0 127.0.0.1 InLoopBack0
10.1.4.0/24 DIRECT 0 0 10.1.4.2 Vlan-interface4
0.1.4.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
查看RlP配置信息如下:
[S3526B-rip]display rip
RIP is turned on
public net VPN-Instance
Checkzero is on Default cost : 1
Summary is on Preference : 100
No peer router
Network :
10.0.0.0
;2023-07-25 广告