BGP プライベートAS番号を広報しない(remove-private-as)

トポロジ



条件
・R2,R5 にてそれぞれ lo0 のセグメントを BGP内に広報してください。
・R6から R7,R8 に対して プライベートAS番号を広報しないようにしてください。
・上記設定により、R7,R8 が 上記 Lo0 セグメントに到達できないことがないように
 してください。

まず下記設定からスタートです。

R1
interface FastEthernet0/0
 ip address 12.12.12.1 255.255.255.0
!
interface FastEthernet0/1
 ip address 16.16.16.1 255.255.255.0
!
router ospf 1
 network 12.12.12.0 0.0.0.255 area 12
 network 16.16.16.0 0.0.0.255 area 0
!
router bgp 300
 no synchronization
 neighbor 12.12.12.2 remote-as 65002
 neighbor 16.16.16.6 remote-as 300
 no auto-summary

R2
interface Loopback0
 ip address 22.22.22.22 255.255.255.0
!
interface FastEthernet0/0
 ip address 12.12.12.2 255.255.255.0
!
interface FastEthernet0/1
 ip address 23.23.23.2 255.255.255.0
!
router ospf 1
 network 12.12.12.0 0.0.0.255 area 12
!
router bgp 65002
 no synchronization
 network 22.22.22.0 mask 255.255.255.0
 neighbor 12.12.12.1 remote-as 300
 neighbor 23.23.23.3 remote-as 65034
 no auto-summary

R3
interface FastEthernet0/0
 ip address 34.34.34.3 255.255.255.0
!
interface FastEthernet0/1
 ip address 23.23.23.3 255.255.255.0
!
router bgp 65034
 no synchronization
 neighbor 23.23.23.2 remote-as 65002
 neighbor 34.34.34.4 remote-as 65034
 neighbor 34.34.34.4 next-hop-self
 no auto-summary

R4
interface FastEthernet0/0
 ip address 34.34.34.4 255.255.255.0
!
interface FastEthernet0/1
 ip address 45.45.45.4 255.255.255.0
!
router bgp 65034
 no synchronization
 neighbor 34.34.34.3 remote-as 65034
 neighbor 34.34.34.3 next-hop-self
 neighbor 45.45.45.5 remote-as 65005
 no auto-summary

R5
interface Loopback0
 ip address 55.55.55.55 255.255.255.0
!
interface FastEthernet0/0
 ip address 56.56.56.5 255.255.255.0
!
interface FastEthernet0/1
 ip address 45.45.45.5 255.255.255.0
!
router eigrp 100
 network 56.56.56.0 0.0.0.255
 no auto-summary
!
router bgp 65005
 no synchronization
 network 55.55.55.0 mask 255.255.255.0
 neighbor 45.45.45.4 remote-as 65034
 neighbor 56.56.56.6 remote-as 300
 no auto-summary

R6
interface FastEthernet0/0
 ip address 56.56.56.6 255.255.255.0
!
interface FastEthernet0/1
 ip address 16.16.16.6 255.255.255.0
!
interface Ethernet1/0
 ip address 68.68.68.6 255.255.255.0
!
interface Ethernet1/1
 ip address 67.67.67.6 255.255.255.0
!
router eigrp 100
 redistribute ospf 1 metric 100 1 255 1 1500
 network 56.56.56.0 0.0.0.255
 network 67.67.67.0 0.0.0.255
 no auto-summary
!
router ospf 1
 log-adjacency-changes
 redistribute eigrp 100 subnets
 network 16.16.16.0 0.0.0.255 area 0
 network 68.68.68.0 0.0.0.255 area 0
!
router bgp 300
 no synchronization
 neighbor 16.16.16.1 remote-as 300
 neighbor 56.56.56.5 remote-as 65005
 neighbor 67.67.67.7 remote-as 200
 neighbor 68.68.68.8 remote-as 100
 no auto-summary

R7
interface Ethernet1/1
 ip address 67.67.67.7 255.255.255.0
!
router eigrp 100
 network 67.67.67.0 0.0.0.255
 no auto-summary
!
router bgp 200
 no synchronization
 neighbor 67.67.67.6 remote-as 300
 no auto-summary

R8
interface Ethernet1/0
 ip address 68.68.68.8 255.255.255.0
!
router ospf 1
 network 68.68.68.0 0.0.0.255 area 0
!
router bgp 100
 no synchronization
 neighbor 68.68.68.6 remote-as 300
 no auto-summary




まずは、R2,R5 にて Lo0 を BGPに広報します。

R2
router bgp 65002
network 22.22.22.0 mask 255.255.255.0

R5
ruter bgp 65005
network 55.55.55.0 mask 255.255.255.0

この状態で、R7,R8 で sh ip bgp をみてみます。


R7#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 22.22.22.0/24    67.67.67.6                             0 300 65002 i
*> 55.55.55.0/24    67.67.67.6                             0 300 65005 i

R8#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 22.22.22.0/24    68.68.68.6                             0 300 65002 i
*> 55.55.55.0/24    68.68.68.6                             0 300 65005 i


現状だと、R7,R8 にてプライベートASを学習しています。
プライベートASとは 64512 〜 65535 に割り当てられる番号です。
詳しくは、下記などをご確認ください。

参考:
http://www.infraexpert.com/study/rp5bgp20.htm

R7,R8 をネイバーとするのは R6 のみのため R6 にて設定をします。


R6
router bgp 300
neighbor 67.67.67.7 remove-private-as
neighbor 68.68.68.8 remote-private-as


これで再度 R7,R8 にて sh ip bgp を見てみます。


R7#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 22.22.22.0/24    67.67.67.6                             0 300 i
*> 55.55.55.0/24    67.67.67.6                             0 300 i


R8#sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 22.22.22.0/24    68.68.68.6                             0 300 i
*> 55.55.55.0/24    68.68.68.6                             0 300 i


コマンド実行前とくらべると プライベートAS番号が消えていることがわかります。
この状態で R7,R8 から対象のセグメントに ping が飛ぶのか確認します。


R7#ping 22.22.22.22

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 22.22.22.22, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/60/72 ms
R7#
R7#
R7#traceroute 22.22.22.22

Type escape sequence to abort.
Tracing the route to 22.22.22.22

  1 67.67.67.6 64 msec 52 msec 16 msec
  2 16.16.16.1 20 msec 80 msec 40 msec
  3 12.12.12.2 60 msec 64 msec *


R7 から 22.22.22.22/24 へ ping を飛ばしてみましたが、OK であることがわかります。
tarceroute の最後が 22.22.22.22 ではありませんが、loopback アドレスなので
手前のインターフェースで終わりっぽいです。



ちなみに、あまり意味がないですが対象のセグメントに疎通できなくてよいのであれば、
下記のように as-path access-list で プライベートAS の広報を遮断することもできます。


R6
ip as-path access-list 1 permit _65002$
ip as-path access-list 1 permit _65005$

route-map PRIVATE_AS deny 10
match as-path 1

route-map PRIVATE_AS permit 20

router bgp 300
neighbor 67.67.67.7 route-map PRIVATE_AS out
neighbor 68.68.68.8 route-map PRIVATE_AS out
これで R7,R8 にて sh ip bgp を見ると何もみえなくなります。。


R7#sh ip bgp

R7# 

R8#sh ip bgp

R8


更新日:2013年5月8日
TOPに戻る