본문 바로가기

Ryu's Tech

BGP


Autonomous System 는 어떠한 관리단위라고 생각하면 쉽다.

IGP에는 OSPF, EIGRP가 있는데, 이는 AS안에서 이루어지는 프로토콜이며,

BGP는 Exterior Gateway Protocol이고, 이는 AS간의 통신을 한다. 과거에는 EGP라고 했다고?흠...

BGP는 path-vector routing protocol, like Distance vector protocol

Specifically BGP keeps track of autonomous systems that must be transited to reach a destination network

BGP 는 forwarding table을 가지고 있다. 이는 목적지로 가는 모든 패스를 가지고 있다.
최고의 경로는 IP routing table에 삽입되며, unless a more attractive route is already known to the IP routing table







BGP path selection


 

  • highest weight value.
  • highest local preference value
  • path originated by BGP on the local router
  • path having the shortest AS path
  • lowest origin type ( IGP < EGP < INCOMPLETE)
  • path with the lowest multi-exit discriminination
  • eBGP path over iBGP paths
  • path with the lowest IGP metric to the BGP next hop
  • path that points to a BGP router with lowest BGP router ID


TOPOLOGY DESCRIPTION

BB1,BB2는 AS가 다름.
R1 는 BB1과 BB2를 통해서 인터넷을 갈수있다. co-per? network
이것이 multi-home BGP이다.
R1-BB1의 경로를 primary 경로로 설정하고, 이에 대한 링크를 끊어 BB2로 연결해 볼것이다.



Syntax

Router(config)# router bgp as-number
enable BGP
Router(config-router)# network network-address [mask subnet-mask]
specify a network to be advertised by BGP routing process
Router(config-router)# neighbor ip-address remote-as as-number
Forms a BGP neighborship with a BGP peer located at the specified IP adds, belonging to the specified AS










설정
###R2
router ospf 1
network 0.0.0.0 0.0.0.0 a 0
! all of the interface ospf area 0


###R1
router ospf 1
network 192.168.1.0 0.0.0.3 a 0
exit
router bgp 65001
network  1.1.1.1 mask 255.255.255.255
network 172.16.1.0 mask 255.255.255.252
network 172.16.2.0 mask 255.255.255.252
neighbor 172.16.1.2 remote-as 65002
neighbor 172.16.2.2 remote-as 65003


##BB1
router bgp 65002
network 3.3.3.3 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.252
network 172.16.1.0 mask 255.255.255.252
neighbor 10.1.1.2 remote-as 65003
neighbor 172.16.1.1 remote-as 65001


##BB2
rotuer bgp 65003
network 4.4.4.4 mask 255.255.255.255
network 10.1.1.0 mask 255.255.255.252
network 172.16.2.0 mask 255.255.255.252
neighbor 10.1.1.1 remote-as 65002
neighbor 172.16.2.1 remote-as 65001




###R1
ping to all

###R2
sh ip route

###BB1
conf t
ip route 0.0.0.0 0.0.0.0 null 0
router bgp 65002
network 0.0.0.0
end


###BB2
conf t
ip route 0.0.0.0 0.0.0.0 null 0
router bgp 65003
network 0.0.0.0
end


###R1
sh ip ro
conf t
router bgp 65001
redistribute ospf 1
exit
router ospf 1
default-information originate




###R2
sh ip route
now knows about Default route!!!!!!!!!!!!!!!!
O*E2 tag;
ping to all



###BB1
ping to all


###R1
show ip bgp
!bgp forwarding table
show ip route
!to 10.1.1.0 via 172.16.1.2

shutdown s0/0.1
end
sh ip route
10.1.1.0 / 30 via 172.16.2.2

ping 10.1.1.1
........ 안된다............
라우팅 테이블에는 있는데.........


###BB1
2~3분뒤, neighbor가 죽은것을 안다


###R1
ping 10.1.1.1
OK