BGP/MPLS VPN 기본 개념
BGP/MPLS VPN은 MPLS 기술의 대표적인 활용 형태로, 주로 서비스 제공자망에서 사용된다. 이 기술은 다양한 고객망 간의 주소 중복 문제를 해결하고, 효과적인 트래픽 분리 기능을 제공한다.
해당 네트워크 환경에서는 라우터가 세 가지 역할로 구분된다:
- PE 라우터(Provider Edge): 고객 CE 장비와 연결되는 경계 장비로, MP-BGP, IGP, MPLS, LDP 프로토콜을 모두 처리하며 각 고객별 VRF 인스턴스를 관리한다.
- P 라우터(Provider): 코어 영역의 라우터로 일반적으로 IGP와 MPLS만 처리하며 VPN 정보는 알지 못한다.
- CE 라우터(Customer Edge): 고객 단말 장비로 PE와 직접 연결되며, PE-CE 간 통신 설정만 필요하다.
라우팅 및 레이블 처리 메커니즘
기존 BGP는 단일 라우팅 테이블만 유지할 수 있어 서로 다른 고객망 간 주소 충돌 문제가 발생한다. 이를 해결하기 위해 MP-BGP는 VPNv4 주소 패밀리를 사용하여 각 고객의 네트워크 주소를 구분한다.
각 PE 장비는 고객별로 독립된 VRF(Virtual Routing and Forwarding) 테이블을 유지하며, 이들 간에는 라우팅이 자동으로 공유되지 않는다. PE 장비는 RD(Route Distinguisher)와 VPN Target 속성을 통해 수신한 라우트를 적절한 VRF에 할당한다.
VPN Target 확장 커뮤니티 속성은 라우트의 발행과 수신을 제어한다. 각 VRF 인스턴스는 Export Target과 Import Target 값을 가지며, 연결된 PE 장비와 일치해야 정상적인 라우트 교환이 이루어진다.
라벨 스위칭 및 전달 과정
P 장비는 VPN 정보를 알지 못하며, 외부 레이블만 처리한다. PE 장비는 내부 레이블(VPN 레이블)을 부여하고, LDP를 통해 외부 레이블을 할당한다. 패킷 전송 시 두 개의 레이블 스택이 사용되며, 목적지 PE에서는 내부 레이블을 기반으로 해당 VPN을 식별한다.
PE-CE 연결 방식
고객망과 서비스망 간 연결은 여러 프로토콜을 통해 구현 가능하다:
- EBGP 연결
- 정적 라우팅
- OSPF, RIP 등의 IGP 프로토콜
실습 환경 구성 예제
운영자망(AS 100) 내에서 OSPF를 IGP로 사용하며, 두 개의 고객망(A사와 B사)이 서로 격리된 VPN으로 구성된다.
기본 IP 및 OSPF 설정
// R1 설정
system-view
sysname R1
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.0.14.1 255.255.255.0
interface GigabitEthernet0/0/2
ip address 10.0.15.1 255.255.255.0
ospf 1 router-id 10.0.1.1
area 0.0.0.0
network 10.0.1.1 0.0.0.0
network 10.0.12.0 0.0.0.255
// R2 설정
system-view
sysname R2
interface LoopBack0
ip address 10.0.2.2 255.255.255.255
interface GigabitEthernet0/0/0
ip address 10.0.12.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.0.23.2 255.255.255.0
ospf 1 router-id 10.0.2.2
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.12.0 0.0.0.255
network 10.0.23.0 0.0.0.255
// R3 설정
system-view
sysname R3
interface LoopBack0
ip address 10.0.3.3 255.255.255.255
interface GigabitEthernet0/0/0
ip address 10.0.36.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.0.23.3 255.255.255.0
interface GigabitEthernet0/0/2
ip address 10.0.37.3 255.255.255.0
ospf 1 router-id 10.0.3.3
area 0.0.0.0
network 10.0.3.3 0.0.0.0
network 10.0.23.0 0.0.0.255
MPLS 및 LDP 활성화
// R1 MPLS 설정
mpls lsr-id 10.0.1.1
mpls
mpls ldp
interface GigabitEthernet0/0/0
mpls
mpls ldp
// R2 MPLS 설정
mpls lsr-id 10.0.2.2
mpls
mpls ldp
interface GigabitEthernet0/0/0
mpls
mpls ldp
interface GigabitEthernet0/0/1
mpls
mpls ldp
// R3 MPLS 설정
mpls lsr-id 10.0.3.3
mpls
mpls ldp
interface GigabitEthernet0/0/1
mpls
mpls ldp
MP-BGP 설정
// R1 IBGP 설정
bgp 100
peer 10.0.3.3 as-number 100
peer 10.0.3.3 connect-interface LoopBack0
peer 10.0.3.3 next-hop-local
ipv4-family vpnv4
peer 10.0.3.3 enable
peer 10.0.3.3 advertise-community
// R3 IBGP 설정
bgp 100
peer 10.0.1.1 as-number 100
peer 10.0.1.1 connect-interface LoopBack0
peer 10.0.1.1 next-hop-local
ipv4-family vpnv4
peer 10.0.1.1 enable
peer 10.0.1.1 advertise-community
VRF 인스턴스 생성 및 인터페이스 바인딩
// R1 VRF 설정
ip vpn-instance CUSTOMER_A
ipv4-family
route-distinguisher 100:1
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity
ip vpn-instance CUSTOMER_B
ipv4-family
route-distinguisher 100:2
vpn-target 200:2 export-extcommunity
vpn-target 200:2 import-extcommunity
interface GigabitEthernet0/0/1
ip binding vpn-instance CUSTOMER_A
ip address 10.0.14.1 255.255.255.0
interface GigabitEthernet0/0/2
ip binding vpn-instance CUSTOMER_B
ip address 10.0.15.1 255.255.255.0
// R3 VRF 설정
ip vpn-instance CUSTOMER_A
ipv4-family
route-distinguisher 100:1
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity
ip vpn-instance CUSTOMER_B
ipv4-family
route-distinguisher 100:2
vpn-target 200:2 export-extcommunity
vpn-target 200:2 import-extcommunity
interface GigabitEthernet0/0/0
ip binding vpn-instance CUSTOMER_A
ip address 10.0.36.3 255.255.255.0
interface GigabitEthernet0/0/2
ip binding vpn-instance CUSTOMER_B
ip address 10.0.37.3 255.255.255.0
A사 EBGP 기반 PE-CE 연결
// R4 설정
bgp 65001
peer 10.0.14.1 as-number 100
network 10.0.4.4 255.255.255.255
// R1 VRF 내 BGP 설정
bgp 100
ipv4-family vpn-instance CUSTOMER_A
peer 10.0.14.4 as-number 65001
B사 정적 라우팅 및 OSPF 설정
// R5 정적 라우팅
ip route-static 0.0.0.0 0.0.0.0 10.0.15.1
// R1 VRF 정적 라우트 가져오기
ip route-static vpn-instance CUSTOMER_B 10.0.5.5 255.255.255.255 10.0.15.5
bgp 100
ipv4-family vpn-instance CUSTOMER_B
import-route static
// R7 OSPF 설정
ospf 2 router-id 10.0.7.7
area 0.0.0.0
network 10.0.37.0 0.0.0.255
network 10.0.7.7 0.0.0.0
// R3 OSPF-VRF 설정
ospf 2 vpn-instance CUSTOMER_B
import-route bgp
area 0.0.0.0
network 10.0.37.0 0.0.0.255
bgp 100
ipv4-family vpn-instance CUSTOMER_B
import-route ospf 2
OSPF를 통한 PE-CE 연결 시 물리적 링크 주소가 BGP로 유입되는 것을 방지하려면 필터링 정책을 적용해야 한다:
ip ip-prefix FILTER permit 10.0.5.5 32
ip ip-prefix FILTER permit 10.0.7.7 32
route-policy OSPF_FILTER permit node 10
if-match ip-prefix FILTER
bgp 100
ipv4-family vpn-instance CUSTOMER_B
import-route ospf 2 route-policy OSPF_FILTER