VRF static route 与VRF ospf

 

要求:

1、PC1 能与sales 网络通讯;

2、PC2 能与production 网络通讯;

3、PC1 不能访问producton,PC2 不能访问sales;

使用vrf 功能实现;

实际:

PC1 的192.168.1.10能访问10.1.1.1 但是不能访问10.2.2.2;

PC2 的192.168.1.10能访问10.2.2.2 但是不能访问10.1.1.1;

 

组网图:

 

配置命令:

LSW1:

复制代码
vlan batch 10 20

interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
复制代码

R1:

复制代码
interface GigabitEthernet0/0/0
 ip address 10.0.13.1 255.255.255.0 

#
interface LoopBack0
 ip address 10.1.1.1 255.255.255.255 

#
ip route-static 192.168.1.0 255.255.255.0 10.0.13.3
复制代码

 

R2:

复制代码
interface GigabitEthernet0/0/0
 ip address 10.0.23.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
#
interface NULL0
#
interface LoopBack0
 ip address 10.2.2.2 255.255.255.255 
#
ospf 1 
 area 0.0.0.0 
  network 10.0.23.0 0.0.0.255 
  network 10.2.2.2 0.0.0.0 
复制代码

R4:

复制代码
interface GigabitEthernet0/0/0
 ip binding vpn-instance sales
 ip address 10.0.13.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance production
 ip address 10.0.23.3 255.255.255.0 

#
interface GigabitEthernet0/0/2.10
 dot1q termination vid 10
 ip binding vpn-instance sales
 ip address 192.168.1.254 255.255.255.0 
 arp broadcast enable
#
interface GigabitEthernet0/0/2.20
 dot1q termination vid 20
 ip binding vpn-instance production
 ip address 192.168.1.254 255.255.255.0 
 arp broadcast enable

# 
ospf 1 router-id 10.3.3.3 vpn-instance production
 area 0.0.0.0 
  network 10.0.23.0 0.0.0.255 
  network 10.3.3.3 0.0.0.0 
  network 192.168.1.0 0.0.0.255 
#
ip route-static vpn-instance sales 10.0.13.0 255.255.255.0 10.0.13.1
ip route-static vpn-instance sales 10.1.1.1 255.255.255.255 10.0.13.1
复制代码

 

测试结果:

1、PC1 ping 10.1.1.1

 PC1 ping 10.2.2.2

3、PC2 ping 10.1.1.1

 

4、PC2 ping 10.2.2.2

 

VRF 设备R4 的路由表:

 

 

posted @   橘子飞飞  阅读(51)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
点击右上角即可分享
微信分享提示