gorosuke5656の日記

ネットワーク好きで個人で色々勉強しています😀 ですので内容はメーカーの公式見解ではありません🙇‍♀️

JuniperのBGP設定におけるLocal-Preference設定と確認

お疲れさまです。。
バタバタしていて最近ブログを更新できてませんでした・・(^^;)

BGP設定におけるLocal-Preferenceの設定と確認を実施したいと思います~

【お品書き】

① Local-preferenceとは?

② Local-preference値の変更及び確認

1 バックアップしていたBGP設定に戻す
2 Ciscoルータが持つネットワーク

   (200.200.200.0/24、210.210.210.0/24、220.220.220.0/24)
  をEBGPで広告する設定を実施します。
 △ Staticルートで1.1.1.1向けのルートを確保する
    POD5/6はデフォルトルートを上位に向ける
    COREは個別ルートを設定
3 Local-Preferenceを設定し、適用します。
  POD6において200.200.200.0/24に対するLocal-Preferenceを設定し、適用します。 
4 設定後、経路情報を確認します。

 

では始めます~

① Local-preferenceとは?

② Local-preference値の変更及び確認

 

1 バックアップしていたBGP設定に戻す 

前回MPLS-L3設定と確認をしていたのでバックアップしていたBGP設定に戻します~

admin@SRX100B> configure
Entering configuration mode

[edit]
admin@SRX100B# load override ?
Possible completions:
  <filename>           Filename (URL, local, remote, or floppy)
  20230513-BGP-conifg-BU.cfg  Size: 6759, Last changed: May 13 00:32:34
  IBGP-config.cfg      Size: 5051, Last changed: Apr 23 02:10:10
  JSEC-begin-config    Size: 1820, Last changed: Jan 04 09:47:07
  MPLS-L3.cfg          Size: 4005, Last changed: May 13 08:32:46
  Policy-BaseVPN-2.cfg  Size: 5670, Last changed: Mar 21 03:19:58
  Policy-BaseVPN.cfg   Size: 4667, Last changed: Mar 05 05:53:43
  terminal             Use login terminal
[edit]
admin@SRX100B# load override 20230513-BGP-conifg-BU.cfg
load complete

[edit]
admin@SRX100B# commit check
warning: uid changed for admin (2002->2001)
configuration check succeeds

[edit]
admin@SRX100B#

2 Ciscoルータが持つネットワーク

   (200.200.200.0/24、210.210.210.0/24、220.220.220.0/24)
  をEBGPで広告する設定を実施します。


〇AS65100のVR1設定
(現状)
admin@SRX100B> show configuration routing-instances VR1 protocols bgp
inactive: traceoptions {
    file BGP-log;
    flag keepalive;
    flag open;
    flag refresh;
    flag update;
}
group INTERNAL {
    type internal;
    local-address 1.1.1.1;
    export INTERNAL-NETWORK-VR1;
    peer-as 65100;
    neighbor 200.200.200.1;
}
group EXTERNAL {
    type external;
    local-address 172.16.200.1;
    export INTERNAL-NETWORK-VR1;
    peer-as 65000;
    neighbor 172.16.200.254;
}

admin@SRX100B>

admin@SRX100B> show configuration policy-options policy-statement INTERNAL-NETWORK-VR1
term 1 {
    from {
        route-filter 1.1.1.1/32 exact;
    }
    then accept;
}

admin@SRX100B>


〇 設定追加
 ア from-cisco-networkというpolicy-statementを作成
 (route-filterを200.200.200.0/24 210.210.210.0/24 220.220.220.0/24を指定) 
[edit]
admin@SRX100B# run show configuration policy-options policy-statement from-cisco-network
term 1 {
    from {
        route-filter 200.200.200.0/24 exact;
        route-filter 210.210.210.0/24 exact;
        route-filter 220.220.220.0/24 exact;
    }
    then accept;
}

イ BGPのexportに対して①のPolicyをエクスポート
admin@SRX100B> show configuration routing-instances VR1 protocols bgp
inactive: traceoptions {
    file BGP-log;
    flag keepalive;
    flag open;
    flag refresh;
    flag update;
}
group INTERNAL {
    type internal;
    local-address 1.1.1.1;
    export INTERNAL-NETWORK-VR1;
    peer-as 65100;
    neighbor 200.200.200.1;
}
group EXTERNAL {
    type external;
    local-address 172.16.200.1;
    export [ INTERNAL-NETWORK-VR1 from-cisco-network ];
    peer-as 65000;
    neighbor 172.16.200.254;
}

admin@SRX100B>

ウ 経路が広告されていることを確認 

admin@SRX100B> show route advertising-protocol bgp 172.16.200.254

VR1.inet.0: 15 destinations, 18 routes (15 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 1.1.1.1/32              Self                                    I
* 200.200.200.0/24        Self                                    I
* 210.210.210.0/24        Self                                    I
* 220.220.220.0/24        Self                                    I

admin@SRX100B>

エ 経路が受信されていることを確認

admin@SRX100B> show route receive-protocol bgp 172.16.200.1

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

VR1.inet.0: 15 destinations, 18 routes (15 active, 0 holddown, 0 hidden)

VR2.inet.0: 15 destinations, 16 routes (15 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
  1.1.1.1/32              172.16.200.1                            65100 I
* 200.200.200.0/24        172.16.200.1                            65100 I
* 210.210.210.0/24        172.16.200.1                            65100 I
* 220.220.220.0/24        172.16.200.1                            65100 I

admin@SRX100B>

〇AS65000のVR2設定
(現状)
admin@SRX100B> show configuration routing-instances VR2 protocols bgp
inactive: traceoptions {
    file BGP-log;
    flag keepalive;
    flag open;
    flag update;
}
group EXTERNAL {
    type external;
    local-address 2.2.2.2;
    export ADV-ROUTE01;
    peer-as 65001;
    neighbor 50.5.1.1 {
        multihop {
            ttl 2;
        }
    }
    neighbor 50.6.1.1 {
        multihop {
            ttl 2;
        }
    }
}
group EXTERNAL-AS65100 {
    type external;
    local-address 172.16.200.254;
    export INTERNAL-NETWORK-VR2;
    peer-as 65100;
    neighbor 172.16.200.1;
}

admin@SRX100B> show configuration policy-options policy-statement ADV-ROUTE01
term 1 {
    from {
        prefix-list ADV-ROUTE;
    }
    then accept;
}


admin@SRX100B> show configuration policy-options prefix-list ADV-ROUTE
1.1.1.1/32;
2.2.2.2/32;
172.16.200.0/24;

admin@SRX100B>

〇設定追加(Ciscoルータが持つ経路をプレフィックスリストに追加)

admin@SRX100B# set policy-options prefix-list ADV-ROUTE 200.200.200.0/24
admin@SRX100B# set policy-options prefix-list ADV-ROUTE 210.210.210.0/24
admin@SRX100B# set policy-options prefix-list ADV-ROUTE 220.220.220.0/24

[edit]
admin@SRX100B# commit check
configuration check succeeds

[edit]
admin@SRX100B# commit
commit complete

〇確認
[edit]
admin@SRX100B# run show configuration policy-options prefix-list ADV-ROUTE
1.1.1.1/32;
2.2.2.2/32;
172.16.200.0/24;
200.200.200.0/24;
210.210.210.0/24;
220.220.220.0/24;

(経路が広告されていることを確認)
admin@SRX100B# run show route advertising-protocol bgp 50.5.1.1

VR2.inet.0: 15 destinations, 16 routes (15 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 1.1.1.1/32              Self                                    I
* 2.2.2.2/32              Self                                    I
* 172.16.200.0/24         Self                                    I
* 200.200.200.0/24        Self                                    65100 I
* 210.210.210.0/24        Self                                    65100 I
* 220.220.220.0/24        Self                                    65100 I

[edit]
admin@SRX100B# run show route advertising-protocol bgp 50.6.1.1

VR2.inet.0: 15 destinations, 16 routes (15 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 1.1.1.1/32              Self                                    I
* 2.2.2.2/32              Self                                    I
* 172.16.200.0/24         Self                                    I
* 200.200.200.0/24        Self                                    65100 I
* 210.210.210.0/24        Self                                    65100 I
* 220.220.220.0/24        Self                                    65100 I

[edit]
admin@SRX100B#

〇 Ciscoルータが持つ経路が広告されているかを確認

admin@SRX100B> show route protocol bgp

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

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

2.2.2.2/32         *[BGP/170] 00:17:50, localpref 100
                      AS path: 65000 I
                    > to 172.16.200.254 via fe-0/0/3.0
10.1.5.0/24        *[BGP/170] 00:17:50, localpref 100
                      AS path: 65000 65001 I
                    > to 172.16.200.254 via fe-0/0/3.0
10.1.6.0/24        *[BGP/170] 00:17:50, localpref 100
                      AS path: 65000 65001 I
                    > to 172.16.200.254 via fe-0/0/3.0
200.200.200.0/24    [BGP/170] 00:17:54, MED 0, localpref 100, from 200.200.200.1
                      AS path: ?
                    > to 172.16.210.1 via fe-0/0/5.0
210.210.210.0/24    [BGP/170] 00:17:54, MED 0, localpref 100, from 200.200.200.1
                      AS path: I
                    > to 172.16.210.1 via fe-0/0/5.0
220.220.220.0/24    [BGP/170] 00:17:54, MED 0, localpref 100, from 200.200.200.1
                      AS path: ?
                    > to 172.16.210.1 via fe-0/0/5.0

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

1.1.1.1/32          [BGP/170] 00:17:50, localpref 100
                      AS path: 65100 I
                    > to 172.16.200.1 via fe-0/0/0.0
10.1.5.0/24        *[BGP/170] 00:17:54, localpref 100, from 50.5.1.1
                      AS path: 65001 I
                    > to 172.16.5.254 via fe-0/0/1.0
10.1.6.0/24        *[BGP/170] 00:17:50, localpref 100, from 50.6.1.1
                      AS path: 65001 I
                    > to 172.16.6.254 via fe-0/0/2.0
200.200.200.0/24   *[BGP/170] 00:17:50, localpref 100
                      AS path: 65100 I
                    > to 172.16.200.1 via fe-0/0/0.0
210.210.210.0/24   *[BGP/170] 00:17:50, localpref 100
                      AS path: 65100 I
                    > to 172.16.200.1 via fe-0/0/0.0
220.220.220.0/24   *[BGP/170] 00:17:50, localpref 100
                      AS path: 65100 I
                    > to 172.16.200.1 via fe-0/0/0.0

admin@SRX100B>

〇 Ciscoルータが持つ経路(200.200.200.0/24)を確認

admin@SRX100H2> show route 200.200.200.0/24

【POD6:VR1】
VR1.inet.0: 19 destinations, 26 routes (19 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

200.200.200.0/24   *[BGP/170] 01:24:04, localpref 100, from 2.2.2.2
                      AS path: 65000 65100 I
                    > to 172.16.6.1 via fe-0/0/4.0
                    [BGP/170] 01:24:04, localpref 100, from 50.5.1.1
                      AS path: 65000 65100 I
                    > to 172.16.6.1 via fe-0/0/4.0

【POD5:VR2】
VR2.inet.0: 19 destinations, 26 routes (19 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

200.200.200.0/24   *[BGP/170] 01:24:04, localpref 100, from 2.2.2.2
                      AS path: 65000 65100 I
                    > to 172.16.5.1 via fe-0/0/0.0
                    [BGP/170] 01:24:04, localpref 100, from 50.6.1.1
                      AS path: 65000 65100 I
                      to 172.30.3.6 via fe-0/0/1.0
                    > to 172.30.30.6 via fe-0/0/2.0

 

 

Local_Preferrence値の変更が有効になっていることが確認できました!(;^_^A