- BGP Message 종류
TCP 179번 사용하여 Session 연결
1) Open: BGP가 TCP 3-way 방법으로 TCP 연결 후 BGP 연결 시 사용되는 메세지
2) Update: BGP 연결 후 네트워크 정보를 라우팅하기 위해 사용되는 메세지
3) Keepalive: BGP Peer 연결 후. Update 없을 때 Peer 관계 유지 위해 1분 주기로 교환하는 메세지
(Hello Interval: 60sec, Dead Interval: 180sec)
4) Notification: BGP 상태, 연결 문제 시 해결위해 사용되는 메세지 (보통 AS Number wrong)
- BGP 6가지 state
1) Idle: neighbor 찾을 수 없음, peer가 라우팅 테이블에 존재하지 않음
2) Connected: TCP 연결 수립
3) Opensent: Open 메세지 보내고 기다림, 5초 안에 응답 오면 Open confirm 상태, 응답 없으면 Active 상태
4) Established: Update 시작 (표기X)
- BGP 테이블 보는 법
1) >: 최적의 경로
2) r: RIB에 저장되지 못한 경로 (BGP AD 보다 더 낮은 AD의 라우팅 프로토콜이 Best route로 선택)
3) i: iBGP 네이버에게 수신한 BGP 경로
4) i: Path 줄의 i는 network 명령어로 BGP 포함된 경로
- BGP 확인 명령어
1) sh bgp al sum
2) sh ip bgp
3) sh ip bgp nei x.x.x.x advertised-routes (네이버로 광고된 루트 정보)
sh bgp ipv6 unicast nei x:x:x:x:x:x:x:x advertised-routes
Network로 내가 네이버에 광고하고 있는 대역
4) sh ip bgp nei x.x.x.x received-routes (네이버로부터 광고받은 루트 정보)
sh bgp ipv6 unicast nei x:x:x:x:x:x:x:x received-routes
next-hop이 neighbor 주소
위 명령어의 경우 inbound soft reconfiguration 설정이 필요
<단계별 BGP 실습>
1) R1<->R2, R4<->R5간 EBGP 연동
R1 Configuration
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback100
ip address 100.1.1.1 255.255.255.255
!
interface Loopback110
ip address 110.1.1.1 255.255.255.255
!
interface Loopback120
ip address 120.1.1.1 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.12.1 255.255.255.252
router bgp 100
bgp log-neighbor-changes
network 1.1.1.1 mask 255.255.255.255
network 10.1.12.1 mask 255.255.255.255
neighbor 10.1.12.2 remote-as 3786
R2 Configuration
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 10.1.12.2 255.255.255.252
!
interface Ethernet0/1
ip address 192.168.23.1 255.255.255.252
!
router bgp 3786
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
network 10.1.12.2 mask 255.255.255.255
network 192.168.23.1 mask 255.255.255.255
neighbor 10.1.12.1 remote-as 100
R4 Configuration
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 192.168.34.2 255.255.255.252
!
interface Ethernet0/1
ip address 20.1.45.1 255.255.255.252
router bgp 3786
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
network 20.1.45.1 mask 255.255.255.255
network 192.168.34.2 mask 255.255.255.255
neighbor 20.1.45.2 remote-as 200
R5 Configuration
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Loopback200
ip address 200.1.1.1 255.255.255.255
!
interface Loopback210
ip address 210.1.1.1 255.255.255.255
!
interface Loopback220
ip address 220.1.1.1 255.255.255.255
!
interface Ethernet0/0
ip address 20.1.45.2 255.255.255.252
router bgp 200
bgp log-neighbor-changes
network 5.5.5.5 mask 255.255.255.255
network 20.1.45.2 mask 255.255.255.255
neighbor 20.1.45.1 remote-as 3786
!
R1과 R5에 대해서 BGP 프로토콜에 Connected 정보를 redistribute 해줘야 R1, R5의 모든 Lo 에 대해서 광고 가능
Router(config)#router bgp 200
Router(config-router)#redistribute connected
EBGP Neighbor를 Loopback으로 맺으려면?
lo로 네이버 맺는 이유? : 물리적인 포트와 관계없이 논리 주소라 튼튼(?)하다. 장애로 다운될 수 있는 물리 인터페이스에 비해 루프백 인터페이스는 장비가 완전히 다운되지 않는 한 계속 동작한다.
1) neighbor [ip address] update-source [loopback number]
2) neighbor [ip address] ebgp-multihop [hop-count number]
위 명령어 두개가 필수.
1)은 네이버로 가는 BGP 출발 주소를 loopback으로 변경하는 명령어
2)는 eBGP TTL을 수정하는 명령어로, 홉카운트는 디폴트로 1을 갖는데 1이면 패킷이 물리 포트에만 도달하여 루프백으로 로 전달될 수 없으므로 설정 필요 (2이상으로 설정)
2) R2, R3, R4 라우터간 loopback interface로 네이버 맺고 OSPF 설정
- IBGP는 OSPF와 같은 IGP 설정을 함께 해줘야 통신 가능
- IBGP는 IBGP에게 받은 정보를 IBGP한테 전달할 수 없음 (그렇기에 full mesh 구성이나 RR 설정 필요)
- next-hop-self: eBGP에서 iBGP로 네트워크 경로가 넘어와도 next-hop 주소가 바뀌지 않는다. 아래 그림을 보면 R3 입장에서는 eBGP 구간인 R1<->R2 사이 경로를 알 수 없다. 따라서 R2(R4)에 nei 3.3.3.3 next-hop-self와 같은 설정이 필요하다.
- update source lo 0: 루프백으로 네이버 맺는 경우에 설정 필요
R2 Configuration
router ospf 3786
network 2.2.2.2 0.0.0.0 area 0
network 192.168.23.1 0.0.0.0 area 0
router bgp 3786
redistribute connected
redistribute ospf 3786
neighbor 3.3.3.3 remote-as 3786
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
R3 Configuration
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
ip address 192.168.23.2 255.255.255.252
!
interface Ethernet0/1
ip address 192.168.34.1 255.255.255.252
router ospf 3786
network 3.3.3.3 0.0.0.0 area 0
network 192.168.23.2 0.0.0.0 area 0
network 192.168.34.1 0.0.0.0 area 0
!
router bgp 3786
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 192.168.23.2 mask 255.255.255.255
network 192.168.34.1 mask 255.255.255.255
redistribute ospf 3786
neighbor 2.2.2.2 remote-as 3786
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 route-reflector-client //iBGP 통신 위해 RR 설정
neighbor 4.4.4.4 remote-as 3786
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 route-reflector-client //iBGP 통신 위해 RR 설정
!
R4 Configuration
router ospf 3786
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.2 0.0.0.0 area 0
!
redistribute connected
redistribute ospf 3786
neighbor 3.3.3.3 remote-as 3786
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
모든 Lo 간에 통신이 되도록 설정을 마쳐주었다.
sh ip route, sh bgp all sum, sh ip bgp로 확인 필요 , 근데 귀찮아서 캡쳐는 안하겠음
아래와 같이 sh ip route 했을 때 iBGP 구간의 라우터들은 서로 OSPF로 통신하고 있다고 뜨는 것이 정상이다.
OSPF의 AD 값은 90, iBGP AD 값은 200으로 OSPF의 AD 값이 작아서 OSPF Path가 best path로 선택되었기 때문이다.
따라서 iBGP에 OSPF 라우팅 정보 재분배 필수
'네트워크 공부' 카테고리의 다른 글
Cisco Catalyst 9300L smart license install 방법 (0) | 2024.08.28 |
---|---|
vPC 정리 (개념, 용어, Case별 flow) (2) | 2024.01.22 |
L2 설정으로만 구성 시 유의점 (2) | 2023.12.13 |
vPC 개념 및 케이스 정리 (0) | 2023.07.26 |
BGP 기본 공부 - LAB 실습 (1) (0) | 2023.07.06 |