锐捷实战系列(五十三) VRF中的静态路由
2018-04-24 本文已影响712人
3c21cb88ae2b
实训目的
- 掌握配置VRF中的静态路由的方法。
实训背景
VRF(Virtual Routing Forwarding,虚拟路由转发),通过标识将路由分成多个独立的分组,相当于将一个路由器虚拟成多个路由器。
静态路由就是手工配置的路由,使得数据包能够按照预定的路径传送到指定的目标网络。当不能通过动态路由协议学到一些目标网络的路由时,配置静态路由就会显得十分重要。
实训拓扑

实验所需设备:
设备类型 | 设备型号 | 数量 |
---|---|---|
路由器 | RSR20 | 2 |
主机 | Windows 10 | 2 |
实训步骤
步骤1:基本配置。
R1:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R1
R1(config)#
R2:
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)#hostname R2
R2(config)#
步骤2:全网基本IP地址配置。
R1(config)#interface fastEthernet 0/0
R1(config-if-FastEthernet 0/0)#ip address 192.168.1.1 255.255.255.0
R1(config-if-FastEthernet 0/0)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0
R1(config-if-FastEthernet 0/1)#exit
R1(config)#interface loopback 0
R1(config-if-Loopback 0)#ip address 1.1.1.1 255.255.255.0
R1(config-if-Loopback 0)#exit
R1(config)#
R2(config)#interface fastEthernet 0/0
R2(config-if-FastEthernet 0/0)#ip address 192.168.1.2 255.255.255.0
R2(config-if-FastEthernet 0/0)#exit
R2(config)#interface fastEthernet 0/1
R2(config-if-FastEthernet 0/1)#ip address 192.168.3.1 255.255.255.0
R2(config-if-FastEthernet 0/1)#exit
R2(config)#interface loopback 0
R2(config-if-Loopback 0)#ip address 2.2.2.2 255.255.255.0
R2(config-if-Loopback 0)#exit
R2(config)#
PC1:

PC2:

步骤3:在R1上开启配置VRF。
R1(config)#ip vrf JXCloud
R1(config-vrf)#exit
R1(config)#
步骤4:在R1上将对应的接口划入vrf。
将接口划入到vrf时,若该接口有配置ip 地址,会将ip地址移除,需要重新配置该接口的ip。
R1(config)#interface fastEthernet 0/0
R1(config-if-FastEthernet 0/0)#ip vrf forwarding JXCloud
R1(config-if-FastEthernet 0/0)#ip address 192.168.1.1 255.255.255.0
R1(config-if-FastEthernet 0/0)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if-FastEthernet 0/1)#ip vrf forwarding JXCloud
R1(config-if-FastEthernet 0/1)#ip address 192.168.2.1 255.255.255.0
R1(config-if-FastEthernet 0/1)#exit
R1(config)#
步骤5:给R1和R2配置路由。
R1(config)#ip route vrf JXCloud 192.168.3.0 255.255.255.0 192.168.1.2
R2(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.1
步骤6:使用PC1 Ping PC2。

步骤7:使用命令show ip route vrf JXCloud查看vrf下的路由。
R1#show ip route vrf JXCloud
