Routing Algorithm of Kawaii Networks
We use bgpq4 to generate as-sets and prefix lists. The databases we adopt include:
RPKI,AFRINIC,ARIN,APNIC,LACNIC,RIPE,RADB,ALTDB
Term Definitions:
- Accept: Accept the route, it will not participate in further filtering.
- Reject: Reject the route, it will not participate in further filtering.
- Match: Match the route, it continues to participate in filtering.
For every BGP session, we generate a corresponding receive filter and a send filter. Router configurations are generated via GitHub Actions daily at 10:00 and 22:00, and applied at 12:00 and 00:00. The specific algorithms are as follows:
Receiving Routes
IBGP
- Accept all additionally allowed prefixes.
- Accept all prefixes belonging to our own AS, accepting up to /32 (IPv4) and /128 (IPv6).
- Reject all routes with prefix lengths between 0-7, 25-32 (IPv4), and 0-15, 49-128 (IPv6). Reject all routes whose as-path contains Bogon ASNs. Reject all Bogon IPv4 and Bogon IPv6 prefixes.
- Reject all RPKI Invalid routes.
Route Attributes:
- Set local-preference to 90 for all accepted routes.
TIP
There is currently no settled conclusion regarding IBGP local-preference. It should relate to the send mode.
EBGP
Upstream
- Reject all routes with prefix lengths between 0-7, 25-32 (IPv4), and 0-15, 49-128 (IPv6). Reject all routes whose as-path contains Bogon ASNs. Reject all Bogon IPv4 and Bogon IPv6 prefixes.
- Reject all RPKI Invalid routes.
Route Attributes:
- Set local-preference to 100 for all accepted routes.
IX Route Server
If the IX has not set an IRR as-set on PeeringDB, it is treated as an Upstream. If the IX has set an IRR as-set on PeeringDB, it is treated as a Peer.
Route Attributes:
- Set local-preference to 130 for all accepted routes.
TIP
Currently, all IX Route Servers are treated as Upstreams.
Peer
- For a network establishing a connection with us, we first look up its IRR as-set, IPv4 Prefixes, and IPv6 Prefixes using its ASN on PeeringDB. If the IRR as-set is empty, we use its ASN as the AS-SET (e.g., AS23333). If IPv4 Prefixes or IPv6 Prefixes is empty (0), we close the session.
- Reject all routes with prefix lengths between 0-7, 25-32 (IPv4), and 0-15, 49-128 (IPv6). Reject all routes whose as-path contains Bogon ASNs. Reject all Bogon IPv4 and Bogon IPv6 prefixes.
- Reject all RPKI Invalid routes.
- Reject all routes whose as-path does not conform to the network's AS-SET. The as-path should resemble a pyramid, where adjacent ASes from left to right share a direct Upstream - Downstream relationship.
- Reject all routes not in the prefix list.
Route Attributes:
- Set local-preference to 160 for all accepted routes.
TIP
Currently, we only reject routes whose as-path does not conform to: leftmost is Peer AS, rightmost is its Cone AS.
Currently, if the AS Cone is too large (causing the AS-SET and prefix list to be excessively large), we only reject routes whose as-path does not conform to the leftmost being the Peer AS, and we do not apply restrictions based on the prefix list.
Downstream
Treated as Peer.
Route Attributes:
- Set local-preference to 200 for all accepted routes.
Sending Routes
IBGP
TIP
There is currently no settled conclusion on how IBGP should send routes.
Mode 1
- Accept all additionally allowed prefixes.
- Accept all prefixes belonging to our own AS, accepting up to /32 (IPv4) and /128 (IPv6).
Mode 2
- Match all static and connected route types.
- Match all other routes.
- Accept all additionally allowed prefixes.
- Accept all prefixes belonging to our own AS, accepting up to /32 (IPv4) and /128 (IPv6).
- Reject all routes with prefix lengths between 0-7, 25-32 (IPv4), and 0-15, 49-128 (IPv6). Reject all routes whose as-path contains Bogon ASNs. Reject all Bogon IPv4 and Bogon IPv6 prefixes.
- Reject all RPKI Invalid routes.
EBGP
Upstream
- Match all static and connected route types. Accept all prefixes belonging to our own AS, accepting up to /24 (IPv4) and /48 (IPv6).
- Reject routes received from IBGP.
- Accept all routes originating from Downstreams. (Thus only local Downstreams are sent to upstream providers)
IX Route Server
Treated as Upstream.
Peer
- Match all static and connected route types.
- Match all routes originating from our own AS. (e.g., obtained from IBGP)
- Accept all prefixes belonging to our own AS, accepting up to /24 (IPv4) and /48 (IPv6).
- Match and accept all routes originating from Downstreams.
Downstream
- Match all static and connected route types.
- Match all routes originating from our own AS. (e.g., obtained from IBGP)
- Accept all prefixes belonging to our own AS, accepting up to /24 (IPv4) and /48 (IPv6).
- Match and accept all routes originating from Downstreams.
- Match and accept all routes originating from Peers.
- Match and accept all routes originating from IX Route Servers.
- Match and accept all routes originating from Upstreams.
- Match and accept all routes originating from IBGP.