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.
Updated
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.
MikroTik (RouterOS 7.23+)
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
FRR
1. Full config (frr.conf)
! frr.conf frr defaults traditional hostname bgpcast-router ! ip nht resolve-via-default ! route-map bgpcast-in permit 10 set ip next-hop <next-hop> ! route-map bgpcast-out deny 10 ! router bgp <your-asn> neighbor <bgpcast-ip> remote-as <bgpcast-asn> neighbor <bgpcast-ip> ebgp-multihop 255 address-family ipv4 unicast neighbor <bgpcast-ip> activate neighbor <bgpcast-ip> route-map bgpcast-in in neighbor <bgpcast-ip> route-map bgpcast-out out neighbor <bgpcast-ip> soft-reconfiguration inbound exit-address-family !
2. Verify the session is established
vtysh -c 'show bgp summary'
BIRD 2
1. Full config (bird.conf)
# bird.conf log syslog all; router id <router-id>; protocol device {} protocol kernel { ipv4 { export all; }; # install learned routes into the kernel FIB } protocol bgp bgpcast { local as <your-asn>; neighbor <bgpcast-ip> as <bgpcast-asn>; multihop 255; ipv4 { import filter { gw = <next-hop>; accept; }; export none; }; }
2. Verify the session is established
birdc show protocols all bgpcast
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.
Keenetic (Entware)
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; }; }
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 parametersOpenWrt
1. Install the package and enable the service
opkg install --force-architecture ./bgpcast-agent_<version>-1_<arch>_openwrt.ipk /etc/init.d/bgpcast-agent enable /etc/init.d/bgpcast-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; }; }
Architectures: aarch64, arm, mipsel, mips. 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 parametersMikroTik (container)
1. Set the environment variables
/container/envs/add list=ENV_BGPCAST key=BGPCAST_API_URL value="https://bgpcast.cc"
/container/envs/add list=ENV_BGPCAST key=BGPCAST_AGENT_TOKEN value="<your-token>"
/container/envs/add list=ENV_BGPCAST key=BGPCAST_AGENT_BGP_LISTEN value=":1790" 2. Add the registry and create the container
/container/config/set registry-url=https://ghcr.io tmpdir=disk1/tmp
/container/add remote-image=samfili/bgpcast-agent:latest \
interface=veth-bgpcast root-dir=disk1/bgpcast envlist=ENV_BGPCAST name=bgpcast
/container/start bgpcast 3.1. Filter rules (next-hop + discard)
/routing filter rule
add chain=bgp_in comment="Nexthop" disabled=no rule="set gw <next-hop>; accept;"
add chain=discard disabled=no rule="reject;" 3.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.3. BGP connection to the agent
/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=no \ local.address=<bridge-address> .role=ebgp multihop=yes name=bgpcast-agent output.filter-chain=discard .network=bgp-networks .no-client-to-client-reflection=yes \ remote.address=<container-address> .port=1790 .as=<agent-asn> routing-table=main templates=bgpcast vrf=main
RouterOS v7: the container package, a disk, and veth/bridge.
Sign in to get your token and parameters