წინა პოსტში დავწერე და გავაკეთე ლაბა VRF Lite-ზე და VRF Lite-ში Interior Routing პროტოკოლები. ბუნბრივია წინა პოსტიდან გამომდინარე იბადება შეკითხვა (მოსაზრება) როგორ შეიძლება რომ VRF-ებს შორის გავაკეთოდ Routing-ი ანუ ერთ VRF-ს დავანახოთ მეორე VRF-ი, როგორც იქნა მოვიცალე და გავაკეთე პატარა ლაბა.
ფიზიკური და ლოგიკური ტოპოლოგია
ამ ნახაზე არის აღნიშნული თითეული VRF-ის IP მისამართები რომლებიც არის გამოყენებული და ფერი თითეული VRF-ისთვის. თქვენ კარგად ხედავთ რომ 172.16.1.0/30 ქსელი SW1-C1, SW1-C2, SW1-C3- შორის რომ მეორდება და ეს წინა პოსტში ამაზე ვისაუბრე მაგრამ არ გამიკეთბი ამიტომ გადავწყვიტე აქ გამეკეთებინა.
TASK-ი არის გავკეთო ისე რომ C1, C2 და C3 ხედავდენ Shared VRF-ის ქსელს მაგრამ ერმანეთის ქსელს ვერ ხედავხდენ. როგორც არის აღწერილი დიაგრამაზე.

პირველ რიგრში უნდა შევქმანთ VLAN-ები, დავაკონფიკურიროთ ინტერფეიცები, VRF-ები და განვსაზღვროთ route distinguisher. route distinguisher განსაზღვის ორი ფორმატი არსeბობს <ASN>:<number> ან <IP address>:<number>. სადაც <number> ჩვეულებრივი ათობითი რიცვი. ეხლა გამოვიყენებ <ASN>:<number> ამ ფორმატს , მერე BGP-ი უნდა დავაკოფიგურიროთ Private AS ნომრით, რომლითაც მოვახდენთ VRF-ებს შორის მარშუტიზაციას. BGP-ს ავტონომური სისტემის ნომრად გამოვიყენოთ 65000
SW1
VRF-ების შექმნა
ip vrf c1
rd 65000:1
!
ip vrf c2
rd 65000:2
!
ip vrf c3
rd 65000:3
!
ip vrf shared
rd 65000:99
VlAN-ების შექმნა. Dynamips-ში მოგეხენებათ არის არის სვიჩი და ამიტომ სვიჩის მოდული ჩავაყენე როუტერი და Vlan database-იდან მომიწია vlan-ების შექმნა.
SW1#vlan database
SW1(vlan)#vlan 16
VLAN 16 modified:
SW1(vlan)#vlan 17
VLAN 17 modified:
SW1(vlan)#vlan 18
VLAN 18 modified:
SW1(vlan)#exit
ინტეფეისების IP მისამრთების კონფიგურაცია და VRF-ების განსაზღვრა
interface Loopback99
ip vrf forwarding shared
ip address 192.168.99.1 255.255.255.0
!
interface FastEthernet0/1
no switchport
ip vrf forwarding c1
ip address 172.16.1.2 255.255.255.252
!
interface FastEthernet0/3
no switchport
ip vrf forwarding c2
ip address 172.16.1.2 255.255.255.252
!
interface FastEthernet0/5
no switchport
ip vrf forwarding c3
ip address 172.16.1.2 255.255.255.252
!
interface FastEthernet0/13
switchport mode trunk
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan16
ip vrf forwarding c1
ip address 172.16.0.1 255.255.255.0
!
interface Vlan17
ip vrf forwarding c2
ip address 172.17.0.1 255.255.255.0
!
interface Vlan18
ip vrf forwarding c3
ip address 172.18.0.1 255.255.255.0
!
აბა ვნახოთ რა გამოვიდა ხომ ყველაფერი სწორედ დავაკონფიგურირეთ
SW1#show ip vrf
Name Default RD Interfaces
c1 65000:1 Fa0/1
Vl16
c2 65000:2 Fa0/3
Vl17
c3 65000:3 Fa0/5
Vl18
shared 65000:99 Lo99
SW1#show ip vrf interfaces
Interface IP-Address VRF Protocol
Fa0/1 172.16.1.2 c1 up
Vl16 172.16.0.1 c1 up
Fa0/3 172.16.1.2 c2 up
Vl17 172.17.0.1 c2 up
Fa0/5 172.16.1.2 c3 up
Vl18 172.18.0.1 c3 up
Lo99 192.168.99.1 shared up
გადვიდეთ SW2-ს კონფიგურაციას. SW2-ზე გვჭირდება 2 VRF Customer 1 და Customer 2 და შესაბამისად ამ Customer-ების Vlan-ები.
ip vrf c1
rd 65000:1
!
ip vrf c2
rd 65000:2
!
!
!
sw2#vlan database
sw2(vlan)#vlan 16
VLAN 16 modified:
sw2(vlan)#vlan 17
VLAN 17 modified:
sw2(vlan)#vlan 216
VLAN 216 modified:
sw2(vlan)#vlan 217
VLAN 217 modified:
sw2(vlan)#exit
!
!
interface FastEthernet0/13
switchport mode trunk
!
interface Vlan16
ip vrf forwarding c1
ip address 172.16.0.2 255.255.255.0
!
interface Vlan17
ip vrf forwarding c2
ip address 172.17.0.2 255.255.255.0
!
interface Vlan216
ip vrf forwarding c1
ip address 172.16.2.1 255.255.255.0
!
interface Vlan217
ip vrf forwarding c2
ip address 172.16.17.1 255.255.255.0
SW3- ზე გვჭირდება Customer 1 და Customer 3-ის Vlan-ები და VRF-ები
!
ip vrf c1
rd 65000:1
!
ip vrf c3
rd 65000:3
!
sw3#vlan database
sw3(vlan)#vlan 16
VLAN 16 modified:
sw3(vlan)#vlan 18
VLAN 18 modified:
sw3(vlan)#vlan 316
VLAN 316 modified:
sw3(vlan)#vlan 318
VLAN 318 modified:
sw3(vlan)#exit
!
!
interface FastEthernet0/15
switchport mode trunk
!
interface Vlan16
ip vrf forwarding c1
ip address 172.16.0.3 255.255.255.0
!
interface Vlan18
ip vrf forwarding c3
ip address 172.18.0.3 255.255.255.0
!
interface Vlan316
ip vrf forwarding c1
ip address 172.16.3.1 255.255.255.0
!
interface Vlan318
ip vrf forwarding c3
ip address 172.18.3.1 255.255.255.0
!
ამის შემდეგ გადავივართ OSPF-ის კონგურაციაზე VRF-ებისთვის ყველა VRF-ისთვის უნდა აიწიოს ცალ ცალკე OSPF პროცესი. OSPF-ი გავაკეთოთ უმარტივესად მხოლოდ 1 არეა AREA0 (backbone Area). OSPF-ის Neighbor-ინგი იქნება შემდეგნაირი
SW1
ბრძანება network 0.0.0.0 255.255.255.255 ნიშნავს რომ როუტერმა ყველა ინტერფეიცმა მიიღოს OSPF-ში მონაწილეობა.
!
router ospf 1 vrf c1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 2 vrf c2
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 3 vrf c3
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
SW2
router ospf 1 vrf c1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 2 vrf c2
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
SW3
router ospf 1 vrf c1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 3 vrf c3
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
გადავამოწმოთ OSPF-ი
SW2
sw2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.17.0.1 1 FULL/DR 00:00:34 172.17.0.1 Vlan17
172.16.1.2 1 FULL/DR 00:00:34 172.16.0.1 Vlan16
172.16.3.1 1 FULL/DROTHER 00:00:38 172.16.0.3 Vlan16
sw2#show ip route vrf c1
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Vlan16
O 172.16.1.0/30 [110/2] via 172.16.0.1, 00:11:25, Vlan16
C 172.16.2.0/24 is directly connected, Vlan216
O 172.16.3.0/24 [110/2] via 172.16.0.3, 00:11:25, Vlan16
sw2#show ip route vrf c2
172.17.0.0/24 is subnetted, 1 subnets
C 172.17.0.0 is directly connected, Vlan17
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.17.0/24 is directly connected, Vlan217
O 172.16.1.0/30 [110/2] via 172.17.0.1, 01:45:17, Vlan17
SW3
sw3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.18.0.1 1 FULL/DR 00:00:38 172.18.0.1 Vlan18
172.16.1.2 1 FULL/DR 00:00:38 172.16.0.1 Vlan16
172.16.2.1 1 FULL/BDR 00:00:33 172.16.0.2 Vlan16
sw3#show ip route vrf c1
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Vlan16
O 172.16.1.0/30 [110/2] via 172.16.0.1, 00:13:37, Vlan16
O 172.16.2.0/24 [110/2] via 172.16.0.2, 00:13:37, Vlan16
C 172.16.3.0/24 is directly connected, Vlan316
O E1 192.168.99.0/24 [110/2] via 172.16.0.1, 00:13:37, Vlan16
sw3#show ip route vrf c3
172.16.0.0/30 is subnetted, 1 subnets
O 172.16.1.0 [110/2] via 172.18.0.1, 00:13:28, Vlan18
172.18.0.0/24 is subnetted, 2 subnets
C 172.18.3.0 is directly connected, Vlan318
C 172.18.0.0 is directly connected, Vlan18
O E2 192.168.99.0/24 [110/1] via 172.18.0.1, 00:13:28, Vlan18
sw3#
Multiprotocol BGP MP-BGP
MP-BGP ვიყენებთ მხოლოდ VRF-ებს შორის როუტინგისთვის. ამიტომ MP-BGP კონფიგურაცია საჭიროა მხოლოდ SW1-ზე. AS ნომრად გამოვიყენოთ 65000. BGP-ს კონფიგურაცია რომ დავიწყოთ BGP-ს აუცილებელია 1 IPმისამართი მაინც GLOBAL ROUTING Table-ში რომ მიანიჭოს Router-ID ამიტომ პირველ რიგში ვქმნით Loopback ინტერფეის
interface Loopback0
ip address 1.1.1.1 255.255.255.255
router bgp 65000
no synchronization
bgp log-neighbor-changes
no auto-summary
!
address-family ipv4 vrf shared
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf c3
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf c2
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf c1
redistribute connected
no synchronization
exit-address-family
იმისთვის რომ შევამოწმოთ BGP-ს კონფიგურაცია თითეული address-family-სთვის
show ip bgp vpnv4 vrf <VRF Name>
ან ყველა address-family-ისთვის ერთდროულად
show ip bgp vpnv4 all
SW1#show ip bgp vpnv4 vrf c1
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 65000:1 (default for vrf c1)
*> 172.16.0.0/24 0.0.0.0 0 32768 ?
*> 172.16.1.0/30 0.0.0.0 0 32768 ?
*> 172.16.2.0/24 172.16.0.2 2 32768 ?
SW1#show ip bgp vpnv4 vrf c2
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 65000:2 (default for vrf c2)
*> 172.16.1.0/30 0.0.0.0 0 32768 ?
*> 172.16.17.0/24 172.17.0.2 2 32768 ?
*> 172.17.0.0/24 0.0.0.0 0 32768 ?
SW1#show ip bgp vpnv4 vrf c3
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 65000:3 (default for vrf c3)
*> 172.16.1.0/30 0.0.0.0 0 32768 ?
*> 172.18.0.0/24 0.0.0.0 0 32768 ?
*> 172.18.3.0/24 172.18.0.3 2 32768 ?
SW1#show ip bgp vpnv4 vrf shared
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 65000:99 (default for vrf shared)
*> 192.168.99.0 0.0.0.0 0 32768 ?
მარშუტების იმპორტი და ექსპორტი
ეხლა უნდა დავაკონფიგურიროთ როუტების იმპორტი და ექსპორტი , რომელიც იძლევა საშუაბელბას VRF-ებს შორის გაიცვალოს ქსელები.
ყველა VRF-ის მარშუტი უნდა დავაექპორტოთ. მხოლოდ დავაიმპორტოთ shared VRF-ის მარშუტი.
!
!
ip vrf c1
rd 65000:1
route-target export 65000:1
route-target import 65000:99
!
ip vrf c2
rd 65000:2
route-target export 65000:2
route-target import 65000:99
!
ip vrf c3
rd 65000:3
route-target export 65000:3
route-target import 65000:99
!
ip vrf shared
rd 65000:99
route-target export 65000:99
route-target import 65000:1
route-target import 65000:2
route-target import 65000:3
!
ეხლა დავრჩა რედისტრიბუცია BGP-დან OSPF-ში და პირიქით
router ospf 1 vrf c1
log-adjacency-changes
redistribute bgp 65000 metric-type 1 subnets
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 2 vrf c2
log-adjacency-changes
redistribute bgp 65000 metric-type 1 subnets
network 0.0.0.0 255.255.255.255 area 0
!
router ospf 3 vrf c3
log-adjacency-changes
redistribute bgp 65000 subnets
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 65000
no synchronization
bgp log-neighbor-changes
no auto-summary
!
address-family ipv4 vrf shared
redistribute connected
no synchronization
exit-address-family
!
address-family ipv4 vrf c3
redistribute connected
redistribute ospf 3 vrf c3
no synchronization
exit-address-family
!
address-family ipv4 vrf c2
redistribute connected
redistribute ospf 2 vrf c2
no synchronization
exit-address-family
!
address-family ipv4 vrf c1
redistribute connected
redistribute ospf 1 vrf c1
no synchronization
exit-address-family
ამის მერე შევამოწმოთ C1, C2 და C3-ის VRF-ები თუ გამოჩნდა Shared VRF-ის ქსელი 192.168.99.0/24 და Shared VRF-ში თუ გამოჩნდა სხვა VRF-ების ქსელები.
SW1#show ip route vrf c1
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Vlan16
C 172.16.1.0/30 is directly connected, FastEthernet0/1
O 172.16.2.0/24 [110/2] via 172.16.0.2, 00:46:58, Vlan16
O 172.16.3.0/24 [110/2] via 172.16.0.3, 00:46:58, Vlan16
B 192.168.99.0/24 is directly connected, 02:20:36, Loopback99
SW1#show ip route vrf c2
172.17.0.0/24 is subnetted, 1 subnets
C 172.17.0.0 is directly connected, Vlan17
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
O 172.16.17.0/24 [110/2] via 172.17.0.2, 02:20:30, Vlan17
C 172.16.1.0/30 is directly connected, FastEthernet0/3
B 192.168.99.0/24 is directly connected, 02:20:37, Loopback99
SW1#show ip route vrf c3
172.16.0.0/30 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, FastEthernet0/5
172.18.0.0/24 is subnetted, 2 subnets
O 172.18.3.0 [110/2] via 172.18.0.3, 00:46:51, Vlan18
C 172.18.0.0 is directly connected, Vlan18
B 192.168.99.0/24 is directly connected, 02:20:39, Loopback99
SW1#show ip route vrf shared
172.17.0.0/24 is subnetted, 1 subnets
B 172.17.0.0 is directly connected, 02:20:41, Vlan17
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
B 172.16.17.0/24 [20/2] via 172.17.0.2 (c2), 02:20:26, Vlan17
B 172.16.0.0/24 is directly connected, 02:20:41, Vlan16
B 172.16.1.0/30 is directly connected, 02:20:41, FastEthernet0/5
B 172.16.2.0/24 [20/2] via 172.16.0.2 (c1), 02:20:26, Vlan16
B 172.16.3.0/24 [20/2] via 172.16.0.3 (c1), 00:46:48, Vlan16
172.18.0.0/24 is subnetted, 2 subnets
B 172.18.3.0 [20/2] via 172.18.0.3 (c3), 00:46:48, Vlan18
B 172.18.0.0 is directly connected, 02:20:42, Vlan18
C 192.168.99.0/24 is directly connected, Loopback99
SW1#
შემოწმების მერე ვხედავთ რომ C1, C2 , C3 აქვს Shared VRF-ის ქსელი და Shared-VRF-ს აქვს Customer-ების ქსელები. BGP-დან OSPF-ში რედისტრიბუციის შედეგად უნდა მიეღო SW2-ზე C1 , C2 მხოლოდ SW3-ზე C1 და C3 Shared VRF-ის ქსელი
sw2#show ip route vrf c1
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Vlan16
O 172.16.1.0/30 [110/2] via 172.16.0.1, 00:56:16, Vlan16
C 172.16.2.0/24 is directly connected, Vlan216
O 172.16.3.0/24 [110/2] via 172.16.0.3, 00:56:16, Vlan16
O E1 192.168.99.0/24 [110/2] via 172.16.0.1, 00:56:16, Vlan16
sw2#show ip route vrf c2
172.17.0.0/24 is subnetted, 1 subnets
C 172.17.0.0 is directly connected, Vlan17
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.17.0/24 is directly connected, Vlan217
O 172.16.1.0/30 [110/2] via 172.17.0.1, 02:30:09, Vlan17
O E1 192.168.99.0/24 [110/2] via 172.17.0.1, 02:30:06, Vlan17
sw3#show ip route vrf c1
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.0.0/24 is directly connected, Vlan16
O 172.16.1.0/30 [110/2] via 172.16.0.1, 00:57:41, Vlan16
O 172.16.2.0/24 [110/2] via 172.16.0.2, 00:57:41, Vlan16
C 172.16.3.0/24 is directly connected, Vlan316
O E1 192.168.99.0/24 [110/2] via 172.16.0.1, 00:57:41, Vlan16
sw3#show ip route vrf c3
172.16.0.0/30 is subnetted, 1 subnets
O 172.16.1.0 [110/2] via 172.18.0.1, 00:57:32, Vlan18
172.18.0.0/24 is subnetted, 2 subnets
C 172.18.3.0 is directly connected, Vlan318
C 172.18.0.0 is directly connected, Vlan18
O E2 192.168.99.0/24 [110/1] via 172.18.0.1, 00:57:32, Vlan18
ვხედავთ რომ ყველა VRF-ს აქვს Shared VRF-ის ქსელი ეხლა გავპინგოთ და ამით დავასრულოთ
sw2#ping vrf c1 ip 192.168.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/45/88 ms
sw2#ping vrf c2 ip 192.168.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/48/84 ms
sw2#
sw3#ping vrf c1 ip 192.168.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/48/140 ms
sw3#ping vrf c3 ip 192.168.99.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.99.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/54/148 ms
sw3#
ყველაფერი მუშაობს ესეც კონფიგ ფაილები და ტოპოლოგია Dynamips-ის