R1과 R2 eBGP 구성
R1
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
router bgp 1
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 neighbor 192.1.12.2 remote-as 2
R2
router bgp 2
 neighbor 192.1.12.1 remote-as 1

 

R2, R3, R4 OSPF 구성
R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
router ospf 1
 network 2.2.2.2 0.0.0.0 area 0
 network 192.1.23.0 0.0.0.255 area 0
R3
router ospf 1
 network 192.1.23.0 0.0.0.255 area 0
 network 192.1.34.0 0.0.0.255 area 0
R4
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 192.1.34.0 0.0.0.255 area 0

 

R2와 R4 iBGP 구성
R2
router bgp 2
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
R4
router bgp 2
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0

 

R4와 R5 eBGP 구성
R4
router bgp 2
 neighbor 192.1.45.5 remote-as 3
R5
router bgp 3
 neighbor 192.1.45.4 remote-as 2

 

1.1.1.0/24에 대한 BGP 테이블 확인

R2#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24       192.1.12.1               0             0 1 i
 
R3#sh ip bgp
% BGP not active

R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 * i 1.1.1.0/24       192.1.12.1               0    100      0 1 i
 
R5#sh ip bgp

 

R4#sh ip route 192.1.12.1
% Network not in table

 

R2
router bgp 2
 neighbor 4.4.4.4 next-hop-self
 
R4
router bgp 4
 neighbor 2.2.2.2 next-hop-self

 

두 가지 변경 사항. 첫 째, '>' 기호 표시와(라우팅 테이블에 2.2.2.2 경로를 설치할 수 있음을 의미) 넥스트 홉이 R2의 루프백 인터페이스로 변경. (192.1.12.1 → 2.2.2.2)

R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.1.1.0/24       2.2.2.2                  0    100      0 1 i

 

R4에서 라우팅 테이블에 설치하였으므로 R5에 접두사 광고.

R5#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24       192.1.45.4                             0 2 1 i
 
 R5#sh ip rou bgp
      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 192.1.45.4, 00:07:02


 

R3 - iBGP 구성
R3
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
!
router bgp 2
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0

 

R2
router bgp 2
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 
R4
router bgp 2
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self

 

R3에서 iBGP 구성 후 R3, R1에서 1.1.1.0/24의 BGP 테이블 확인

R3#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.1.1.0/24       2.2.2.2                  0    100      0 1 i

 

ping 확인
R2#ping 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/3 ms

R3#ping 1.1.1.1
.....
Success rate is 0 percent (0/5)

R4#ping 1.1.1.1
.....
Success rate is 0 percent (0/5)

R5#ping 1.1.1.1 sou 5.5.5.5
.....
Success rate is 0 percent (0/5)

 

R3에서 여전히 ping 안 됨, R3의 테이블 확인시 목적지까지 경로에 대해 문제 없으며, R1의 테이블 확인 필요.

R1#sh ip route
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      192.1.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.12.0/24 is directly connected, GigabitEthernet0/0
L        192.1.12.1/32 is directly connected, GigabitEthernet0/0

 

R1은 R3으로의 경로가 없으며, R3으로부터 다음의 IP 패킷을 수신한다.

  • src ip : 5.5.5.5
  • dst ip : 1.1.1.1

R3가 R1에 도달하는 것은 중요하지 않고, R5가 R1에 도달 하길 원한다.

R5에서 5.5.5.5/32를 BGP에 포함시키고 R1에서 BGP 및 라우팅 테이블 확인.

R5
router bgp 3
 network 5.5.5.5 mask 255.255.255.255

 

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24       0.0.0.0                  0         32768 i
 *>  5.5.5.5/32       192.1.12.2                             0 2 3 i
 
R1#sh ip route
B        5.5.5.5 [20/0] via 192.1.12.2, 00:43:21

 

ping 확인
R5#ping 1.1.1.1 sou 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/7 ms

R4#ping 1.1.1.1
.....
Success rate is 0 percent (0/5)

R3#ping 1.1.1.1
.....
Success rate is 0 percent (0/5)

R1#ping 5.5.5.5 sou 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/4 ms

 

라우팅 테이블 확인
R1#sh ip route
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 192.1.12.2, 00:43:21
      192.1.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.12.0/24 is directly connected, GigabitEthernet0/0
L        192.1.12.1/32 is directly connected, GigabitEthernet0/0

R2#sh ip route 
      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 192.1.12.1, 06:47:59
      2.0.0.0/32 is subnetted, 1 subnets
C        2.2.2.2 is directly connected, Loopback0
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/2] via 192.1.23.3, 05:36:30, GigabitEthernet0/1
      4.0.0.0/32 is subnetted, 1 subnets
O        4.4.4.4 [110/3] via 192.1.23.3, 05:29:04, GigabitEthernet0/1
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/0] via 4.4.4.4, 00:43:22
      192.1.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.12.0/24 is directly connected, GigabitEthernet0/0
L        192.1.12.2/32 is directly connected, GigabitEthernet0/0
      192.1.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.23.0/24 is directly connected, GigabitEthernet0/1
L        192.1.23.2/32 is directly connected, GigabitEthernet0/1
O     192.1.34.0/24 [110/2] via 192.1.23.3, 06:47:46, GigabitEthernet0/1

R3#sh ip route
      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [200/0] via 2.2.2.2, 05:09:17
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 192.1.23.2, 06:47:43, GigabitEthernet0/1
      3.0.0.0/32 is subnetted, 1 subnets
C        3.3.3.3 is directly connected, Loopback0
      4.0.0.0/32 is subnetted, 1 subnets
O        4.4.4.4 [110/2] via 192.1.34.4, 05:29:08, GigabitEthernet0/2
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/0] via 4.4.4.4, 00:43:21
      192.1.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.23.0/24 is directly connected, GigabitEthernet0/1
L        192.1.23.3/32 is directly connected, GigabitEthernet0/1
      192.1.34.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.34.0/24 is directly connected, GigabitEthernet0/2
L        192.1.34.3/32 is directly connected, GigabitEthernet0/2

R4#sh ip route
      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [200/0] via 2.2.2.2, 05:28:49
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/3] via 192.1.34.3, 05:29:09, GigabitEthernet0/2
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/2] via 192.1.34.3, 05:29:09, GigabitEthernet0/2
      4.0.0.0/32 is subnetted, 1 subnets
C        4.4.4.4 is directly connected, Loopback0
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 192.1.45.5, 00:43:21
O     192.1.23.0/24 [110/2] via 192.1.34.3, 05:29:09, GigabitEthernet0/2
      192.1.34.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.34.0/24 is directly connected, GigabitEthernet0/2
L        192.1.34.4/32 is directly connected, GigabitEthernet0/2
      192.1.45.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.45.0/24 is directly connected, GigabitEthernet0/0
L        192.1.45.4/32 is directly connected, GigabitEthernet0/0

R5#sh ip route
      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [20/0] via 192.1.45.4, 05:29:00
      5.0.0.0/32 is subnetted, 1 subnets
C        5.5.5.5 is directly connected, Loopback0
      192.1.45.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.1.45.0/24 is directly connected, GigabitEthernet0/0
L        192.1.45.5/32 is directly connected, GigabitEthernet0/0

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 동기화(Synchronization)  (0) 2025.05.01
[BGP] 속성7 - Prefer eBGP over iBGP  (1) 2025.04.30
[BGP] 속성6 - MED(metric)  (0) 2025.04.29
[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28
  • BGP는 IGP에서 접두사를 검증할 수 없는 경우, iBGP 네이버로부터 학습한 내용을 eBGP 네이버에게 알리지 않는다.
  • 동기화는 AS 내에 모든 라우터가 iBGP를 활성화할 필요가 없었던 시절에 적용되어 온 규칙이며, 현재는 사용되지 않는다.
  • iBGP 피어링은 반드시 직접 연결되어 있지 않은 라우터 간에도 피어링을 맺을 수 있다. iBGP 피어링은 iBGP 라우터가 AS 내에서 실행되는 IGP를 통해 서로 연결될 수만 있으면 된다.

 

이 시나리오는 R1과 R5 간에 통신이 아닌 BGP가 BGP 동기화를 통해 접두사를 공유하는 방식에 초점을 맞췄다. BGP 접두사가 테이블에 어떻게 표시되는지 확인하는데에 국한되었으며, R5에서 R1로 ping은 필수가 아니다. 그리고 전송 AS의 모든 라우터에서 iBGP를 실행하지 않는 시나리오에 대한 솔루션을 말한다.

 

iBGP 세션 설정을 위해 IGP(OSPF) 구성. (R1은 접두사를 광고하고 R2, R3에서 이를 학습한다.)

R2와 R4는 iBGP 피어링을 맺고, OSPF를 통해 서로 통신. (R4는 R2로부터 iBGP를 통해 1.1.1.0/24 학습)

 

OSPF 구성
R2
router ospf 1
 network 2.2.2.2 0.0.0.0 area 0
 network 192.1.23.0 0.0.0.255 area 0
 
R3
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 192.1.23.0 0.0.0.255 area 0
 network 192.1.34.0 0.0.0.255 area 0
 
R4
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 192.1.34.0 0.0.0.255 area 0

 

BGP 구성
R1
router bgp 1
 network 1.1.1.0 mask 255.255.255.0
 neighbor 192.1.12.2 remote-as 2
 
R2
router bgp 2
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.1.12.1 remote-as 1
 
R3(BGP X)
 
R4
router bgp 2
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 192.1.45.5 remote-as 3
 
R5
router bgp 3
 neighbor 192.1.45.4 remote-as 2

 

1.1.1.0/24의 BGP 테이블 확인. R4, R5 모두 이 네트워크에 대해 알고있다.

R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.1.1.0/24       2.2.2.2                  0    100      0 1 i
 
R5#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24       192.1.45.4                             0 2 1 i

 

현재 문제는 R4 또는 R5가 도달할 수 없는 경로를 학습했다는 거다. R3에서 BGP를 실행하지 않았기 1.1.1.0/24 네트워크를 모르고, AS3에서 AS1로 IP 패킷이 전달되지 못하고 R4가 R3에게 패킷을 전달하면 R3는 해당 패킷을 드랍한다. (R3 블랙홀)

R3#sh ip rou 1.1.1.0
% Network not in table

R4#sh ip rou 1.1.1.0
% Network not in table

이 문제를 해결하기 위해 동기화 규칙이 만들어졌다.

 

BGP 동기화 활성화

  • 경계 라우터(R2, R4)에서 활성화 한다. 동기화를 활성화하면 1.1.1.0/24 네트워크를 더 이상 R5에 광고하지 않고, IGP에서 해당 경로를 알고 있으면 R3가 패킷을 전달할 수 있다는 것을 알고 나서 R5에 경로를 광고한다.
  • 동기화가 활성화되면 사용 중인 IGP에서 해당 경로를 알아내기 전까지 해당 경로가 라우팅 테이블에 설치되지 않는다.
  • 동기화 규칙의 역할은 라우터가 먼저 경로가 IGP에 의해 알려진 경로인지 확인하도록 하는 것이다. OSPF의 경우 LSDB에서 해당 경로에 대한 기록이 있는지 확인한다.
R1, R2
router bgp 2
 synchronization
R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 * i 1.1.1.0/24       2.2.2.2                  0    100      0 1 i
R4#
R4#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.0/24, version 3
Paths: (1 available, no best path)
  Not advertised to any peer
  Refresh Epoch 3
  1
    2.2.2.2 (metric 3) from 2.2.2.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, not synchronized
      rx pathid: 0, tx pathid: 0

 

R4의 BGP 테이블에서 네트워크가 학습되지만 사용할 수 없는 경로이다. no best path와 not synchronized를 확인할 수 있다.

R5#sh ip bgp 1.1.1.1
% Network not in table

 

이 문제를 해결하기 위해 동기화를 비활성화하고, 풀 메시 구성하여 AS 내의 모든 라우터가 iBGP 피어링을 맺거나 IGP에 접두사를 재분배하여 해결할 수 있다.

R2
route-map AS1 permit 10
 match ip address 1
!         
access-list 1 permit 1.1.1.0 0.0.0.255
!
router ospf 1
 redistribute bgp 2 subnets route-map AS1
 
 R4는 해당 네트워크에 대한 IGP 경로가 라우팅 테이블에 저장되어 있지 않으면, BGP 경로 저장을 거부한다.
이렇게 하면 해당 경로가 IGP 도메인 내에서 인식되므로 iBGP를 실행하지 않는 모든 라우터가 해당 경로를
라우팅할 수 있다.

R2에서 1.1.1.0/24 네트워크를 OSPF로 재분배하여 R4의 OSPF에 해당 네트워크를 포함. 이렇게 하면 동기화 규칙이 충족되고 1.1.1.0/24로 향하는 BGP 경로가 라우팅 테이블에 등록된다.

R3#sh ip rou 1.1.1.0
Routing entry for 1.1.1.0/24
  Known via "ospf 1", distance 110, metric 1
  Tag 1, type extern 2, forward metric 1
  Last update from 192.1.23.2 on GigabitEthernet0/1, 00:00:05 ago
  Routing Descriptor Blocks:
  * 192.1.23.2, from 2.2.2.2, 00:00:05 ago, via GigabitEthernet0/1
      Route metric is 1, traffic share count is 1
      Route tag 1
      
R4#sh ip rou 1.1.1.0
Routing entry for 1.1.1.0/24
  Known via "ospf 1", distance 110, metric 1
  Tag 1, type extern 2, forward metric 2
  Last update from 192.1.34.3 on GigabitEthernet0/2, 00:00:05 ago
  Routing Descriptor Blocks:
  * 192.1.34.3, from 2.2.2.2, 00:00:05 ago, via GigabitEthernet0/2
      Route metric is 1, traffic share count is 1
      Route tag 1

     Network          Next Hop            Metric LocPrf Weight Path
 r>i 1.1.1.0/24       2.2.2.2                  0    100      0 1 i

'r' : 해당 경로가 라우팅 테이블에 등록되지 않았음을 의미한다. 하지만 OSPF를 통해
라우팅 테이블에 저장된다. 이상태는 해당 경로가 eBGP를 통해 R5에게 전달되지 않는다는
것을 의미하지는 않는다. 따라서 R4에는 OSPF를 통해 학습된 1.1.1.0/24 경로가 있으므로
라우팅이 가능하다.

R5#sh ip rou 1.1.1.0
Routing entry for 1.1.1.0/24
  Known via "bgp 3", distance 20, metric 0
  Tag 2, type external
  Last update from 192.1.45.4 00:00:05 ago
  Routing Descriptor Blocks:
  * 192.1.45.4, from 192.1.45.4, 00:00:05 ago
      Route metric is 0, traffic share count is 1
      AS Hops 2
      Route tag 2
      MPLS label: none
      
     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24       192.1.45.4                             0 2 1 i

 

Q. R4에서 OSPF에서 BGP로 재분배를 하지 않고, BGP로 다시 재분배하지 않는가? R5가 접두사를 학습하는 방법은?

A. BGP를 통한 광고의 전제 조건은 해당 네트워크가 로컬 라우팅 테이블에 있어야 한다는 것이다. '1.1.1.0/24'는 BGP 테이블에는 있지만 R4의 라우팅 테이블에는 없었다.

해결책은 해당 네트워크를 라우터 자체 내에서 BGP에서 OSPF로 재분배하는 것이다. 그 결과 네트워크가 라우팅 테이블에 저장되고 BGP를 사용하여 R5로 광고된다. (BGP가 해당 네트워크 정보의 소스이기 때문에 BGP로 다시 재분배할 필요가 없다)

'네트워크 > BGP' 카테고리의 다른 글

[BGP] iBGP ..  (0) 2025.05.06
[BGP] 속성7 - Prefer eBGP over iBGP  (1) 2025.04.30
[BGP] 속성6 - MED(metric)  (0) 2025.04.29
[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28

 

 

R1, R2는 목적지 '3.3.3.3/32'에 대해 eBGP와 iBGP를 통해 알게된다.

R2에서 '3.3.3.3/32'에 대해 '1.1.13.3', '1.1.23.3' 두 개의 경로가 있고, eBGP로부터 받은 '1.1.23.3' 경로를 우선한다.

R2#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.1.13.0/24      1.1.12.1                 0    100      0 i
 *>  1.1.23.0/24      0.0.0.0                  0         32768 i
 * i 3.3.3.3/32       1.1.13.3                 0    100      0 3 i
 *>                   1.1.23.3                 0             0 3 i
R2#
R2#
R2#sh ip bgp 3.3.3.3
  3
    1.1.13.3 from 1.1.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 3
  3
    1.1.23.3 from 1.1.23.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

 

BGP 속성 확인

  • weigh : 0
  • Local Preference : 100
  • Originate : R3
  • AS-Path : IGP
  • MED : 0
  • Prefer eBGP over iBGP

'1.1.13.3', '1.1.23.3' 두 경로 모두 MED 속성까지 동일하므로 순위 결정에 사용되지 않고, 다음 항목인 prefer iBGP over eBGP에 의해 R2를 경유하는 iBGP 경로가 아닌 R3인 eBGP 경로를 우선한다.

 

BGP 테이블에서 eBGP와 iBGP 간 최적 경로를 정할때 AD를 비교할 필요가 없다. BGP 자체적으로 최적 경로를 선택하고, BGP 테이블에서 속성에 의해 최적 경로를 정하면, 그 다음 라우팅 테이블에 최적 경로를 저장하기 위해 Static Route 또는 IGP 경로와 AD 값을 비교하여(다른 라우팅 프로토콜에 동일 목적지가 있는 경우) 가장 낮은 경로가 라우팅 테이블에 최적 경로로 저장된다.

'네트워크 > BGP' 카테고리의 다른 글

[BGP] iBGP ..  (0) 2025.05.06
[BGP] 동기화(Synchronization)  (0) 2025.05.01
[BGP] 속성6 - MED(metric)  (0) 2025.04.29
[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28

MED(metric)

  • MED는 인접 라우터에게 자신의 AS에 어떻게 들어와야 하는지 인입 경로를 광고할 때 사용.
  • MED 값이 가장 낮은 경로를 선호한다.
  • IGP 메트릭 값이 MED 값으로 사용된다.

  • R1, R2에서 BGP에 3.3.3.0/24 네트워크를 중복 포함.
  • R1, R2는 인접 AS에서 eBGP 네이버로부터 MED 값이 각각 다른 BGP 라우팅 정보를 수신하고, iBGP 네이버인 R1, R2 서로 간에 3.3.3.3/32에 대해 알린다.
R1#sh ip bgp 3.3.3.0
BGP routing table entry for 3.3.3.0/24, version 10
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     5         
  Refresh Epoch 1
  34
    1.1.13.3 from 1.1.13.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
R2#sh ip bgp 3.3.3.0
BGP routing table entry for 3.3.3.0/24, version 10
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     2         
  Refresh Epoch 1
  34
    1.1.1.1 (metric 2) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0
  Refresh Epoch 1
  34
    1.1.24.4 from 1.1.24.4 (4.4.4.4)
      Origin IGP, metric 2, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0

 

 

R2 확장 ping (dst 3.3.3.3 sou 2.2.2.2)

   (1.1.12.2)
   (1.1.13.1)
   (3.3.3.3)
   (1.1.13.3)
   (1.1.12.1)
   (2.2.2.2) <*>
   (0.0.0.0)
   (0.0.0.0)
   (0.0.0.0)
 End of list
  • R2는 3.3.3.0에 대해 R4에게 받았을 때 MED 값은 '2'이고, R1에게 받은 MED 값은 '0'으로 R1에게 받은 MED 값이 낮기 때문에, 목적지 3.3.3.0에 대해 R1이 우선하고, R1 ━ R3간의 경로를 통해 AS 34로 전송된다.

 

 

설정

R1
router ospf 12
 network 1.1.1.0 0.0.0.255 area 0
 network 1.1.12.0 0.0.0.255 area 0
!
router bgp 12
 network 1.1.1.1 mask 255.255.255.255
 neighbor 1.1.13.3 remote-as 34
 neighbor 2.2.2.2 remote-as 12
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
R2
router ospf 12
 network 1.1.12.0 0.0.0.255 area 0
 network 2.2.2.0 0.0.0.255 area 0
!
router bgp 12
 network 2.2.2.2 mask 255.255.255.255
 neighbor 1.1.1.1 remote-as 12
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 next-hop-self
 neighbor 1.1.24.4 remote-as 34
R3
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
 ip ospf network point-to-point
!
router ospf 34
 router-id 3.3.3.3
 network 1.1.34.0 0.0.0.255 area 0
 network 3.3.3.3 0.0.0.0 area 0
!
router bgp 34
 bgp router-id 3.3.3.3
 network 3.3.3.0 mask 255.255.255.0
 neighbor 1.1.13.1 remote-as 12
 neighbor 4.4.4.4 remote-as 34
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
R4
router ospf 34
 router-id 4.4.4.4
 network 1.1.34.0 0.0.0.255 area 0
 network 4.4.4.4 0.0.0.0 area 0
!
router bgp 34
 bgp router-id 4.4.4.4
 network 3.3.3.0 mask 255.255.255.0
 neighbor 1.1.24.2 remote-as 12
 neighbor 3.3.3.3 remote-as 34
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 동기화(Synchronization)  (0) 2025.05.01
[BGP] 속성7 - Prefer eBGP over iBGP  (1) 2025.04.30
[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28
[BGP] 속성3 - Originate  (0) 2025.04.22

Origin Code

  • 특정 네트워크를 BGP에 포함시킨 방법을 표시한다.
  • IGP, EGP(사용X), incomplete 세 가지 Origin Code가 있다.
    - IGP : BGP 설저에서 network 명령어를 사용해 특정 네트워크를 직접 광고했음을 의미한다. ' i '로 표시됨.
    - incomplete : BGP로 재분배된 네트워크를 의미한다.
  • 축약된 경로의 오리진은 축약전의 상세 네트워크 중에서 가장 높은 순위의 오리진 코드를 갖는다.
  • 우선순위 : IGP < EGP < incomplete (우선순위가 낮은 오리진 코드가 우선된다.)

 

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  6.6.6.0/24       1.1.12.2                 0             0 2 i
 *                    1.1.13.3                 0             0 2 i

 

R2에서는 network 명령어로 BGP 광고,

R3에서는 redistribute 명령어로 재분배 후 R1에서 BGP 테이블 확인, 1.1.12.2에 대해 origin code가 'i → ?'로 변경됨.

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *   6.6.6.0/24       1.1.12.2                 0             0 2 ?
 *>                   1.1.13.3                 0             0 2 i

 

설정

R1#sh run | s r b
router bgp 1
 neighbor 1.1.12.2 remote-as 2
 neighbor 1.1.13.3 remote-as 2
 
R2#sh run | s r b
router bgp 2
 redistribute connected
 neighbor 1.1.12.1 remote-as 1
 
R3#sh run | s r b
router bgp 2
 network 6.6.6.0 mask 255.255.255.0
 neighbor 1.1.13.1 remote-as 1

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 속성7 - Prefer eBGP over iBGP  (1) 2025.04.30
[BGP] 속성6 - MED(metric)  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28
[BGP] 속성3 - Originate  (0) 2025.04.22
[BGP] 속성2 - Local Preference  (0) 2025.04.18

AS Path

  • AS 경로는 해당 네트워크까지 가는 경로상에 있는 AS의 번호들을 기록해 놓은 속성.
  • AS_SET와 AS_SEQUENCE가 있다.
  • AS_SEQUENCE는 해당 네트워크까지 소속된 AS 번호가 가장 오른쪽에 기록되고, 현재의 AS와 인접한 AS 번호가 가장 왼쪽에 기록된다.
  • AS-Path 속성의 역할중 하나는 라우팅 루프를 방지한다. eBGP 네이버에게서 라우팅 정보를 수신한 BGP 라우터는 AS 경로를 확인하고, 자신이 속한 AS 번호가 이미 포함되어 있으면 루프가 발생했음을 의미하므로 버린다.
BGP 테이블에서 AS-Path 확인

 

R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>i 1.1.1.1/32       3.3.3.3                  0    100      0 1 i ---- 1
 *>i 2.2.2.2/32       3.3.3.3                  0    100      0 1 2 i ---- 2
 r>i 3.3.3.3/32       3.3.3.3                  0    100      0 i
 *>  4.4.4.4/32       0.0.0.0                  0         32768 i

 

1 : 2.2.2.2/32 네트워크의 AS 시퀀스가 '1 2'로 표시.

2 : iBGP 네이버에게 라우팅 정보를 전송 시 자신의 AS 번호를 추가하지 않고, eBGP 네이버에게 광고하는 경우에만 자신의 AS 번호를 추가한다. (동일 AS 내에서는 AS 번호가 추가되지 않는다)

 

AS-SET 확인

 

R1, R2에서 Lo1 추가 및 R3에서 as-set 옵션을 추가하여 축약.

R1#
interface Loopback1
 ip address 99.1.1.1 255.255.255.0 secondary
 ip address 99.1.0.1 255.255.255.0
!
router bgp 2
 network 99.1.0.0 mask 255.255.255.0
 network 99.1.1.0 mask 255.255.255.0
 
R2#
interface Loopback1
 ip address 99.1.3.1 255.255.255.0 secondary
 ip address 99.1.2.1 255.255.255.0
 !
 router bgp 2
 network 99.1.2.0 mask 255.255.255.0
 network 99.1.3.0 mask 255.255.255.0
 
R3#
router bgp 34
 aggregate-address 99.1.0.0 255.255.252.0 as-set
R4#sh ip bgp
 *>i 99.1.0.0/24      3.3.3.3                  0    100      0 1 i
 *>i 99.1.0.0/22      3.3.3.3                  0    100      0 {1,2} i
 *>i 99.1.1.0/24      3.3.3.3                  0    100      0 1 i
 *>i 99.1.2.0/24      3.3.3.3                  0    100      0 1 2 i
 *>i 99.1.3.0/24      3.3.3.3                  0    100      0 1 2 i

 

as-set 옵션은 축약 네트워크에 포함된 상세 네트워크들이 가진 AS 경로 정보를 버리지 않고 순서없이 나열할 때 사용.

 

AS-Path 추가하여 특정 경로를 선호하도록 설정

 

R2, R3에서 6.6.6.0/24를 R1으로 광고하고, R2가 최적 경로인 상태에서 R3을 선호 하도록  AS-Path를 변경.

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *   6.6.6.0/24       1.1.13.3                 0             0 2 i
 *>                   1.1.12.2                 0             0 2 i

 

AS-Path prepend(2 2 2) 후 BGP 테이블 확인, 최적 경로가 R2에서 R3로 변경됨.

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  6.6.6.0/24       1.1.13.3                 0             0 2 i
 *                    1.1.12.2                 0             0 2 2 2 2 i

 

설정

R1#
router bgp 1
 neighbor 1.1.12.2 remote-as 2
 neighbor 1.1.13.3 remote-as 2
 
R2#
router bgp 2
 bgp router-id 2.2.2.2
 network 6.6.6.0 mask 255.255.255.0
 neighbor 1.1.12.1 remote-as 1
 neighbor 1.1.12.1 route-map AS-PREPEND out
!
route-map AS-PREPEND permit 10
 set as-path prepend 2 2 2
 
R3#
router bgp 2
 bgp router-id 3.3.3.3
 network 6.6.6.0 mask 255.255.255.0
 neighbor 1.1.13.1 remote-as 1

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 속성6 - MED(metric)  (0) 2025.04.29
[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성3 - Originate  (0) 2025.04.22
[BGP] 속성2 - Local Preference  (0) 2025.04.18
[BGP] 속성1 - Weight  (0) 2025.04.17

Originate

  • 특정 네트워크가 BGP 테이블에 포함된 방법을 표시한다.
  • IGP, EGP(사용x), incomplete 세 가지로 나뉜다.
    - IGP : 특정 네트워크를 network 명령어를 사용하여 BGP에 포함된 것을 의믜.
    - incomplete : 특정 네트워크가 BGP로 배분배된 네트워크를 의미.
  • 로컬 라우터에서 시작된 경로를 우선한다. 즉, 다른 라우터가 BGP에 설치한 경로보다 자신이 포함한 경로를 선호함.

R2는 12.12.12.12/32를 광고, R1은 아직 광고하지 않는다.
R1(config-router)#do sh run | s r b
router bgp 1
 bgp router-id 1.1.1.1
 neighbor 1.1.12.2 remote-as 2
 
R2(config-router)#do sh run | s r b
router bgp 2
 bgp router-id 2.2.2.2
 network 12.12.12.12 mask 255.255.255.255
 neighbor 1.1.12.1 remote-as 1
R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 r>  12.12.12.12/32   1.1.12.2                 0             0 2 i

 

추가로 R1에서 12.12.12.12/32를 network 명령어를 사용하여 BGP에 포함.

R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  12.12.12.12/32   0.0.0.0                  0         32768 i
 *                    1.1.12.2                 0             0 2 i

로컬 라우터에서 시작된 경로이기 때문에 Next Hop이 0.0.0.0이고, R1이 두 개의 경로 중 이 경로를 선택한 이유는 Weight가 32768로 높기 때문이다.

 

Weight가 순위 결정 요인으로 사용되지 않도록 하기 위해, route-map을 사용하여 R2로부터 들어오는 경로의 Weight를 32768로 설정.
interface Loopback12
 ip address 12.12.12.12 255.255.255.255
!
route-map WEIGHT_IN permit 10
 match ip address R2_Lo2
 set weight 32768
!
router bgp 1
 neighbor 1.1.12.2 route-map WEIGHT_IN in
R1#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 *>  12.12.12.12/32   0.0.0.0                  0         32768 i
 *                    1.1.12.2                 0         32768 2 i

BGP 속성 확인

첫 번째. Weight : 32768로 동일.

번째. Local Preference : 두 경로 모두 비어있음.

번째. Originate : 로컬 라우터에서 시작된 경로(next hop 0.0.0.0)를 선택.

 

R1에서 Lo12(12.12.12.12/32)에 대해 redistribute connected
R1#sh run | s r b
router bgp 1
 redistribute connected route-map WEIGHT_IN
 neighbor 1.1.12.2 remote-as 2
 
      Network          Next Hop            Metric LocPrf Weight Path
 *>  12.12.12.12/32   0.0.0.0                  0         32768 ?
 *                    1.1.12.2                 0             0 2 i

Weight(32768), Path(i → ?)

 

 

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 속성5 - Origin Code  (0) 2025.04.29
[BGP] 속성4 - AS Path  (0) 2025.04.28
[BGP] 속성2 - Local Preference  (0) 2025.04.18
[BGP] 속성1 - Weight  (0) 2025.04.17
[BGP] 속성(attribute)  (0) 2025.04.17

Local Preference

  • AS 외부로 나가는 아웃바운드 경로를 결정할 때 사용.(인접 AS에서 들어오는 경로를 조정할 때 사용하는 MED와 반대)
  • AS 내의 iBGP 피어간에만 전달된다.
  • eBGP 라우터에게는 보내지 않는다.
  • 높은 값이 우선하며, 기본값은 100이다.

 

Local Preference 조정 전 (default 100)

OSPF 설정
■ R2
router ospf 2
 network 1.1.24.2 0.0.0.0 area 0
 network 2.2.2.2 0.0.0.0 area 0
 
■ R3
router ospf 2
 network 1.1.34.3 0.0.0.0 area 0
 network 3.3.3.3 0.0.0.0 area 0
 
■ R4
router ospf 2
 network 1.1.24.4 0.0.0.0 area 0
 network 1.1.34.4 0.0.0.0 area 0
 network 4.4.4.4 0.0.0.0 area 0
iBGP 설정
■ R2
router bgp 2
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 
■ R3
router bgp 2
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 
■ R4
router bgp 2
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
eBGP 설정
■ R1
router bgp 1
 network 1.1.1.1 mask 255.255.255.255
 neighbor 1.1.12.2 remote-as 2
 neighbor 1.1.13.3 remote-as 2
 
■ R2
router bgp 2
 neighbor 1.1.12.1 remote-as 1
 
■ R3
router bgp 2
 neighbor 1.1.13.1 remote-as 1

 

Local Preference 조정 (default 100 → 200)

 

R3 : LP default 200으로 조정

router bgp 2
 bgp default local-preference 200
R4#sh ip bgp
     Network          Next Hop            Metric LocPrf Weight Path
 * i 1.1.1.1/32       2.2.2.2                  0    100      0 1 i
 *>i                  3.3.3.3                  0    200      0 1 i

 

또는 R1으로부터 수신하는 네트워크에 대해 route-map 사용하여 LP 값을 500으로 조정

route-map LP-CH permit 10
 set local-preference 500
 
router bgp 2
 neighbor 1.1.13.1 route-map LP-CH in

'네트워크 > BGP' 카테고리의 다른 글

[BGP] 속성4 - AS Path  (0) 2025.04.28
[BGP] 속성3 - Originate  (0) 2025.04.22
[BGP] 속성1 - Weight  (0) 2025.04.17
[BGP] 속성(attribute)  (0) 2025.04.17
[BGP] 스플릿 호라이즌(split horizon rule)  (0) 2025.04.14

+ Recent posts