底辺エンジニアの備忘録

30過ぎて、記憶力低下が著しい為、メモ代わりにしていく予定。 自身のスキルが低いので、内容の正確さは保障できません・・・OTL

JUNIPER_VRF

Ciscoはルーティングテーブルを分割する方法としてVRFがあるけど、JUNOSはVRFとVirtual Routerの2種類の方法がある。

 Virtual Routerの方は比較的探しやすいので、今回はVRFの方をやってみる。

構成はこんな感じ

 

[vSRX][ge-0/0/0]----------[Gi2][CSR1kv]


ついでにBGPの設定をいれてみて確認まで

 

まずはとっつきやすいCiscoの方から
Config

 !
ip vrf VRF1
 rd 65000:1
 route-target export 65000:1
 route-target import 65000:1
!
interface Loopback0
 ip vrf forwarding VRF1
 ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet2
 ip vrf forwarding VRF1
 ip address 10.1.1.1 255.255.255.0
 negotiation auto
!
router bgp 65000
 bgp log-neighbor-changes
 !
 address-family ipv4 vrf VRF1
  network 1.1.1.1 mask 255.255.255.255
  neighbor 10.1.1.2 remote-as 65001
  neighbor 10.1.1.2 activate
  neighbor 10.1.1.2 soft-reconfiguration inbound
 exit-address-family
!

 

 次はvSRXの方

set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.2/24
set interfaces lo0 unit 0 family inet address 2.2.2.2/32

set routing-options autonomous-system 65001

set policy-options prefix-list LOCAL 2.2.2.2/32
set policy-options policy-statement To_BGP term 1 from prefix-list LOCAL
set policy-options policy-statement To_BGP term 1 then accept

# Cisco の ip vrf VRF1
set routing-instances VRF1 instance-type vrf
# Ciscoの ip forwarding vrf
set routing-instances VRF1 interface ge-0/0/0.0
set routing-instances VRF1 interface lo0.0
set routing-instances VRF1 route-distinguisher 65000:1
set routing-instances VRF1 vrf-target import target:65000:1
set routing-instances VRF1 vrf-target export target:65000:1
set routing-instances VRF1 protocols bgp peer-as 65000
set routing-instances VRF1 protocols bgp group ext type external
set routing-instances VRF1 protocols bgp group ext export To_BGP
set routing-instances VRF1 protocols bgp group ext neighbor 10.1.1.1

 

これでBGPが張られているかを確認してみる
Cisco

#show bgp vpnv4 unicast vrf VRF1 neighbors 10.1.1.2
BGP neighbor is 10.1.1.2, vrf VRF1, remote AS 65001, external link
  BGP version 4, remote router ID 2.2.2.2
  BGP state = Established, up for 00:03:23
  Last read 00:00:04, last write 00:00:15, hold time is 90, keepalive interval is 30 seconds
  Neighbor sessions:
~~略~~

 JUNOS

 # run show bgp neighbor
Peer: 10.1.1.1+20970 AS 65000 Local: 10.1.1.2+179 AS 65001
  Group: ext Routing-Instance: VRF1
  Forwarding routing-instance: VRF1
  Type: External State: Established Flags: <Sync>
  Last State: OpenConfirm Last Event: RecvKeepAlive
  Last Error: None
  Export: [ To_BGP ]
  Options: <Preference PeerAS Refresh>
  Holdtime: 90 Preference: 170
  Number of flaps: 4
  Last flap event: TransportError
  Peer ID: 192.168.2.202 Local ID: 2.2.2.2 Active Holdtime: 90
  Keepalive Interval: 30 Group index: 1 Peer index: 0 SNMP index: 2

~~略~~

 

問題なさそう。
では実際にCisco側でJUNOSが広告した2.2.2.2が見えるか確認

#show ip route vrf VRF1 bgp        
   2.0.0.0/32 is subnetted, 1 subnets
B    2.2.2.2 [20/0] via 10.1.1.2, 00:15:26

 

JUNOS側では、Ciscoが広告した1.1.1.1が見えるか確認

# run show route protocol bgp         

inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)

VRF1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

1.1.1.1/32     *[BGP/170] 00:10:41, MED 0, localpref 100
           AS path: 65000 I, validation-state: unverified
          > to 10.1.1.1 via ge-0/0/0.0

 

おわり