Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

BGP Basics

The whole lesson is here to read. Create a free account to run it in a live lab.

Virtual machine lab7 min read5 commands

What you will do

A network is made of routers that pass packets along and hosts that send and receive them. Here r1 is the whole of one network, AS 65001, and r2 the whole of another, AS 65002. An autonomous system is one organisation's network, and BGP is how the internet's organisations tell each other what they can reach. You will look around the third networking lab, send a packet that cannot get through, and find out why. You will not fix it: that is the lab's own task.

Before you start

Note

Press Start the lab on the bar at the top of this lesson. This lab is a whole Ubuntu machine of your own, with a small network built inside it, so it takes a little longer to come up than a container. Each Run button below types its command into the machine's terminal, one after another. If one says the machine is still starting, wait a few seconds and press it again. To watch them, or to type your own, press Open terminal on the bar.

1. Meet the machines

Everything here is built inside your one Ubuntu machine: each router and each host is a separate network namespace, with its own addresses. netlab status lists them. r1 and r2 are the routers, each running the BGP program, bgpd, and priv is a private network behind r2. The names starting to- are the network cables, and the numbers are the addresses.

Command
netlab status

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

2. Talk to the router next door

The two routers are joined by one cable, so each can talk to the other. This pings r2 from r1.

Command
sudo ip netns exec r1 ping -c 2 -W 1 10.0.12.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

3. Try to cross the network

Now ask for the far host, 10.0.3.2. ping sends a small packet and waits for an answer. Nothing gets through, and the router that is next to h1 says why: Destination Net Unreachable, "I do not know a way to that network".

Command
sudo ip netns exec h1 ping -c 2 -W 1 10.0.3.2

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

4. Ask whether BGP is on

show bgp summary lists the other routers this one has a BGP session with. The program is running, but nobody has set up BGP yet, so there is not even an instance to ask.

Command
sudo vtysh -N r1 -c "show bgp summary"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

5. Ask what r1 knows

Without BGP, r1 knows only the two networks it is joined to: lines marked C, connected, and L, its own addresses. The network where h2 lives is missing, which is why step 3 failed.

Command
sudo vtysh -N r1 -c "show ip route"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Now do the lab

Tip

You have found where the packet stops and why. Making it work is the task of this lab: open README.md in your home folder with cat README.md in the terminal. It says what to do and gives none of the answers.

For teachers

Tip

This lesson is a small example of a lesson worked in a lab: the steps and the Run buttons are the lesson, and the lab is each student's own copy. This lesson is worked in a VM lab: each student has an Ubuntu machine of their own with two autonomous systems inside it. The lab's check wants the session Established and the private network not announced. Copy it into your own module and change it, or build one from scratch with the Lab menu in the lesson builder.

About this lab and its source: BGP lab: connect two autonomous systems in your browser

Teaching a class? Set these lessons for your students with marking and a lab for every student.