[MPLS] MPLS VPN 구축하기

* EVE-NG를 사용하여 작성되었습니다.
혹 EVE-NG Lab 파일이 필요하신 분은 댓글 남겨주세요.

  1. 기본 토폴로지 구성
  2. MPLS VPN 서비스망 설정
    MPLS 라우터 간 LDP 설정
    PE 라우터 간 MBGP 설정
  3. MPLS VPN 고객망 설정
    Company A 설정
    Company B 설정

1. 기본 토폴로지 구성

  • 각 네트워크의 마지막 옥텟은 라우터 번호로 지정한다.
    ex) R1: 1.1.12.1, 10.1.15.1, 10.1.17.1
    R4: 1.1.34.4, 10.1.46.4, 10.1.48.4

2. MPLS VPN 서비스망 설정

(1) MPLS 라우터 간 LDP 설정

R1(config)# mpls label protocol ldp
R1(config)# mpls ldp router-id lo0
R1(config)# int fa0/0
R1(config-if)# mpls ip

R2(config)# mpls label protocol ldp
R2(config)# mpls ldp router-id lo0
R2(config)# int fa0/0
R2(config-if)# mpls ip
R2(config-if)# int fa1/0
R2(config-if)# mpls ip

R3(config)# mpls label protocol ldp
R3(config)# mpls ldp router-id lo 0
R3(config)# int fa1/0
R3(config-if)# mpls ip
R3(config-if)# int fa2/0
R3(config-if)# mpls ip
R3(config-if)#

R4(config)# mpls label protocol ldp
R4(config)# mpls ldp router-id lo 0
R4(config)# int fa2/0
R4(config-if)# mpls ip

1: MPLS 라벨 바인딩 정보 전송 프로토콜을 지정한다.
LDP, TDP를 지정할 수 있다. LDP가 디폴트 값이다.
2: LDP Router-id로 사용할 인터페이스를 지정한다.
router-id를 따로 지정하지 않을 경우 ‘루프백 인터페이스 IP’ (높은->낮은) -> ‘물리 인터페이스 IP’ 순으로 지정된다.
3,4: MPLS가 동작할 인터페이스로 들어가서 MPLS를 사용한다고 지정한다. PE-CE 구간에서는 적용하지 않는다.

LDP 설정 확인

LDP Neighbor를 확인할 수 있다.
LIB 정보를 확인할 수 있다.

– 네트워크 별로 각 LSR이 부여한 라벨값을 모두 저장한 것을 확인할 수 있다.

LFIB 정보를 확인할 수 있다.

(2) PE 라우터 간 MBGP 설정

R1(config)# router bgp 1
R1(config-router)# bgp router-id 1.1.1.1
R1(config-router)# neighbor 1.1.4.4 remote-as 1
R1(config-router)# neighbor 1.1.4.4 update-source lo0
R1(config-router)# address-family vpnv4
R1(config-router-af)# neighbor 1.1.4.4 activate
R1(config-router-af)# neighbor 1.1.4.4 send-community extended

R4(config)# router bgp 1
R4(config-router)# bgp router-id 1.1.4.4
R4(config-router)# neighbor 1.1.1.1 remote-as 1
R4(config-router)# neighbor 1.1.1.1 update-source lo0
R4(config-router)# address-family vpnv4
R4(config-router-af)# neighbor 1.1.1.1 activate
R4(config-router-af)# neighbor 1.1.1.1 send-community both

5: MBGP 설정모드로 진입한다. MPLS VPN을 사용하기 위해선 vpnv4 옵션을 입력해야 한다.
6: 네이버를 활성화한다.
7: MPLS VPN에서 사용되는 RT 등과 같은 BGP 확장 커뮤니티를 전송할 수 있도록 설정한다.
만약, MPLS VPN 외 BGP에서 표준 커뮤니티를 사용해 정책 설정해야 한다면, 15번째 줄처럼 both 옵션을 사용한다.

BGP 확인

3. MPLS VPN 고객망 설정

(1) Company A 설정

R1 (PE) <-> R5 (CE) 구간

< VRF 설정 > 
R1(config)# ip vrf A_company
R1(config-vrf)# rd 1:100
R1(config-vrf)# route-target export 1:101
R1(config-vrf)# route-target import 1:102
R1(config-vrf)# exit
R1(config)#
R1(config)# int fa1/0
R1(config-if)# ip vrf forwarding A_company
R1(config-if)# ip addr 10.1.15.1 255.255.255.0
R1(config-if)#
R1(config-if)# exit

< Static Routing 설정 >
R1(config)#
R1(config)# ip route vrf A_company 10.1.1.0 255.255.255.0 10.1.15.5

< BGP 설정 >
R1(config)#
R1(config)# router bgp 1
R1(config-router)# address-family ipv4 vrf A_company
R1(config-router-af)# redistribute static
R1(config-router-af)# redistribute connected
R1(config-router-af)# exit
R1(config-router)# exit
R1(config)#

< R5 Static Default Routing 설정 >
R5(config)# ip route 0.0.0.0 0.0.0.0 10.1.15.1

2: A_company라는 VRF의 설정모드로 진입한다.
3: RD 값을 지정한다.
4: A_company에 소속된 네트워크(CE 라우터의 네트워크)에 대한 RT 값을 지정한다.
5: 인접 CE라우터로 광고할 때 사용하는 RT값을 지정한다.
즉, RT값이 1:102인 네트워크와 통신이 되도록 한다.
9: 해당 인터페이스에 먼저 설정한 VRF를 적용한다.
10: IP주소를 지정한다. 이때, 기존에 설정된 IP는 삭제되고 다시 IP주소를 적용하게 된다.
16: R1에서 R5 내부망으로 정적 경로를 설정한다.
21: MBGP를 이용해 VRF A_company의 네트워크가 상대 PE 라우터로 전달되도록 한다.
22: Static Routing과 BGP를 재분배한다.
23: PE-CE구간의 네트워크를 MBGP에 포함시킨다. 이 명령어를 사용하지 않으면, R1에서 R6로 접근할 때 source가 R1임을 밝혀야 한다. 예를 들어 ping 테스트를 진행한다면, ‘ping 10.1.2.2 source 10.1.1.1’을 쳐야 한다. 하지만, 이 명령어를 사용하므로 ‘ping 10.1.2.2’만 치면 된다.
29: R5에서 Default Static Routing을 설정한다.

R4 (PE) <-> R6 (CE) 구간

< VRF 설정 > 
R4(config)# ip vrf A_company
R4(config-vrf)# rd 1:100
R4(config-vrf)# route-target export 1:102
R4(config-vrf)# route-target import 1:101
R4(config-vrf)# exit
R4(config)# int fa1/0
R4(config-if)# ip vrf forwarding A_company
R4(config-if)# ip addr 10.1.46.4 255.255.255.0
R4(config-if)# exit

< Static Routing 설정 >
R4(config)#
R4(config)# ip route vrf A_company 10.1.2.0 255.255.255.0 10.1.46.6

< BGP 설정 >
R4(config)#
R4(config)# router bgp 1
R4(config-router)# address-family ipv4 vrf A_company
R4(config-router-af)# redistribute static
R4(config-router-af)# redistribute connected
R4(config-router-af)# exit
R4(config-router)# exit

< R6 Static Default Routing 설정 >
R6(config)# ip route 0.0.0.0 0.0.0.0 10.1.46.4

고객망 설정 확인

R1 (PE) -> R5 (CE) Ping Test

VRF 설정 후 R1에서 R5로 ping은 안된다. R1 라우팅 테이블에는 VRF A_company와 관련된 네트워크 정보가 없고, VRF별 라우팅 테이블로 변경되기 때문이다. 그래서 ping할 때에는 VRF A_company를 명시해야 한다.

R1의 (글로벌) 라우팅 테이블
R1의 VRF 라우팅 테이블

앞서 언급한 것처럼 CE 네트워크 정보는 VRF 라우팅 테이블에 있는 것을 확인할 수 있다.

정상적으로 Ping Test가 성공하는 것을 볼 수 있다.

(2) Company B 설정

< R1 - R7 구성 >
R1(config)# ip vrf B_company
R1(config-vrf)# rd 1:200
R1(config-vrf)# route-target export 1:201
R1(config-vrf)# route-target import 1:202
R1(config-vrf)# exit
R1(config)#
R1(config)# int fa3/0
R1(config-if)# ip vrf forwarding B_company
R1(config-if)# ip addr 10.1.17.1 255.255.255.0
R1(config-if)# exit
R1(config-if)#
R1(config)# ip route vrf B_company 10.1.1.0 255.255.255.0 10.1.17.7
R1(config)#
R1(config)# router bgp 1
R1(config-router)# address-family ipv4 vrf B_company
R1(config-router-af)# redistribute static
R1(config-router-af)# redistribute connected
R1(config-router-af)# exit
R1(config-router)# exit
R1(config)#

R7(config)# ip route 0.0.0.0 0.0.0.0 10.1.17.1

< R4 - R8 구성 > 
R4(config)# ip vrf B_company
R4(config-vrf)# rd 1:200
R4(config-vrf)# route-target export 1:202
R4(config-vrf)# route-target import 1:201
R4(config-vrf)# exit
R4(config)# int fa3/0
R4(config-if)# ip vrf forwarding B_company
R4(config-if)# ip addr 10.1.48.4 255.255.255.0
R4(config-if)# exit
R4(config)#
R4(config)# ip route vrf B_company 10.1.2.0 255.255.255.0 10.1.48.8
R4(config)# router bgp 1
R4(config-router)#address-family ipv4 vrf B_company
R4(config-router-af)#redistribute static
R4(config-router-af)#redistribute connected
R4(config-router-af)#exit
R4(config-router)#exit

R8(config)#ip route 0.0.0.0 0.0.0.0 10.1.48.4

6 thoughts on “[MPLS] MPLS VPN 구축하기”

답글 남기기

이메일 주소는 공개되지 않습니다.