Skip to content
B BGPCast

Knowledge Base

How to connect your router to the BGPCast route server. Two ways: direct BGP peering (needs a public IP on your router) or the connector agent (if your router is behind NAT/CGNAT). Copy the commands and substitute your values from the app.

Direct peering (router's public IP)

For routers with a public IP. Bring up a BGP session with the route server and substitute your peer IP and ASN from the app.

1. Filter rules (next-hop to ISP + discard)
/routing filter rule
add chain=bgp_in comment="Nexthop to ISP" disabled=no rule="set gw <next-hop>; accept;"
add chain=discard disabled=no rule="reject;"
2. BGP template
/routing bgp template
add as=<your-asn> disabled=no name=bgpcast output.network=bgp-networks .no-client-to-client-reflection=yes routing-table=main
3. BGP connection
/routing bgp connection
add as=<your-asn> cisco-vpls-nlri-len-fmt=auto-bits connect=yes disabled=no hold-time=4m input.filter=bgp_in instance=bgp-instance-bgpcast keepalive-time=1m listen=yes \
    local.address=<your-ip> .role=ebgp multihop=yes name=bgpcast output.filter-chain=discard .network=bgp-networks .no-client-to-client-reflection=yes \
    remote.address=<bgpcast-ip> .as=<bgpcast-asn> routing-table=main templates=bgpcast vrf=main
4. Verify the session is established
/routing/bgp/session/print
Sign in to get your parameters

Connector agent (behind NAT)

If your router is behind NAT/CGNAT. The agent is a small daemon: it pulls your announce set from the route server over HTTPS/WSS and re-originates it as BGP locally on your router. No inbound BGP session required. The agent is published at github.com/samfili/bgpcast-agent — the container image tagged latest on GHCR (used below), and the .ipk packages under Releases.

1. Install the package and start the service
opkg install ./bgpcast-agent_<version>-1_<arch>_entware.ipk
/opt/etc/init.d/S99bgpcast-agent start
2. Open the settings page (LAN only)
http://<router-ip>:8080/
3. Fill in the fields and click "Save & apply"
API URL:      https://bgpcast.cc
Agent token:  <your-token>
4. Full BIRD2 config (bird.conf)
# bird.conf
log syslog all;
router id <router-id>;

protocol device {}

protocol kernel {
  ipv4 { export all; };
}

protocol bgp bgpcast {
  local port 1791 as <your-asn>;       # BIRD uses 1791, leaving TCP/179 for the agent
  neighbor 127.0.0.1 as <agent-asn>;   # the agent listens on 179
  ipv4 {
    import filter { gw = <next-hop>; accept; };
    export none;
  };
}
<router-id> — any 32-bit ID, e.g. the router's LAN IP; <your-asn> = "Your ASN", <agent-asn> = "Agent ASN" — from the peer card in the app; <next-hop> — your ISP gateway. local port 1791 keeps BIRD off TCP/179 so it doesn't clash with the agent, which listens on 179.

Architectures: mipsel, mips, aarch64. The settings page has two fields — "API URL" (the route server address) and "Agent token" (from the app); the page is reachable from the local network only.

Sign in to get your token and parameters

Common issues

Session not coming up (Active/Connect)
Check that <bgpcast-ip> is reachable and that outbound TCP/179 is not blocked by your firewall.
No established state, but port is open
Verify the ASN on both sides — they must match the parameters shown in the app.
Established, but 0 prefixes
Make sure you have subscribed to at least one category and that the peer is enabled in the app.
Session is flapping
A cloud peer requires multihop (TTL>1). Verify that multihop/ebgp-multihop is enabled.
Agent: session not coming up
Check the token on the :8080 LAN page and that outbound 443 (HTTPS/WSS) to bgpcast.cc is not blocked by a firewall.
Agent: BGP won't start / port 179 already in use
On Entware/OpenWrt the agent listens on TCP/179, and BIRD2 defaults to 179 too. Set `local port 1791 as <your-asn>;` in bird.conf so BIRD uses 1791 and leaves 179 for the agent.
Agent: :8080 page unreachable
The settings page is reachable only from your local network (LAN), not the internet. Open it from a device on the same network.
MikroTik: container won't start
Check that the disk (disk1) is present, the veth-bgpcast interface exists, and BGPCAST_AGENT_BGP_LISTEN is set (a high port, e.g. :1790).