BGP Communities / BGP 社区

Our BGP communities in DN42 / 我们在 DN42 中的 BGP 社区

We adopted the BGP community settings recommended in the DN42 Wiki. At the same time, we recommend that other networks deploy similar strategies.

我们采用了 DN42 Wiki 中推荐的 BGP 社区设置。同时,我们建议其他网络部署类似的策略。

1: Continent / 大洲 (Internal Use / 内部使用)

  • (207268, 1, 41) :: Europe / 欧洲

  • (207268, 1, 42) :: North America-E / 北美东部

  • (207268, 1, 43) :: North America-C / 北美中部

  • (207268, 1, 44) :: North America-W / 北美西部

  • (207268, 1, 45) :: Central America / 中美洲

  • (207268, 1, 46) :: South America-E / 南美洲东部

  • (207268, 1, 47) :: South America-W / 南美洲西部

  • (207268, 1, 48) :: Africa-N (above Sahara) / 撒哈拉以北非洲

  • (207268, 1, 49) :: Africa-S (below Sahara) / 撒哈拉以南非洲

  • (207268, 1, 50) :: Asia-S (IN,PK,BD) / 南亚

  • (207268, 1, 51) :: Asia-SE (TH,SG,PH,ID,MY) / 东南亚

  • (207268, 1, 52) :: Asia-E (JP,CN,KR) / 东亚

  • (207268, 1, 53) :: Pacific / 太平洋

1*: Auto Translation / 自动转换

The provided DN42 community will rewrite the above rules.

提供的DN42 community将会重写以上规则。

  • (64511, 41) :: Europe

  • (64511, 42) :: North America-E

  • (64511, 43) :: North America-C

  • (64511, 44) :: North America-W

  • (64511, 45) :: Central America

  • (64511, 46) :: South America-E

  • (64511, 47) :: South America-W

  • (64511, 48) :: Africa-N (above Sahara)

  • (64511, 49) :: Africa-S (below Sahara)

  • (64511, 50) :: Asia-S (IN,PK,BD)

  • (64511, 51) :: Asia-SE (TH,SG,PH,ID,MY)

  • (64511, 52) :: Asia-E (JP,CN,KR)

  • (64511, 53) :: Pacific

2: Local Pref

  • (207268, 2, 1) :: bgp_local_pref = 100

  • (207268, 2, 2) :: bgp_local_pref = 200

  • (207268, 2, 3) :: bgp_local_pref = 0

3: Rule Control / 规则控制

  • Internet eXchange Routes / 互联网交换点路由

    • (207268, 3, 10) :: No-export Downstream Routes (Default) / 不对外宣告下游路由 (默认)

      • local_pref - 1

    • (207268, 3, 11) :: Force-export Downstream Routes / 强制对外宣告下游路由

  • China Mainland Routes / 中国大陆路由

    • (207268, 3, 20) :: Comes from China Mainland / 来自中国大陆

Local Pref

Our local preference will be calculated by the following formula:

我们的 local preference 将通过下列公式计算:

if REGION = 41 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 100;
}
if REGION = 42 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 110;
}
if REGION = 43 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 44 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 45 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 46 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 120;
}
if REGION = 47 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 48 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 100;
}
if REGION = 49 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 100;
}
if REGION = 50 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 51 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 52 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 140;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 150;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 130;
}
if REGION = 53 then {
if (OWNAS, 1, 41) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 42) ~ bgp_large_community then bgp_local_pref = 110;
if (OWNAS, 1, 43) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 44) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 45) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 46) ~ bgp_large_community then bgp_local_pref = 120;
if (OWNAS, 1, 47) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 48) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 49) ~ bgp_large_community then bgp_local_pref = 100;
if (OWNAS, 1, 50) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 51) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 52) ~ bgp_large_community then bgp_local_pref = 130;
if (OWNAS, 1, 53) ~ bgp_large_community then bgp_local_pref = 150;
}
if (OWNAS, 3, 10) ~ bgp_large_community then bgp_local_pref = bgp_local_pref - 1;
bgp_local_pref = bgp_local_pref - bgp_path.len * 15;