Routing in IP networks

Static routing, RIPv2 and BGP across four autonomous systems on FRR routers.

Goal: understand how an IP router works; gain hands-on experience building routing tables and running interior and exterior routing protocols.

This practical work was moved from Cisco Packet Tracer to GNS3. The routers here run FRR: its command line is modelled on Cisco IOS, and the command table lists where it differs.

Background

Routers (hardware or software) choose the best path for an IP packet and send the packet along it. To decide, a router looks at the destination address and picks the path from formal records describing the structure of the internetwork. These records are called routing tables.

A routing table has at least these fields: the destination (an IP network or a host address), the port the packet leaves through towards the destination (named by its IP address or an internal number), the gateway (the IP address the packet goes to after it leaves the port), and the metric (how good the route is).

Every router in the network holds a table that fully describes the structure of the whole network and sometimes contains default routes.

Routing tables are written by hand or built by interior routing protocols that automate the process. RIP2 is one such protocol.

These protocols run inside autonomous systems. An autonomous system (AS) on the Internet is a set of IP networks and routers run by one or more operators with a single routing policy towards the Internet.

Autonomous systems exchange routing information through exterior routing protocols such as BGP. BGP (Border Gateway Protocol) is the main dynamic routing protocol of the Internet. It carries aggregated routes between networks (autonomous systems): in effect, which networks belong to which AS and how the AS connect to each other. The junction between two providers, in particular, is built with BGP.

Main commands

The router console opens straight into its command line. "Same" in the FRR column means the command is written as in Cisco IOS.

Cisco IOSFRRPurpose
enablesameenter privileged mode
configure terminalsameenter configuration mode
interface <PORT_NAME>interface eth0configure a port
ip address <IP> <MASK>ip address <IP>/<PREFIX>assign an IP address and mask
copy running-config startup-configsamesave the running configuration
exitsameleave a configuration context or configuration mode
show ip interfaceshow interfaceshow IP on the interfaces
show ip interface briefshow interface briefbrief IP summary of the interfaces
no shutdownsameenable an interface (disabled by default)
ip route <IP> <MASK> <GATEWAY>sameadd a route
no ip route <IP> <MASK> <GATEWAY>sameremove a route
show ip routesameshow the routing table
no auto-summarynot neededturn off automatic route summarisation; RIPv2 in FRR never summarises
router ripsameenable RIP
version 2sameuse RIP version 2
network <NETWORK>network <NETWORK>/<PREFIX>advertise a network to other routers (RIP)
network <NETWORK> mask <MASK>samethe same with an explicit mask (BGP)
passive-interface <PORT_NAME>samedo not send the table through an interface
default-information originatesamethe RIP router advertises itself as the default gateway
debug ip ripdebug rip eventsRIP debug messages; terminal monitor prints them to the console
hostname <HOSTNAME>sameset the host name
ping <IP>samecheck reachability over ICMP; on a router it runs until you stop it with Ctrl+C
traceroute <IP>sametrace the route
router bgp <AS>sameenable BGP on the edge router with its AS number
neighbor <IP> remote-as <AS>samepeer with the edge router at IP that serves the AS
—no bgp ebgp-requires-policyin router bgp: without it FRR exchanges no routes with peers in other AS (RFC 8212)
bgp log-neighbor-changessamelog BGP neighbour state changes
show ip bgp neighborssamepeer details
show ip bgp summarysameBGP state summary

The PCs are VPCS:

CommandPurpose
ip <IP>/<PREFIX> <GATEWAY>address, mask and gateway
savesave the settings
show ipshow the address and gateway
ping <IP>check reachability over ICMP
trace <IP>trace the route

Network

Scroll sideways to exploreOpen full diagram
Figure 1. PC1 in LAN1 connects to R1; R1 connects through LAN2 to R2; R2, R3 and R4 share LAN3 through switch SW1; PC4 in LAN4 connects to R3, PC5 in LAN5 to R4. The copy: R11–R14, SW2, PC11, PC14, PC15.
Figure 1. AS 100: R1–R4, SW1, PC1, PC4, PC5. AS 101 is its copy: R11–R14, SW2, PC11, PC14, PC15. ★ marks the edge router; its eth2–eth4 lead to the other AS (figure 2).
Scroll sideways to exploreOpen full diagram
Figure 2. R21 (AS 102) connects to R2 (AS 100) and R12 (AS 101); R2 connects to R12 and R31 (AS 103); R12 connects to R31.
Figure 2. Links between the AS. AS 102 and AS 103 each have one router (R21, R31) and one PC (PC21, PC31) on eth0.

The network is already built: nodes, cables and interfaces are in place. The routers are as if new: no addresses, every interface shut down. You configure everything else.

How to open a console

Save your settings: copy running-config startup-config on a router, save on a PC. They then survive a node restart.

1. Infrastructure

  1. The network of figure 1 is already built as AS 100. Network 3 (LAN3) is one local network in which routers R2, R3 and R4 connect through switch SW1. Networks 1, 4 and 5 each hold one PC: PC1, PC4, PC5.
  2. Equipment: switch SW1 (1), routers R1–R4 (4), PCs (3), interfaces and cables as needed.
  3. Take the subnets for all networks from 192.168.0.0/24.
  4. Assign addresses to the router interfaces and enable the interfaces. Give each PC an address and a gateway with ip <IP>/<PREFIX> <GATEWAY>, then save.
  5. Check that the nearest neighbours in each local network are reachable.

For example, one router interface:

R1

configure terminalinterface eth0 ip address <IP>/<PREFIX> no shutdownexit

2. Static routing

  1. Configure static routing in this network.
  2. Check that packets pass between all nodes of the model.
  3. Print and save the routing tables of all routers.

3. Dynamic routing

  1. A copy of your network is already built: routers R11, R12, R13, R14, switch SW2, PCs PC11 (LAN1), PC14 (LAN4), PC15 (LAN5). The router with the star is R12.
  2. Take the subnets for all networks from 192.168.1.0/24.
  3. Check that the nearest neighbours in each local network are reachable.
  4. Configure RIP2 on all routers so that:
    • routes are not summarised;
    • tables are sent only through interfaces connected to other routers.
  5. Turn on debug output to the router consoles.
  6. Make sure all the information needed has arrived.
  7. Check that packets pass between all nodes of the model.
  8. Print and save the routing tables of all routers.

4. Additional networks

  1. Two additional networks of one router and one PC are already built: R21 with PC21 and R31 with PC31. The PC connects to the router's eth0.
  2. Address them from 192.168.2.0/24 (R21, PC21) and 192.168.3.0/24 (R31, PC31).

5. Joining the networks

  1. The networks you built are autonomous systems. Use these AS numbers:

    NetworkASEdge router
    192.168.0.0/24100R2
    192.168.1.0/24101R12
    192.168.2.0/24102R21
    192.168.3.0/24103R31
  2. The networks are connected as in figure 2, and the interfaces needed are already added: eth2–eth4 on R2 and R12, eth1–eth2 on R21 and R31. Use separate subnets of 10.0.0.0/16 for the links.

  3. Configure the edge routers. For AS 100 and 101 it is the router marked with a star in figure 1. For the other AS it is their only router. Peer with every AS. In FRR, add no bgp ebgp-requires-policy to router bgp.

  4. Watch the routing tables to make sure the routes were updated.

  5. Inside AS 100, on the routers that are not edge routers, set the default gateway to the matching internal IP of the edge router. Use the standard address 0.0.0.0 with mask 0.0.0.0.

  6. On the edge router of AS 101, use default-information originate (in router rip) to spread the default route. The other routers of the network should pick it up by themselves.

  7. Trace the route between PCs of all AS. When tracing from AS 100 and AS 101, use one PC from LAN1 and one from LAN5.

  8. Cut the link between AS 102 and AS 100. Repeat the trace. Compare the results.

Note. A BGP router announces only the networks it has routes to. In AS 101 all IP networks belong to one large IP network. It makes sense to announce that whole network once rather than each small network separately. To do so, add a route to the whole network on the router, with interface Null0 as the gateway (for example ip route 192.168.0.0 255.255.255.0 Null0).

Cutting a link in GNS3. Shutting an interface down does not reach the far end of the cable, so cut the link at both ends: shutdown on R21 eth1 and on R2 eth2. If you shut only one side, BGP notices the break only when the hold time (180 s) runs out. After comparing, bring the link back up (no shutdown at both ends) and wait for the peering to recover: the check expects peerings with every AS.

Report

Prepare a report as DOC/DOCX or PDF. It contains a title page, the artefacts of the work and the answers to the questions and tasks.

Artefacts:

  • The commands configuring the router marked with a star, from parts 2 and 3.
  • The BGP commands on these routers from part 5.
  • The final routing tables from part 5.
  • The peer (neighbor) output from the edge router of AS 100.

show running-config prints a router's current commands.

Questions and tasks:

  • Explain the results of part 5, item 7.
  • With access to a router console, how can you tell that BGP updates are coming through?
  • What differences between configuring and running BGP and RIP did you notice during the work?

Key concepts

  • IP network
  • Route
  • Metric
  • Routing table
  • Default gateway
  • The order of route lookup in a routing table
  • RIP, how it spreads routing information
  • BGP, how it spreads routing information
  • BGP peer
  • BGP network announcement

Validation

The five validation steps match parts 1–5. No specific address is checked: only that addresses come from the right network, which protocol a route came from, and whether the PCs can ping each other. In part 5, R12 must announce AS 101 as one network, 192.168.1.0/24, through a route to Null0 (see the note). The link between AS 102 and AS 100 must be up before you check.

Click "Check". Once all steps pass, click "End".