LoginSignup
2
3

More than 5 years have passed since last update.

BGP Route ServerによるWAN経路の一元管理 #1

Last updated at Posted at 2018-06-30

分量が多くなりそうなので、2回に分けて記載します

  • 第1回:BGP Route Serverを用いたWANネットワーク設計 ← 今回はココ
  • 第2回:BGP Route ServerによるWAN経路の一元管理

BGP Route Serverを用いたWANネットワーク設計

以前、 BGP Route ReflectorとBGP Route Server で軽く触れましたが、BGP Route Serverを利用するとそこそこ柔軟に、かつスケールアウトしやすいWANネットワークを構築できます(WANがL2網であることが前提ですが)。早速ですがネットワーク設計を行っていきます。

ネットワーク構成

BGP RS.jpg

AS65001がデータセンターでBGP Route Serverが設置されており、AS65010 - 65012が本社・ブランチのWANルータだと思ってください。AS65010 - 65012のルータはWAN #1, #2それぞれの面でBGP Route Serverとピアリングします。各ASのルータ機種、利用アドレスは以下のとおりです。

AS番号 機種 WAN#1 IP add. WAN #2 IP add. loopback IP add. LAN IP add.
65001 Cisco 841MJ 10.1.0.1/24 10.2.0.1/24
65010 Cisco 1812J 10.1.0.10/24 10.2.0.10/24 10.0.0.10/32 172.16.1.1/24
65011 Edge Router X 10.1.0.11/24 10.2.0.11/24 10.0.0.11/32 172.16.2.1/24
65012 Juniper SRX 100H 10.1.0.12/24 10.2.0.12/24 10.0.0.12/32 172.16.3.1/24

AS65010 - 65012の各ルータは非トランジットAS(他のASから受信した経路情報を転送しない)とし、WAN #1経由で送出するルートにMED 10を、WAN #2経由で送出するルートにMED 20を付与して、常にWAN #1が優先されるように設計します。また、後ほど理由を説明しますが経路送出時にCOMMUNITYアトリビュートを付与します。各ルータのコンフィグは以下のとおりです。

AS65001_Cisco841MJ(BGP_Route_Server)
hostname R65001
no ip domain-lookup

int giga 0/4
   description WAN #1
   ip address 10.1.0.1 255.255.255.0
   no shutdown

int giga 0/5
   description WAN #2
   ip address 10.2.0.1 255.255.255.0
   no shutdown

router bgp 65001
 route-server-context WAN1_CONTEXT
  address-family ipv4 unicast
   import-map WAN1_IM
  exit-address-family
 exit-route-server-context

 route-server-context WAN2_CONTEXT
  address-family ipv4 unicast
   import-map WAN2_IM
  exit-address-family
 exit-route-server-context

bgp router-id 10.0.0.1
 bgp always-compare-med
 bgp log-neighbor-changes
 timers bgp 3 20
 neighbor 10.1.0.10 remote-as 65010
 neighbor 10.1.0.11 remote-as 65011
 neighbor 10.1.0.12 remote-as 65012
 neighbor 10.2.0.10 remote-as 65010
 neighbor 10.2.0.11 remote-as 65011
 neighbor 10.2.0.12 remote-as 65012

 address-family ipv4
  neighbor 10.1.0.10 activate
  neighbor 10.1.0.10 send-community
  neighbor 10.1.0.10 route-server-client context WAN1_CONTEXT
  neighbor 10.1.0.10 route-map WAN1_OUT out
  neighbor 10.1.0.11 activate
  neighbor 10.1.0.11 send-community
  neighbor 10.1.0.11 route-server-client context WAN1_CONTEXT
  neighbor 10.1.0.11 route-map WAN1_OUT out
  neighbor 10.1.0.12 activate
  neighbor 10.1.0.12 send-community
  neighbor 10.1.0.12 route-server-client context WAN1_CONTEXT
  neighbor 10.1.0.12 route-map WAN1_OUT out
  neighbor 10.2.0.10 activate
  neighbor 10.2.0.10 send-community
  neighbor 10.2.0.10 route-server-client context WAN2_CONTEXT
  neighbor 10.2.0.10 route-map WAN2_OUT out
  neighbor 10.2.0.11 activate
  neighbor 10.2.0.11 send-community
  neighbor 10.2.0.11 route-server-client context WAN2_CONTEXT
  neighbor 10.2.0.11 route-map WAN2_OUT out
  neighbor 10.2.0.12 activate
  neighbor 10.2.0.12 send-community
  neighbor 10.2.0.12 route-server-client context WAN2_CONTEXT
  neighbor 10.2.0.12 route-map WAN2_OUT out
 exit-address-family


ip bgp-community new-format
ip community-list 1 permit 65001:1
ip community-list 2 permit 65001:2

route-map WAN2_IM permit 10
 match community 2

route-map WAN1_IM permit 10
 match community 1

route-map WAN1_OUT permit 100
 set community none

route-map WAN2_OUT permit 100
 set community none

AS65010_Cisco1812J
hostname R65010

interface Loopback0
 ip address 10.0.0.10 255.255.255.255

interface Loopback1
 description LAN
 ip address 172.16.1.1 255.255.255.0

interface FastEthernet0
 description WAN #1
 ip address 10.1.0.10 255.255.255.0
 duplex auto
 speed auto

interface FastEthernet1
 description WAN #2
 ip address 10.2.0.10 255.255.255.0
 duplex auto
 speed auto

router bgp 65010
 bgp router-id 10.0.0.10
 bgp always-compare-med
 no bgp enforce-first-as
 bgp log-neighbor-changes
 timers bgp 3 20
 neighbor 10.1.0.1 remote-as 65001
 neighbor 10.2.0.1 remote-as 65001

 address-family ipv4
  neighbor 10.1.0.1 activate
  neighbor 10.1.0.1 send-community
  neighbor 10.1.0.1 route-map AS65001_WAN1_OUT out
  neighbor 10.2.0.1 activate
  neighbor 10.2.0.1 send-community
  neighbor 10.2.0.1 route-map AS65001_WAN2_OUT out
  no auto-summary
  no synchronization
  network 10.0.0.10 mask 255.255.255.255
  network 172.16.1.0 mask 255.255.255.0
 exit-address-family

ip bgp-community new-format
ip as-path access-list 1 permit ^$

route-map AS65001_WAN2_OUT permit 10
 match as-path 1
 set metric 20
 set community 65001:2

route-map AS65001_WAN1_OUT permit 10
 match as-path 1
 set metric 10
 set community 65001:1
AS65011_EdgeRouter-X
set interfaces ethernet eth0 address 192.168.1.102/24
set interfaces ethernet eth0 duplex auto
set interfaces ethernet eth0 speed auto
set interfaces ethernet eth1 address 10.1.0.11/24
set interfaces ethernet eth1 description 'WAN #1'
set interfaces ethernet eth1 duplex auto
set interfaces ethernet eth1 speed auto
set interfaces ethernet eth2 address 10.2.0.11/24
set interfaces ethernet eth2 description 'WAN #2'
set interfaces ethernet eth2 duplex auto
set interfaces ethernet eth2 speed auto
set interfaces ethernet eth3 address 172.16.2.1/24
set interfaces ethernet eth3 description LAN
set interfaces ethernet eth3 duplex auto
set interfaces ethernet eth3 speed auto
set interfaces ethernet eth4 duplex auto
set interfaces ethernet eth4 speed auto
set interfaces loopback lo address 10.0.0.11/32
set interfaces switch switch0 mtu 1500
set policy as-path-list My-AS rule 10 action permit
set policy as-path-list My-AS rule 10 regex '^$'
set policy route-map AS65001-WAN1-OUT rule 10 action permit
set policy route-map AS65001-WAN1-OUT rule 10 match as-path My-AS
set policy route-map AS65001-WAN1-OUT rule 10 set community '65001:1'
set policy route-map AS65001-WAN1-OUT rule 10 set metric 10
set policy route-map AS65001-WAN2-OUT rule 10 action permit
set policy route-map AS65001-WAN2-OUT rule 10 match as-path My-AS
set policy route-map AS65001-WAN2-OUT rule 10 set community '65001:2'
set policy route-map AS65001-WAN2-OUT rule 10 set metric 20
set protocols bgp 65011 neighbor 10.1.0.1 remote-as 65001
set protocols bgp 65011 neighbor 10.1.0.1 route-map export AS65001-WAN1-OUT
set protocols bgp 65011 neighbor 10.1.0.1 soft-reconfiguration inbound
set protocols bgp 65011 neighbor 10.2.0.1 remote-as 65001
set protocols bgp 65011 neighbor 10.2.0.1 route-map export AS65001-WAN2-OUT
set protocols bgp 65011 neighbor 10.2.0.1 soft-reconfiguration inbound
set protocols bgp 65011 network 10.0.0.11/32
set protocols bgp 65011 network 172.16.2.0/24
set protocols bgp 65011 parameters always-compare-med
set protocols bgp 65011 parameters router-id 10.0.0.11
set protocols bgp 65011 timers holdtime 20
set protocols bgp 65011 timers keepalive 3
AS65102_Juniper_SRX100H
set system host-name R65012
set interfaces fe-0/0/0 unit 0
set interfaces fe-0/0/1 unit 0 description LAN
set interfaces fe-0/0/1 unit 0 family inet address 172.16.3.1/24
set interfaces fe-0/0/2 unit 0 description "WAN #1"
set interfaces fe-0/0/2 unit 0 family inet address 10.1.0.12/24
set interfaces fe-0/0/3 unit 0 description "WAN #2"
set interfaces fe-0/0/3 unit 0 family inet address 10.2.0.12/24
set interfaces fe-0/0/4 unit 0
set interfaces fe-0/0/5 unit 0
set interfaces fe-0/0/6 unit 0
set interfaces fe-0/0/7 unit 0
set interfaces lo0 unit 0 family inet address 10.0.0.12/32
set routing-options router-id 10.0.0.12
set routing-options autonomous-system 65012
set protocols bgp path-selection always-compare-med
set protocols bgp group EXT type external
set protocols bgp group EXT hold-time 20
set protocols bgp group EXT neighbor 10.1.0.1 export AS65001_WAN1_OUT
set protocols bgp group EXT neighbor 10.1.0.1 peer-as 65001
set protocols bgp group EXT neighbor 10.2.0.1 export AS65001_WAN2_OUT
set protocols bgp group EXT neighbor 10.2.0.1 peer-as 65001
set policy-options policy-statement AS65001_WAN1_OUT term 1 from as-path null-as
set policy-options policy-statement AS65001_WAN1_OUT term 1 then metric 10
set policy-options policy-statement AS65001_WAN1_OUT term 1 then community set COMM1
set policy-options policy-statement AS65001_WAN1_OUT term 1 then accept
set policy-options policy-statement AS65001_WAN1_OUT term 2 then reject
set policy-options policy-statement AS65001_WAN2_OUT term 1 from as-path null-as
set policy-options policy-statement AS65001_WAN2_OUT term 1 then metric 20
set policy-options policy-statement AS65001_WAN2_OUT term 1 then community set COMM2
set policy-options policy-statement AS65001_WAN2_OUT term 1 then accept
set policy-options policy-statement AS65001_WAN2_OUT term 2 then reject
set policy-options community COMM1 members 65001:1
set policy-options community COMM2 members 65001:2
set policy-options as-path null-as "()"
set security policies from-zone trust to-zone trust policy permit-all match source-address any
set security policies from-zone trust to-zone trust policy permit-all match destination-address any
set security policies from-zone trust to-zone trust policy permit-all match application any
set security policies from-zone trust to-zone trust policy permit-all then permit
set security zones security-zone trust host-inbound-traffic system-services all
set security zones security-zone trust host-inbound-traffic protocols all
set security zones security-zone trust interfaces fe-0/0/2.0
set security zones security-zone trust interfaces fe-0/0/3.0
set security zones security-zone trust interfaces fe-0/0/1.0
set security zones security-zone trust interfaces lo0.0

今回はBGP Route Server(AS65001)でRoute Server Contextという機能を使っています。イメージとしてはルーティングテーブルで言うVRFのBGPテーブル版です。WAN #1で受信したBGPの経路情報はWAN #1に接続されている他のルータに、WAN #2で受信したBGPの経路情報はWAN #2に接続されている他のルータに転送しないといけないわけですが、BGP Route ServerのBGPテーブルが1つだと、WAN #1とWAN #2から受信した経路情報が1つのテーブルで管理されることになり、経路情報の強さによりどちらかの情報が消失します。それだと経路の二重化ができないのでBGPテーブルを2つに分ける必要があります。物理的にBGP Route Serverを2台に分けるという手もありますが、今回はRoute Server Contextという機能を使って、1台のルータの中でBGPテーブルを2つ持たせます。

Route Server Contextを使うと、1台のルータにBGPテーブルが2つできるため、WAN #1, WAN #2から受信した経路情報を適切なBGPテーブルに格納するための処理が必要となります。追加の処理として、AS65010 - 65012の各ルータで、経路情報を送信する際にCommunityアトリビュートを付与します。具体的には、WAN #1経由で経路情報を送出するときは「65001:1」というアトリビュートを、WAN #2経由で経路情報を送出するときは「65001:2」というアトリビュートを付与します。BGP Route Serverは経路情報を受信時にCommunityアトリビュートを見て適切なBGPテーブルに経路情報を格納します。また、受信した経路情報を他のルータに転送する際、Communityアトリビュートを削除します。BGP Route Server Contextについて詳しく知りたい方は、以下リンク先をご参照ください。

Configuring a BGP Route Server

通信経路確認

BGP Route Server(AS65001)で、BGPテーブルを見ると以下のような状態になっています。

AS65001_Cisco841MJ
R65001#sh ip bgp
〜省略〜
     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.10/32     10.1.0.10               10             0 65010 i
 *                    10.2.0.10               20             0 65010 i
 *>  10.0.0.11/32     10.1.0.11               10             0 65011 i
 *                    10.2.0.11               20             0 65011 i
 *   10.0.0.12/32     10.2.0.12               20             0 65012 i
 *>                   10.1.0.12               10             0 65012 i
 r   10.1.0.0/24      10.2.0.12               20             0 65012 i
 r>                   10.1.0.12               10             0 65012 i
 r   10.2.0.0/24      10.2.0.12               20             0 65012 i
 r>                   10.1.0.12               10             0 65012 i
 *>  172.16.1.0/24    10.1.0.10               10             0 65010 i
 *                    10.2.0.10               20             0 65010 i
 *>  172.16.2.0/24    10.1.0.11               10             0 65011 i
 *                    10.2.0.11               20             0 65011 i
 *   172.16.3.0/24    10.2.0.12               20             0 65012 i
 *>                   10.1.0.12               10             0 65012 i

WAN #1, WAN #2双方から経路情報が届いていますが、ベストルートとして選択されている(">"がついている)経路はWAN #1経由の経路のみであり、WAN #2から来た経路情報が消失します。次に、各Contextの中身を見ます。

AS65001_Cisco841MJ
R65001#sh ip bgp route-server context WAN1_CONTEXT 
〜省略〜
Networks for route server context WAN1_CONTEXT:
   Network          Next Hop            Metric LocPrf Weight Path
 *>  10.0.0.10/32     10.1.0.10               10             0 65010 i
 *>  10.0.0.11/32     10.1.0.11               10             0 65011 i
 *>  10.0.0.12/32     10.1.0.12               10             0 65012 i
 r>  10.1.0.0/24      10.1.0.12               10             0 65012 i
 r>  10.2.0.0/24      10.1.0.12               10             0 65012 i
 *>  172.16.1.0/24    10.1.0.10               10             0 65010 i
 *>  172.16.2.0/24    10.1.0.11               10             0 65011 i
 *>  172.16.3.0/24    10.1.0.12               10             0 65012 i
AS65001_Cisco841MJ
R65001#sh ip bgp route-server context WAN2_CONTEXT 
〜省略〜
Networks for route server context WAN2_CONTEXT:
   Network          Next Hop            Metric LocPrf Weight Path
 *   10.0.0.10/32     10.2.0.10               20             0 65010 i
 *   10.0.0.11/32     10.2.0.11               20             0 65011 i
 *   10.0.0.12/32     10.2.0.12               20             0 65012 i
 r   10.1.0.0/24      10.2.0.12               20             0 65012 i
 r   10.2.0.0/24      10.2.0.12               20             0 65012 i
 *   172.16.1.0/24    10.2.0.10               20             0 65010 i
 *   172.16.2.0/24    10.2.0.11               20             0 65011 i
 *   172.16.3.0/24    10.2.0.12               20             0 65012 i

それぞれのContextの中には、WAN#1, WAN#2経由で届いた経路情報が分割されて格納されていることがわかります。Contextの利用によって、WAN#2の経路情報の消失を防ぎます。

AS65010 - 65012の各ルータから見たBGPピアリング、BGPテーブル、ルーティングテーブルの状態、Pingの結果は以下のとおりです。

AS65010_Cisco1812J
R65010#sh ip bgp summ
〜省略〜

Neighbor        V          AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.0.1        4      65001    3543    3291       80    0    0 00:58:42        6
10.2.0.1        4      65001    3512    3273       80    0    0 00:00:17        2



R65010#sh ip bgp
〜省略〜

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.0.10/32     0.0.0.0                  0         32768 i
*  10.0.0.11/32     10.2.0.11               20             0 65011 i
*>                  10.1.0.11               10             0 65011 i
*  10.0.0.12/32     10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i
r  10.1.0.0/24      10.2.0.12               20             0 65012 i
r>                  10.1.0.12               10             0 65012 i
r  10.2.0.0/24      10.2.0.12               20             0 65012 i
r>                  10.1.0.12               10             0 65012 i
*> 172.16.1.0/24    0.0.0.0                  0         32768 i
*  172.16.2.0/24    10.2.0.11               20             0 65011 i
*>                  10.1.0.11               10             0 65011 i
*  172.16.3.0/24    10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i



R65010#sh ip route
〜省略〜

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback1
B       172.16.2.0 [20/10] via 10.1.0.11, 00:59:24
B       172.16.3.0 [20/10] via 10.1.0.12, 00:21:54
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.0.0.10/32 is directly connected, Loopback0
B       10.0.0.11/32 [20/10] via 10.1.0.11, 00:59:24
B       10.0.0.12/32 [20/10] via 10.1.0.12, 00:21:54
C       10.2.0.0/24 is directly connected, FastEthernet1
C       10.1.0.0/24 is directly connected, FastEthernet0



R65010#ping 172.16.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

R65010#ping 172.16.3.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
AS65011_EdgeRouter-X
ubnt@ubnt2:~$ show ip bgp summary 
BGP router identifier 10.0.0.11, local AS number 65011
IPv4 Unicast - max multipaths: ebgp 1 ibgp 1
RIB entries 15, using 960 bytes of memory
Peers 2, using 5048 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.0.1        4 65001    1514     856        0    0    0 01:05:17        6
10.2.0.1        4 65001    1505     854        0    0    0 00:06:39        6

Total number of neighbors 2


ubnt@ubnt2:~$ show ip bgp
BGP table version is 0, local router ID is 10.0.0.11
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  10.0.0.10/32     10.2.0.10               20             0 65010 i
*>                  10.1.0.10               10             0 65010 i
*> 10.0.0.11/32     0.0.0.0                  1         32768 i
*  10.0.0.12/32     10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i
*  10.1.0.0/24      10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i
*  10.2.0.0/24      10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i
*  172.16.1.0/24    10.2.0.10               20             0 65010 i
*>                  10.1.0.10               10             0 65010 i
*> 172.16.2.0/24    0.0.0.0                  1         32768 i
*  172.16.3.0/24    10.2.0.12               20             0 65012 i
*>                  10.1.0.12               10             0 65012 i

Total number of prefixes 8



ubnt@ubnt2:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

B>* 10.0.0.10/32 [20/10] via 10.1.0.10, eth1, 01:04:45
C>* 10.0.0.11/32 is directly connected, lo
B>* 10.0.0.12/32 [20/10] via 10.1.0.12, eth1, 00:27:43
B   10.1.0.0/24 [20/10] via 10.1.0.12 inactive, 00:27:43
C>* 10.1.0.0/24 is directly connected, eth1
B   10.2.0.0/24 [20/10] via 10.1.0.12, 00:27:43
C>* 10.2.0.0/24 is directly connected, eth2
C>* 127.0.0.0/8 is directly connected, lo
B>* 172.16.1.0/24 [20/10] via 10.1.0.10, eth1, 01:04:45
C>* 172.16.2.0/24 is directly connected, eth3
B>* 172.16.3.0/24 [20/10] via 10.1.0.12, eth1, 00:27:43
C>* 192.168.1.0/24 is directly connected, eth0



ubnt@ubnt2:~$ ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1) 56(84) bytes of data.
64 bytes from 172.16.1.1: icmp_req=1 ttl=255 time=0.688 ms
64 bytes from 172.16.1.1: icmp_req=2 ttl=255 time=0.682 ms
64 bytes from 172.16.1.1: icmp_req=3 ttl=255 time=0.653 ms
64 bytes from 172.16.1.1: icmp_req=4 ttl=255 time=0.669 ms
64 bytes from 172.16.1.1: icmp_req=5 ttl=255 time=0.688 ms
^C
--- 172.16.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms
rtt min/avg/max/mdev = 0.653/0.676/0.688/0.013 ms

ubnt@ubnt2:~$ ping 172.16.3.1
PING 172.16.3.1 (172.16.3.1) 56(84) bytes of data.
64 bytes from 172.16.3.1: icmp_req=1 ttl=64 time=0.814 ms
64 bytes from 172.16.3.1: icmp_req=2 ttl=64 time=0.734 ms
64 bytes from 172.16.3.1: icmp_req=3 ttl=64 time=0.767 ms
64 bytes from 172.16.3.1: icmp_req=4 ttl=64 time=0.791 ms
64 bytes from 172.16.3.1: icmp_req=5 ttl=64 time=0.861 ms
^C
--- 172.16.3.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 0.734/0.793/0.861/0.049 ms
AS65012_Juniper_SRX100
root@R65012> show bgp summary                            
Groups: 2 Peers: 2 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0               
                       8          4          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
10.1.0.1              65001        704        400       0       5       35:45 4/4/4/0              0/0/0/0
10.2.0.1              65001        289        166       0       6       14:39 0/4/4/0              0/0/0/0



root@R65012> show route receive-protocol bgp 10.1.0.1    

inet.0: 11 destinations, 15 routes (11 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 10.0.0.10/32            10.1.0.10            10                 65010 I
* 10.0.0.11/32            10.1.0.11            10                 65011 I
* 172.16.1.0/24           10.1.0.10            10                 65010 I
* 172.16.2.0/24           10.1.0.11            10                 65011 I

root@R65012> show route receive-protocol bgp 10.2.0.1    

inet.0: 11 destinations, 15 routes (11 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
  10.0.0.10/32            10.2.0.10            20                 65010 I
  10.0.0.11/32            10.2.0.11            20                 65011 I
  172.16.1.0/24           10.2.0.10            20                 65010 I
  172.16.2.0/24           10.2.0.11            20                 65011 I


root@R65012> show route                 

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

10.0.0.10/32       *[BGP/170] 00:36:30, MED 10, localpref 100, from 10.1.0.1
                      AS path: 65010 I
                    > to 10.1.0.10 via fe-0/0/2.0
                    [BGP/170] 00:14:56, MED 20, localpref 100, from 10.2.0.1
                      AS path: 65010 I
                    > to 10.2.0.10 via fe-0/0/3.0
10.0.0.11/32       *[BGP/170] 00:36:30, MED 10, localpref 100, from 10.1.0.1
                      AS path: 65011 I
                    > to 10.1.0.11 via fe-0/0/2.0
                    [BGP/170] 00:15:24, MED 20, localpref 100, from 10.2.0.1
                      AS path: 65011 I
                    > to 10.2.0.11 via fe-0/0/3.0
10.0.0.12/32       *[Direct/0] 02:46:14
                    > via lo0.0
10.1.0.0/24        *[Direct/0] 02:25:46
                    > via fe-0/0/2.0
10.1.0.12/32       *[Local/0] 03:06:22
                      Local via fe-0/0/2.0
10.2.0.0/24        *[Direct/0] 02:11:03
                    > via fe-0/0/3.0    
10.2.0.12/32       *[Local/0] 03:06:22
                      Local via fe-0/0/3.0
172.16.1.0/24      *[BGP/170] 00:36:30, MED 10, localpref 100, from 10.1.0.1
                      AS path: 65010 I
                    > to 10.1.0.10 via fe-0/0/2.0
                    [BGP/170] 00:14:56, MED 20, localpref 100, from 10.2.0.1
                      AS path: 65010 I
                    > to 10.2.0.10 via fe-0/0/3.0
172.16.2.0/24      *[BGP/170] 00:36:30, MED 10, localpref 100, from 10.1.0.1
                      AS path: 65011 I
                    > to 10.1.0.11 via fe-0/0/2.0
                    [BGP/170] 00:15:24, MED 20, localpref 100, from 10.2.0.1
                      AS path: 65011 I
                    > to 10.2.0.11 via fe-0/0/3.0
172.16.3.0/24      *[Direct/0] 01:49:10
                    > via fe-0/0/1.0
172.16.3.1/32      *[Local/0] 01:49:19
                      Local via fe-0/0/1.0



root@R65012> ping 172.16.1.1 
PING 172.16.1.1 (172.16.1.1): 56 data bytes
64 bytes from 172.16.1.1: icmp_seq=0 ttl=255 time=2.594 ms
64 bytes from 172.16.1.1: icmp_seq=1 ttl=255 time=2.108 ms
64 bytes from 172.16.1.1: icmp_seq=2 ttl=255 time=2.438 ms
64 bytes from 172.16.1.1: icmp_seq=3 ttl=255 time=2.298 ms
64 bytes from 172.16.1.1: icmp_seq=4 ttl=255 time=2.736 ms
^C
--- 172.16.1.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.108/2.435/2.736/0.220 ms


root@R65012> ping 172.16.2.1    
PING 172.16.2.1 (172.16.2.1): 56 data bytes
64 bytes from 172.16.2.1: icmp_seq=0 ttl=64 time=2.366 ms
64 bytes from 172.16.2.1: icmp_seq=1 ttl=64 time=2.263 ms
64 bytes from 172.16.2.1: icmp_seq=2 ttl=64 time=2.440 ms
64 bytes from 172.16.2.1: icmp_seq=3 ttl=64 time=2.156 ms
64 bytes from 172.16.2.1: icmp_seq=4 ttl=64 time=2.164 ms
^C
--- 172.16.2.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.156/2.278/2.440/0.111 ms

それぞれ、BGP Route Serverのみとピアリングしており、各ルータへの経路はWAN #1経由が優先され、Pingも問題なく通ることがわかります。

WAN障害時の通信経路

せっかくなので、WAN障害時にどのように通信経路が迂回されるかも見てみます。今回は、AS65010のWAN #1が何らかの原因により通信できなくなったとします。ここではAS65010のルータでWAN #1向けのケーブルを抜きます。まずはルートサーバでピアの状態を見てみます。

AS65001_Cisco841MJ
R65001>sh ip bgp summ
〜省〜
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.0.10       4        65010       0       0        1    0    0 00:00:15 Active
10.1.0.11       4        65011     807    1584      133    0    0 01:20:24        2
10.1.0.12       4        65012     478     844      133    0    0 00:42:49        4
10.2.0.10       4        65010     427     429      133    0    0 00:21:42        2
10.2.0.11       4        65011     221     433      133    0    0 00:21:45        2
10.2.0.12       4        65012     244     429      133    0    0 00:21:43        4

10.1.0.10とピアリングできていないことがわかります。AS65010からルーティングテーブルの状態、Pingの結果を見てみます。

AS65010_Cisco1812J
R65010>sh ip route
〜省略〜
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback1
B       172.16.2.0 [20/20] via 10.2.0.11, 00:01:39
B       172.16.3.0 [20/20] via 10.2.0.12, 00:01:39
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.0.0.10/32 is directly connected, Loopback0
B       10.0.0.11/32 [20/20] via 10.2.0.11, 00:01:39
B       10.0.0.12/32 [20/20] via 10.2.0.12, 00:01:39
C       10.2.0.0/24 is directly connected, FastEthernet1
B       10.1.0.0/24 [20/20] via 10.2.0.12, 00:01:40



R65010>ping 172.16.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
R65010>ping 172.16.3.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms

ルーティングテーブルを見ると、各ネットワークへの経路情報は残っていますが、NextHopが10.2.0.xx(WAN #2経由)になっていることがわかります。Pingも通ります。

他の技術との比較

今回のネットワークと似たようなものは、他のルーティング方式でも実装できます。ただ、スケーラビリティや経路制御の部分で違いが出てくるので、その辺を比較します。

BGP Route Server V.S. OSPF

今回の規模のネットワークであればOSPFで作ったほうが早いです。ただ、OSPFの場合1エリアに最大100ルータ程度しか収容できないため、それ以上の規模であればRoute Server方式がおすすめです。また、OSPFに比べ経路制御が柔軟にできるので、その点もRoute Serverを使ったほうがメリットが出ます。

BGP Route Server V.S. BGP (Third-Party Next-Hop)

BGPには、他のASを中継しても、同一セグメント内の経路交換であればNEXT-HOPアトリビュートが変更されないという特性があります。例えば、今回の構成のようにAS65010がAS65001を介してAS65011と経路交換している場合でも、それぞれのピアのアドレスは10.1.0.0/24、もしくは10.2.0.0/24の範囲に収まっているので、実はRoute Serverを使わなくても同じようなルーティングになります。ただ、Third-Party Next-Hopを使う場合、AS65001でAS-PATHが追加され。MEDも初期化されてしまうため、経路制御が難しくなります。

BGP 3rd party next-hop.jpg

おわりに

今回はBGP Route Serverを用いたWANネットワーク設計を見ていきました。次回は、今回構築したネットワークの経路制御を見ていきたいと思います。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3