BGP filter 리소스(BGPFilter)는 BGP peer 리소스(BGPPeer)가 지정한 BGP 피어에서 임포트하거나 피어로 익스포트하는 경로를 제어하는 방법을 표현해요. BGP 라우팅을 세밀하게 걸러내는 필터라고 생각하면 쉬워요.
출처: 문서
본문
BGPFilter 규칙은 순서대로 적용돼요: 매치되는 첫 번째 규칙의 action이 즉시 실행돼요. 주소가 어떤 명시적인 BGP filter 규칙에도 매치되지 않으면 기본 액션은 Accept예요.
BGPFilter가 BGP 피어링에서 쓰이려면, 그 name이 해당 BGPPeer 리소스의 filters에 추가되어야 해요.
kubectl 명령에는 CLI에서 리소스 타입을 지정할 때 다음 대소문자를 구분하는 별칭을 쓸 수 있어요: bgpfilters.projectcalico.org
Sample YAML
apiVersion: projectcalico.org/v3
kind: BGPFilter
metadata:
name: my-filter
spec:
exportV4:
- action: Accept
matchOperator: In
cidr: 77.0.0.0/16
source: RemotePeers
- action: Reject
interface: '*.calico'
importV4:
- action: Accept
matchOperator: In
cidr: 55.0.0.0/16
prefixLength:
min: 30
- action: Reject
matchOperator: NotIn
cidr: 44.0.0.0/16
exportV6:
- action: Reject
source: RemotePeers
- action: Reject
interface: '*.calico'
importV6:
- action: Accept
matchOperator: Equal
cidr: 5000::0/64
- action: Reject
BGP filter definition
| Field |
Description |
Accepted Values |
Schema |
name |
이 리소스 인스턴스를 설명하는 고유 이름이에요. 반드시 지정해야 해요. |
알파벳·숫자 문자열에 ., _, - 허용. |
string |
Spec
BGP Filter Rule v4
| Field |
Description |
Accepted Values |
Schema |
Default |
cidr |
IPv4 범위 |
유효한 IPv4 CIDR |
string |
|
prefixLength |
PrefixLength |
0부터 ipv4/6 최댓값(32, 128) 사이의 유효한 정수 |
|
|
matchOperator |
후보 경로를 매치하는 방법 |
In, NotIn, Equal, NotEqual |
string |
|
source |
경로의 출처를 나타내는 지시자 |
RemotePeers는 다른 BGP 피어에서 학습한 모든 경로를 의미해요 |
string |
|
interface |
인터페이스 이름을 매치하는 문자열 |
인터페이스를 매치하는 유효한 패턴. "*"를 와일드카드로 쓸 수 있어요. |
string |
|
peerType |
지정한 BGP 피어 타입에서 오거나 가는 경로에만 이 규칙을 적용해요. 비워 두면 모든 피어에 적용돼요. |
eBGP, iBGP |
string |
|
priority |
지정한 우선순위(metric)를 가진 경로에만 이 규칙을 적용해요. FelixConfiguration의 ...RoutePriority 필드와 같은 단위를 써요. |
1-2147483646 |
integer |
|
communities |
지정한 BGP community를 가진 경로에만 이 규칙을 적용해요. |
BGP Filter Community Match 참고. |
object |
|
action |
이 규칙에 대해 취할 액션 |
Accept 또는 Reject |
string |
|
operations |
규칙이 매치됐을 때 적용할 경로 수정 작업의 순서 있는 목록이에요. action이 Accept일 때만 유효해요. 최대 10개의 operations. |
BGP Filter Operation 참고. |
list |
|
BGP Filter Rule v6
| Field |
Description |
Accepted Values |
Schema |
Default |
cidr |
IPv6 범위 |
유효한 IPv6 CIDR |
string |
|
prefixLength |
PrefixLength |
0부터 ipv4/6 최댓값(32, 128) 사이의 유효한 정수 |
|
|
matchOperator |
후보 경로를 매치하는 방법 |
In, NotIn, Equal, NotEqual |
string |
|
source |
경로의 출처를 나타내는 지시자 |
RemotePeers는 다른 BGP 피어에서 학습한 모든 경로를 의미해요 |
string |
|
interface |
인터페이스 이름을 매치하는 문자열 |
인터페이스를 매치하는 유효한 패턴. "*"를 와일드카드로 쓸 수 있어요. |
string |
|
peerType |
지정한 BGP 피어 타입에서 오거나 가는 경로에만 이 규칙을 적용해요. 비워 두면 모든 피어에 적용돼요. |
eBGP, iBGP |
string |
|
priority |
지정한 우선순위(metric)를 가진 경로에만 이 규칙을 적용해요. FelixConfiguration의 ...RoutePriority 필드와 같은 단위를 쓰요. |
1-2147483646 |
integer |
|
communities |
지정한 BGP community를 가진 경로에만 이 규칙을 적용해요. |
BGP Filter Community Match 참고. |
object |
|
action |
이 규칙에 대해 취할 액션 |
Accept 또는 Reject |
string |
|
operations |
규칙이 매치됐을 때 적용할 경로 수정 작업의 순서 있는 목록이에요. action이 Accept일 때만 유효해요. 최대 10개의 operations. |
BGP Filter Operation 참고. |
list |
|
BGP Filter Prefix Length
| Field |
Description |
Accepted Values |
Schema |
Default |
min |
매치되는 가장 작은 마스크 크기 (기본값 0) |
0부터 ipv4/6 최댓값(32, 128) 사이의 유효한 정수 |
int |
|
max |
매치되는 가장 큰 마스크 크기 (기본값 32/128) |
1부터 ipv4/6 최댓값(32, 128) 사이의 유효한 정수 |
int |
|
| Field |
Description |
Accepted Values |
Schema |
values |
매치할 BGP community 값의 목록이에요. 경로는 이 커뮤니티 중 최소 하나를 반드시 가져야 해요. |
standard (aa:nn) 또는 large (aa:nn:mm) community 값. |
list of string |
BGP Filter Operation
각 operation은 다음 필드 중 정확히 하나만 설정된 객체예요:
| Field |
Description |
Accepted Values |
Schema |
value |
추가할 BGP community 값이에요. |
standard (aa:nn) 또는 large (aa:nn:mm) community 값. |
string |
BGP Filter Prepend AS Path
| Field |
Description |
Accepted Values |
Schema |
prefix |
경로의 AS path 앞에 붙일 AS 번호 시퀀스예요. 결과 경로는 나열된 순서대로 이 AS 번호들로 시작해요 (예: [65000, 65001]은 65000 65001 <original>을 만들어요). |
유효한 AS 번호 1-10개의 목록이에요. |
list of integer |
BGP Filter Set Priority
| Field |
Description |
Accepted Values |
Schema |
value |
경로에 설정할 우선순위(metric) 값이에요. FelixConfiguration RoutePriority 필드와 같은 단위를 써요. |
1-2147483646 |
integer |
Supported operations
| Datastore type |
Create/Delete |
Update |
Get/List |
Notes |
| Kubernetes API server |
Yes |
Yes |
Yes |
|
더 알아보기 (Learn more)