Hands-on tutorial
Tutorials · Routing & Internet
BGP Basics: Connecting to Two Internet Providers With Your Own IP Addresses
Understand when you need BGP, what you need from the registry and the ISPs, and how to announce your prefix, receive routes and filter safely on two providers.
Before you start
- Your own public IPv4 and/or IPv6 prefix and an AS number (from your regional internet registry or an ISP)
- Two ISPs that offer BGP sessions
- A router or firewall that supports BGP with prefix filtering
Step by step
Decide whether you need BGP
BGP makes sense when public services must stay reachable at the same addresses through either ISP. For outbound internet only, dual-WAN failover is simpler.
Get the resources
Obtain an AS number and a prefix (a /24 IPv4 or a /48 IPv6 is the smallest normally accepted). Create route objects and RPKI ROAs so ISPs accept your announcement.
Agree the sessions with each ISP
Each ISP gives you a peer address, its AS number and what it will send: default route only, or full routes. A default route from each is enough for most organisations.
Configure the sessions
Configure each neighbour, announce only your own prefix, and accept only what you expect.
router bgp 64512 neighbor 198.51.100.1 remote-as 65010 neighbor 203.0.113.1 remote-as 65020 network 192.0.2.0/24
Filter both directions
Outbound: allow only your prefix, or you may leak other routes to the internet. Inbound: accept only the default route or the routes you expect, and set a maximum-prefix limit.
Choose primary and backup
Prefer one ISP outbound with local preference, and make the other less attractive inbound by AS-path prepending.
Test failover
Shut each session in a maintenance window and confirm that your prefix is still reachable from outside, using public looking-glass tools.
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Use MD5 or TCP-AO session passwords and GTSM where the ISP supports them.
- Document the ISP contacts and circuit IDs next to the configuration.
- Never redistribute your internal routing protocol into BGP.
FAQ
Frequently asked questions
Can I do BGP with a private AS number?
With a single ISP, often yes. With two ISPs and your own prefix, you normally need a public AS number.
Do I need full internet routes?
Rarely. Full tables need a router with plenty of memory; a default route from each ISP gives failover for most businesses.
Keep learning
Related guides
OSPF basics on a Layer 3 switch
Read more →Dual-WAN and 4G failover
Read more →Policy-based routing
Read more →How to Set Up Dual-WAN Failover With a 4G LTE Backup
Keep a branch online when the fibre fails: add a 4G LTE link as a backup WAN with health checks and automatic failover.
Read more →How to Plan IP Addressing and Subnets for a Business Network
A clean IP plan makes networks easier to secure, troubleshoot and grow. Learn a simple scheme you can reuse on every site.
Read more →How to Configure DHCP Scopes, Reservations and Options
Hand out addresses reliably: one scope per VLAN, reservations for printers and cameras, the right DNS and gateway options and sensible lease times.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.