Cisco VRF BGP Routing

Anlegen von VRFs und das Routing per BGP
Die PCs haben im entsprechenden Netz immer die .100 als Adresse
Router 1
hostname R1
!
!
ip vrf A
description VRF-A
rd 1:1
!
ip vrf B
description VRF-B
rd 1:2
!
interface GigabitEthernet1
ip vrf forwarding A
ip address 10.1.0.1 255.255.255.0
negotiation auto
ipv6 enable
!
interface GigabitEthernet2
ip vrf forwarding B
ip address 10.1.0.1 255.255.255.0
negotiation auto
ipv6 enable
!
interface GigabitEthernet4
no ip address
negotiation auto
!
interface GigabitEthernet4.2
encapsulation dot1Q 2
ip vrf forwarding A
ip address 10.1.2.1 255.255.255.252
ipv6 enable
!
interface GigabitEthernet4.3
encapsulation dot1Q 3
ip vrf forwarding B
ip address 10.1.2.1 255.255.255.252
ipv6 enable
!
router bgp 65000
bgp router-id 1.1.1.1
bgp log-neighbor-changes
!
address-family ipv4 vrf A
network 10.1.0.0 mask 255.255.255.0
neighbor 10.1.2.2 remote-as 65000
neighbor 10.1.2.2 activate
exit-address-family
!
address-family ipv4 vrf B
network 10.1.0.0 mask 255.255.255.0
neighbor 10.1.2.2 remote-as 65000
neighbor 10.1.2.2 activate
exit-address-family
!
Router 2
hostname R2
!
ip vrf A
description VRF-A
rd 1:1
!
ip vrf B
description VRF-B
rd 1:2
!
!
no ip domain lookup
!
interface GigabitEthernet1
ip vrf forwarding A
ip address 10.2.0.1 255.255.255.0
negotiation auto
ipv6 enable
!
interface GigabitEthernet2
ip vrf forwarding B
ip address 10.2.0.1 255.255.255.0
negotiation auto
ipv6 enable
!
interface GigabitEthernet4
no ip address
negotiation auto
!
interface GigabitEthernet4.2
encapsulation dot1Q 2
ip vrf forwarding A
ip address 10.1.2.2 255.255.255.252
ipv6 enable
!
interface GigabitEthernet4.3
encapsulation dot1Q 3
ip vrf forwarding B
ip address 10.1.2.2 255.255.255.252
ipv6 enable
!
router bgp 65000
bgp router-id 2.2.2.2
bgp log-neighbor-changes
!
address-family ipv4 vrf A
network 10.2.0.0 mask 255.255.255.0
neighbor 10.1.2.1 remote-as 65000
neighbor 10.1.2.1 activate
exit-address-family
!
address-family ipv4 vrf B
network 10.2.0.0 mask 255.255.255.0
neighbor 10.1.2.1 remote-as 65000
neighbor 10.1.2.1 activate
exit-address-family
!
Überprüfung
R1# sh bgp vrf A
% Command accepted but obsolete, unreleased or unsupported; see documentation.
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path, L long-lived-stale,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 1:1 (default for vrf A)
*> 10.1.0.0/24 0.0.0.0 0 32768 i
*>i 10.2.0.0/24 10.1.2.2 0 100 0 i
R1# sh bgp vrf B
% Command accepted but obsolete, unreleased or unsupported; see documentation.
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path, L long-lived-stale,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 1:2 (default for vrf B)
*> 10.1.0.0/24 0.0.0.0 0 32768 i
*>i 10.2.0.0/24 10.1.2.2 0 100 0 i
R1#sh ip route vrf A bgp
Routing Table: A
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
B 10.2.0.0/24 [200/0] via 10.1.2.2, 00:09:11
R1#sh ip route vrf A bgp
Routing Table: A
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
B 10.2.0.0/24 [200/0] via 10.1.2.2, 00:09:11