본문 바로가기
network/ccie-mpls

MPLS VPN BASIC LAB

- 아래와 같이 R4와 R6은 BGP로 VPN연결, R5와 R7은 OSPF로 VPN연결 하며 P장비는 네트워크 정보를 모르도록,
MPLS VPN을 구성하는 lab이다.



## 아래와 같이 4,6장비는 각 PE장비와 EBGP로 네이버 연결을 하도록 설정 한다.
R4(config)#router bgp 14
 network 4.4.4.4 mask 255.255.255.255
 neighbor 10.10.14.1 remote-as 123

R4(config)# router bgp 36
 network 6.6.6.6 mask 255.255.255.255
 neighbor 10.10.36.3 remote-as 123

## R1과 3은 각각 2개의 vrf를 사용 해야 하기 때문에 rd,rt를 설정 해준다.
R1(config)# ip vrf cus_a
 rd 1:1   
 route-target export 1:1
 route-target import 1:1
!
R1(config)# ip vrf cus_b
 rd 2:2
 route-target export 2:2
 route-target import 2:2

R3(config)# ip vrf cus_a
 rd 1:1   
 route-target export 1:1
 route-target import 1:1
!
R3(config)# ip vrf cus_b
 rd 2:2
 route-target export 2:2
 route-target import 2:2

## R1과 3에서 각각 고객의 vrf 이름으로 인터페이스에 설정 하며 외부로 P장비로 가는 인터페이스는 MPLS설정을 진행 한다.
## vrf 를 인터페이스에 설정시 glabal 과,vrf 영역간의 아이피 충돌을 위해 아이피가 초기화 되니 기존에 설정시 다시 설정 해야 한다.
## 사전에 R1,2,3 은 각각 ospf 로 네이버 연결 되어 있음
R1(config)# interface Ethernet1/0
 ip vrf forwarding cus_a
 ip address 10.10.14.1 255.255.255.0
 duplex half
!
R1(config)# interface Ethernet1/1
 ip vrf forwarding cus_b
 ip address 10.10.15.1 255.255.255.0
 duplex half
!
R1(config)# interface Ethernet1/2
 ip address 10.10.12.1 255.255.255.0
 duplex half
 mpls ip
!

R3(config)# interface Ethernet1/0
 ip vrf forwarding cus_a
 ip address 10.10.36.3 255.255.255.0
 duplex half
!
R3(config)# interface Ethernet1/1
 ip vrf forwarding cus_b
 ip address 10.10.37.3 255.255.255.0
 duplex half
!
R3(config)# interface Ethernet1/2
 no ip address
 shutdown
 duplex half
!
R3(config)# interface Ethernet1/3
 ip address 10.10.23.3 255.255.255.0
 duplex half
 mpls ip
!

## 중간 P 장비는 MPLS설정만 하여 LDP 네이버를 확인 한다.
R2(config)# interface Ethernet1/2
 ip address 10.10.12.2 255.255.255.0
 duplex half
 mpls ip
!
R2(config)# interface Ethernet1/3
 ip address 10.10.23.2 255.255.255.0
 duplex half
 mpls ip
!

## R1에서 BGP123 프로세스를 활성화후 아래와 같이 진행한다.
router bgp 123
 no bgp default ipv4-unicast //기존에 bpg 프로세스가 ipv4 이기 때문에 global 에서 disabled 시켜, 필요한 부분만 active 한다.
 neighbor 3.3.3.3 remote-as 123 // 3.3.3.3 R3과의 ibgp 네이버를 맺는다.
 neighbor 3.3.3.3 update-source Loopback0 // R3과 네이버시 소스 아이피를 루프백 아이피로 설정 한다.
 !
 address-family ipv4 // 기존의 ipv4 가 disabled 되어 있기 때문에 address familly 영역에서 R3과 네이버를 active 시켜 준다.
 neighbor 3.3.3.3 activate
 exit-address-family
 !
 address-family vpnv4 // MP-BGP 시  R3에 대하여 vpnv4 에 대한 정보를 주기 위해 R3을 vpnv4 active 해준다.
 neighbor 3.3.3.3 activate
 neighbor 3.3.3.3 send-community extended // RT를 확장 커뮤니티로 보내기 위해서 설정 하는데, 컨피그 미입력 시에도 기본 입력 된다.
 exit-address-family
 !
 address-family ipv4 vrf cus_a // ipv4 를 사용 하는 vrf cus_a 에 대하여 R4장비는 VRF로 들어 오기떄문에 해당 VRF에서 해당 4장비와 네이버를 맺는다.
 neighbor 10.10.14.4 remote-as 14
 neighbor 10.10.14.4 activate
 exit-address-family

## 마찬가지로 R3도 BGP설정을 진행 한다.
router bgp 123
 no bgp default ipv4-unicast
 neighbor 1.1.1.1 remote-as 123
 neighbor 1.1.1.1 update-source Loopback0
 !
 address-family ipv4
 neighbor 1.1.1.1 activate
 exit-address-family
 !
 address-family vpnv4
 neighbor 1.1.1.1 activate
 neighbor 1.1.1.1 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf cus_b
 redistribute ospf 1 vrf cus_b
 exit-address-family
 !
 address-family ipv4 vrf cus_a
 neighbor 10.10.36.6 remote-as 36
 neighbor 10.10.36.6 activate
 exit-address-family

## R4에서 ping test 시에 정상적이며 ,BGP테이블에 올라와 있는 것을 확인 할 수 있다.
R4#show ip bgp
*Mar 21 18:38:46.147: %SYS-5-CONFIG_I: Configured from console by console
R4#show ip bgp
BGP table version is 3, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       0.0.0.0                  0         32768 i
*> 6.6.6.6/32       10.10.14.1                             0 123 36 i
R4#ping 6.6.6.6 so 4.4.4.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 4.4.4.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/67/100 ms

## ping test시 R1과 P장비인 R2간의 패킷을 확인 하면 2개의 label을 확인 할 수 있다.



## R1에서 바인딩 테이블을 확인 하면 17번 태그는 3.3.3.3 으로 가기 위한 태그로 17번을 달고 R2로 전달 된다.
R1#show mpls ldp bindings
  tib entry: 1.1.1.1/32, rev 2
        local binding:  tag: imp-null
        remote binding: tsr: 2.2.2.2:0, tag: 16
  tib entry: 2.2.2.2/32, rev 10
        local binding:  tag: 16
        remote binding: tsr: 2.2.2.2:0, tag: imp-null
  tib entry: 3.3.3.3/32, rev 14
        local binding:  tag: 18
        remote binding: tsr: 2.2.2.2:0, tag: 17
  tib entry: 10.10.12.0/24, rev 4
        local binding:  tag: imp-null
        remote binding: tsr: 2.2.2.2:0, tag: imp-null
  tib entry: 10.10.23.0/24, rev 12
        local binding:  tag: 17
        remote binding: tsr: 2.2.2.2:0, tag: imp-null

## R2와 R3간의 패킷을 확인 하면 19번 label만 확인 할 수 있다.


## R2에서 3.3.3.3 으로 가기 위해서 imp-null 로 pop되어 해더에 lable 이 pop되어 R3에서는 19번 label만 달고 R3에서 해당 VRF를 찾아 갈수 있게 한다.

R2#show mpls ldp bindings
  tib entry: 1.1.1.1/32, rev 8
        local binding:  tag: 16
        remote binding: tsr: 1.1.1.1:0, tag: imp-null
        remote binding: tsr: 3.3.3.3:0, tag: 17
  tib entry: 2.2.2.2/32, rev 2
        local binding:  tag: imp-null
        remote binding: tsr: 1.1.1.1:0, tag: 16
        remote binding: tsr: 3.3.3.3:0, tag: 18
  tib entry: 3.3.3.3/32, rev 12
        local binding:  tag: 17
        remote binding: tsr: 3.3.3.3:0, tag: imp-null
        remote binding: tsr: 1.1.1.1:0, tag: 18
  tib entry: 10.10.12.0/24, rev 4
        local binding:  tag: imp-null
        remote binding: tsr: 1.1.1.1:0, tag: imp-null
        remote binding: tsr: 3.3.3.3:0, tag: 16
  tib entry: 10.10.23.0/24, rev 6
        local binding:  tag: imp-null
        remote binding: tsr: 1.1.1.1:0, tag: 17
        remote binding: tsr: 3.3.3.3:0, tag: imp-null

## R5와 7에는VPN구성을 하기 위해 ospf설정을 진행 한다.
R5(config)# router ospf 1
 log-adjacency-changes
 network 5.5.5.5 0.0.0.0 area 0
 network 10.10.15.5 0.0.0.0 area 0

!
R7(config)# router ospf 1
 log-adjacency-changes
 network 7.7.7.7 0.0.0.0 area 0
 network 10.10.37.7 0.0.0.0 area 0

## R3,1  에서는 vrf 로 cus_b에 ospf 프로세스를 추가한다. 이때,MP-BGP에 있는 정보를 받기 위해서 ospf 에 bgp정보를 재분배 하여 받을수 있게 한다.

R1(config)# router ospf 1 vrf cus_b
 log-adjacency-changes
 redistribute bgp 123 subnets
 network 10.10.15.1 0.0.0.0 area 0
!

R3(config)# router ospf 1 vrf cus_b
 log-adjacency-changes
 redistribute bgp 123 subnets
 network 10.10.37.3 0.0.0.0 area 0
!

## vrf cus_B 로 동작하는 ipv4 로 받을 bgp에 ospf정보를 재분배 한다.

 R1(config)#
router bgp 123
address-family ipv4 vrf cus_b 
 redistribute ospf 1 vrf cus_b
 no synchronization
 exit-address-family

 R3(config)#
router bgp 123
address-family ipv4 vrf cus_b 
 redistribute ospf 1 vrf cus_b
 no synchronization
 exit-address-family


## R5와 R7간의 ping test및 라우팅 테이블을 확인 한다.
R5#ping 7.7.7.7

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 80/94/112 ms
R5#
R5#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     5.0.0.0/32 is subnetted, 1 subnets
C       5.5.5.5 is directly connected, Loopback0
     7.0.0.0/32 is subnetted, 1 subnets
O IA    7.7.7.7 [110/21] via 10.10.15.1, 00:58:24, Ethernet1/1
     10.0.0.0/24 is subnetted, 2 subnets
C       10.10.15.0 is directly connected, Ethernet1/1
O IA    10.10.37.0 [110/11] via 10.10.15.1, 00:58:24, Ethernet1/1
반응형