### Peering relationships (RFC 9234 roles)
[RFC 9234](https://datatracker.ietf.org/doc/html/rfc9234) defines standard BGP roles so both sides of a session agree on their relationship. In BIRD, `local role` specifies *your* role in the session, not your neighbor's:
- `customer` (when connecting to a transit upstream)
- `provider` (when connecting to a downstream customer)
- `peer` (lateral peering with another network)
- `rs_client` / `rs_server` (connecting to an IXP route server)
Setting roles lets both sides negotiate their relationship and enables the RFC 9234 OTC (Only to Customer) attribute. When supported, OTC gets attached when sending routes to customers, peers, or route server clients and checked on receipt, preventing routes learned from providers, peers, or route servers from accidentally leaking upward to another transit or peer.
### Filtering different types of peers
Because each relationship has different trust boundaries, you do not use the same BGP filter for every session:
| Session type | What you import | What you export |
| --- | --- | --- |
| Transit (`local role customer`) | Full table (or default route), dropping bogons, own prefixes, RPKI/ASPA invalids | Strictly your own prefixes + downstream customers |
| IXP Route Server (`local role rs_client`) | Everything the RS sends, minus bogons, RPKI/ASPA invalids, and routes leaking Tier-1/transit-free ASNs mid-path (plus max-prefix limits) | Strictly your own prefixes + downstream customers |
| Bilateral Peer (`local role peer`) | Only prefixes matching the peer's [IRR `as-set`](#automating-irr-peer-filters-with-bgpq4) + `enforce first as` + RPKI/ASPA | Strictly your own prefixes + downstream customers |
| Downstream Customer (`local role provider`) | Strictly prefixes authorized for that customer + `enforce first as` + RPKI/ASPA | Full table (or default route) |
### Your AS-SET
Whenever you peer with someone, both sides want protection against misconfiguration. By default BGP has no safeguards: nothing stops you from claiming Google, Cloudflare, or Hurricane Electric is your downstream and announcing their routes.
To combat this, you maintain an [`as-set`](https://docs.db.ripe.net/RPSL-Object-Types/Descriptions-of-Secondary-Objects/#description-of-the-as-set-object) object in the RIPE Database, like mine ([AS219421:AS-ALL](https://apps.db.ripe.net/db-web-ui/query?searchtext=AS219421:AS-ALL)). Your `as-set` contains your own ASN plus the ASNs (or `as-set`s) of your downstream customers, never your peers or transit providers. Including your own ASN is important: if you leave it out, peers building filters from your `as-set` will filter out your own prefixes too.
## Letting others look into your network
When routing breaks somewhere on the Internet, other operators cannot SSH into your router to debug it. That is why many networks publish a network info page (like [as219421.miarecki.eu](https://as219421.miarecki.eu)) and run a Looking Glass (like [lg.as219421.miarecki.eu](https://lg.as219421.miarecki.eu)).
A Looking Glass is a public web interface that lets other operators look into your network to see your routes, paths, and peers for debugging. It is optional, though it is also very convenient for yourself since you can check all your connections and details in a browser without SSHing into the router.
There are multiple Looking Glass tools available, like [Alice-LG](https://github.com/alice-lg/alice-lg) (with `birdwatcher`) or [bird-lg-go](https://github.com/xddxdd/bird-lg-go). Comparing them, Alice-LG keeps a copy of all routes in memory and offers more features, which makes it more expensive on RAM (easily over 1.5 GB with full tables). I went with `bird-lg-go` because I had seen others use it and it stays light on memory (under 30 MB total) by querying BIRD on demand. Setting it up in full is outside the scope of this post, but it is just two Docker containers: one hosting the dashboard and one proxy collecting data from your BIRD instance.[^1]
{{< figure
src="lg.png"
alt="AS219421 bird-lg-go Looking Glass showing Established BGP protocols on the Amsterdam (lorentz) router, including bgptools, AS112, Hurricane Electric, iBGP sessions, and InterIX route servers"
caption="My bird-lg-go Looking Glass displaying active BGP sessions and protocol status directly in the browser."
>}}