VRF路由泄漏

说明:
SW1,SW2为核心交换机,启用VRF分割路由实例(GZQ,ZYQ),即设备存在三张路由表。接入交换机和出口SW7均未启用VRF,项目需求为在SW1/SW2上实现VRF路由互通,内部数据通信不经过SW7。
配置要点:
在SW1和SW2上分别启用各VRF桥接接口(本例为vlan199/299),在两个交换机上有针对性的将其中一个接口指定到VRF另一个不指定(VRF间路由跳转需静态指定下一跳地址,按此方法配置接口,可确保下一跳地址可达,否则VRF跳转路由无法配置)。配置过程需要注意双向通信均需要实现VRF间跳转,否则某个方向的数据还是会传递到SW7上。
配置文档:(已删除部分不重要内容)

==================SW1===================
<SW1>display current-configuration 
router id 1.1.1.1
#
vlan batch 100 to 102 199 to 202 299 1000 2000
#
ip vpn-instance gzq
 ipv4-family
  route-distinguisher 200:1
  vpn-target 200:2 export-extcommunity
  vpn-target 200:3 import-extcommunity
#
ip vpn-instance zyq
 ipv4-family
  route-distinguisher 100:1
  vpn-target 100:2 export-extcommunity
  vpn-target 100:3 import-extcommunity
#
interface Vlanif100
 ip binding vpn-instance zyq
 ip address 10.19.180.2 255.255.255.0
 vrrp vrid 1 virtual-ip 10.19.180.1
 vrrp vrid 1 priority 120
#
interface Vlanif101
 ip binding vpn-instance zyq
 ip address 10.19.181.2 255.255.255.0
 vrrp vrid 1 virtual-ip 10.19.181.1
 vrrp vrid 1 priority 120
#
interface Vlanif102
 ip binding vpn-instance zyq
 ip address 192.168.1.1 255.255.255.0
#
interface Vlanif199
 ip binding vpn-instance zyq
 ip address 172.16.1.2 255.255.255.0

#
interface Vlanif200
 ip binding vpn-instance gzq
 ip address 10.74.16.2 255.255.255.0
 vrrp vrid 1 virtual-ip 10.74.16.1
 vrrp vrid 1 priority 120
#
interface Vlanif201
 ip binding vpn-instance gzq
 ip address 10.74.17.2 255.255.255.0
 vrrp vrid 1 virtual-ip 10.74.17.1
 vrrp vrid 1 priority 120
#
interface Vlanif202
 ip binding vpn-instance gzq
 ip address 192.168.2.1 255.255.255.0
#
interface Vlanif299
 ip address 172.16.2.2 255.255.255.0

#
interface Vlanif1000
 ip binding vpn-instance zyq
 ip address 10.19.1.2 255.255.255.0
 vrrp vrid 3 virtual-ip 10.19.1.1
 vrrp vrid 3 priority 120
#
interface Vlanif2000
 ip binding vpn-instance gzq
 ip address 10.74.1.2 255.255.255.0
 vrrp vrid 4 virtual-ip 10.74.1.1
 vrrp vrid 4 priority 120
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 1000 2000
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
#
ospf 12 router-id 1.1.1.100 vpn-instance zyq
 default-route-advertise summary cost 50
 area 0.0.0.0
  network 10.19.180.0 0.0.0.255
  network 192.168.1.0 0.0.0.255
  network 10.19.181.0 0.0.0.255
#
ospf 13 router-id 1.1.1.200 vpn-instance gzq
 default-route-advertise summary cost 50
 area 0.0.0.0
  network 10.74.16.0 0.0.0.255
  network 10.74.17.0 0.0.0.255
  network 192.168.2.0 0.0.0.255
#
ip route-static vpn-instance zyq 0.0.0.0 0.0.0.0 10.19.1.254 preference 200
ip route-static vpn-instance zyq 10.74.0.0 255.255.0.0 172.16.2.3 public
ip route-static vpn-instance gzq 0.0.0.0 0.0.0.0 10.74.1.254 preference 200
ip route-static vpn-instance gzq 10.19.0.0 255.255.0.0 vpn-instance zyq 172.16.1.3

#
return
<SW1>


==================SW2===================
<SW2>display current-configuration 
router id 2.2.2.2
#
vlan batch 100 to 102 199 to 202 299 1000 2000
#
ip vpn-instance gzq
 ipv4-family
  route-distinguisher 200:1
  vpn-target 200:3 export-extcommunity
  vpn-target 200:2 import-extcommunity
#
ip vpn-instance zyq
 ipv4-family
  route-distinguisher 100:1
  vpn-target 100:3 export-extcommunity
  vpn-target 100:2 import-extcommunity
#
interface Vlanif100
 ip binding vpn-instance zyq
 ip address 10.19.180.3 255.255.255.0
#
interface Vlanif101
 ip binding vpn-instance zyq
 ip address 10.19.181.3 255.255.255.0
 vrrp vrid 1 virtual-ip 10.19.181.1
 vrrp vrid 1 priority 120
#
interface Vlanif102
 ip binding vpn-instance zyq
 ip address 192.168.1.2 255.255.255.0
#
interface Vlanif199
 ip address 172.16.1.3 255.255.255.0

#
interface Vlanif200
 ip binding vpn-instance gzq
 ip address 10.74.16.3 255.255.255.0
 vrrp vrid 1 virtual-ip 10.74.16.1
 vrrp vrid 1 priority 120
#
interface Vlanif201
 ip binding vpn-instance gzq
 ip address 10.74.17.3 255.255.255.0
 vrrp vrid 1 virtual-ip 10.74.17.1
 vrrp vrid 1 priority 120
#
interface Vlanif202
 ip binding vpn-instance gzq
 ip address 192.168.2.2 255.255.255.0
#
interface Vlanif299
 ip binding vpn-instance gzq
 ip address 172.16.2.3 255.255.255.0

#
interface Vlanif1000
 ip binding vpn-instance zyq
 ip address 10.19.1.3 255.255.255.0
 vrrp vrid 3 virtual-ip 10.19.1.1
#
interface Vlanif2000
 ip binding vpn-instance gzq
 ip address 10.74.1.3 255.255.255.0
 vrrp vrid 4 virtual-ip 10.74.1.1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 1000  2000
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
#
ospf 12 router-id 2.2.2.100 vpn-instance zyq
 default-route-advertise summary cost 100
 area 0.0.0.0
  network 10.19.180.0 0.0.0.255
  network 192.168.1.0 0.0.0.255
  network 10.19.181.0 0.0.0.255
#
ospf 13 router-id 2.2.2.200 vpn-instance gzq
 default-route-advertise summary cost 100
 area 0.0.0.0
  network 10.74.16.0 0.0.0.255
  network 10.74.17.0 0.0.0.255
  network 192.168.2.0 0.0.0.255
#
ip route-static vpn-instance zyq 0.0.0.0 0.0.0.0 10.19.1.254 preference 200
ip route-static vpn-instance zyq 10.74.0.0 255.255.0.0 vpn-instance gzq 172.16.2.2
ip route-static vpn-instance gzq 0.0.0.0 0.0.0.0 10.74.1.254 preference 200
ip route-static vpn-instance gzq 10.19.0.0 255.255.0.0 172.16.1.2 public

#
return
<SW2> 


==================SW3===================
<sw3>display current-configuration 
#
router id 3.3.3.3
#
vlan batch 102 110
#
interface Vlanif102
 ip address 192.168.1.3 255.255.255.0
#
interface Vlanif110
 ip address 10.19.183.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
ospf 12
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255
  network 10.19.183.0 0.0.0.255
#
return
<sw3> 
==================SW4===================
<sw4>display current-configuration 
#
router id 4.4.4.4
#
vlan batch 202 210
#
interface Vlanif202
 ip address 192.168.2.4 255.255.255.0
#
interface Vlanif210
 ip address 10.74.18.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
ospf 13
 area 0.0.0.0
  network 192.168.2.0 0.0.0.255
  network 10.74.18.0 0.0.0.255
#
return
<sw4> 
==================SW5===================
<sw5>display current-configuration 
#
sysname sw5
vlan batch 102 111
#
interface Vlanif102
 ip address 192.168.1.5 255.255.255.0
#
interface Vlanif111
 ip address 10.19.184.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
ospf 12
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255
  network 10.19.184.0 0.0.0.255
#
return
<sw5>
==================SW6===================
<sw6>display current-configuration 
#
sysname sw6
#
router id 5.5.5.5
#
vlan batch 202 211
#
interface Vlanif202
 ip address 192.168.2.6 255.255.255.0
#
interface Vlanif211
 ip address 10.74.19.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
ospf 13
 area 0.0.0.0
  network 192.168.2.0 0.0.0.255
  network 10.74.19.0 0.0.0.255
#
return
<sw6>
==================SW7===================
<sw7>display current-configuration 
#
sysname sw7
#
vlan batch 1000 2000
#
interface Vlanif1000
 ip address 10.19.1.254 255.255.255.0
#
interface Vlanif2000
 ip address 10.74.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
 port link-type trunk
 undo port trunk allow-pass vlan 1
 port trunk allow-pass vlan 1000 2000
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 1000 2000
#
ip route-static 10.19.0.0 255.255.0.0 10.19.1.1
ip route-static 10.74.0.0 255.255.0.0 10.74.1.1
ip route-static 192.168.1.0 255.255.255.0 10.19.1.1
ip route-static 192.168.2.0 255.255.255.0 10.74.1.1
#
return
<sw7> 


  • 3
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值