Salta al contenuto
Note per Studenti RIP and Advanced Routing in Katharà Report

RIP and Advanced Routing in Katharà

In questa pagina 10

See also: Internet Routing Protocols - RIP, OSPF and BGPInternet routing is hierarchical for scalability and administrative autonomy: each ISP is an autonomous system (AS) and uses an interior protocol inside it, either RIP (distance vector, hop count with maximum 15, updates about every 30 s, over UDP port 520) or OSPF (link state with Dijkstra, areas attached to backbone area 0, five LSA types, carried directly in IP), while BGP4 (path vector over TCP port 179, eBGP between ASes and iBGP inside) connects ASes with policy-based route choice and loop avoidance by discarding paths that contain the own AS.Internet Routing Protocols - RIP, OSPF and BGP →, Routing Algorithms - Link State and Distance VectorRouting finds least-cost paths in a weighted graph where routers are nodes and networks between routers are edges. Link state floods each router's local links (LSPs) so every router knows the whole graph and runs Dijkstra; distance vector has each router exchange its distance vector with neighbours only and update it with Bellman-Ford, D(A,w)=min(D(A,w), D(A,Y)+d(Y,w)), which converges in at most n-1 rounds but suffers from count to infinity (limited infinity of 16, hold down, triggered updates, split horizon, poison reverse); path vector announces whole paths, chooses by policy and detects loops by finding itself in the path.Routing Algorithms - Link State and Distance Vector →, Subnetting, VLSM and SupernettingSubnetting splits an address block into smaller subnets by lengthening the mask (2^s subnets when s bits are borrowed), supernetting does the opposite by shortening the prefix to merge contiguous blocks; design rules for variable-size subnets are power-of-two sizes M with M at least hosts plus 2, prefix 32 minus log2 M, and start addresses divisible by M (largest subnet first), while 2^j blocks of prefix n aggregate into one block of prefix n minus j only if contiguous and aligned.Subnetting, VLSM and Supernetting →.

This note continues Static Routing and Diagnostic Tools in KatharàLab 2 builds by hand the routing tables of two LANs (195.11.14.0/24 and 200.1.1.0/24) joined by routers r1 and r2 over 100.0.0.8/30: an active interface adds only its directly connected network, hosts use a default route, routers need static routes in both directions, and ping, route -n, tcpdump and traceroute diagnose the result (ttl=62 after two routers).Static Routing and Diagnostic Tools in Katharà → on bigger networks (Lab 3, static) and with a routing protocol (Lab 5, RIP).

Part 1: advanced static routing (Lab 3)

Goal. Every device must be able to ping every interface of every other device. Hosts may use a default route; routers may use only static routes (default forbidden).

Topology

                          pc1  96.96.0.1/24
                           |   network A = 96.96.0.0/24
                       eth2 .254
                          [r1]
            eth1 30.0.0.2 /   \ eth0 10.0.0.1
        network X = 30.0.0.0/30   network Y = 10.0.0.0/30
            eth0 30.0.0.1 /     \ eth1 10.0.0.2
                       [r3]----[r2]
              eth1 20.0.0.2   eth0 20.0.0.1        network Z = 20.0.0.0/30
   pc2 -- eth2 (network B)          eth2 (network C) -- pc3
   192.192.192.1/20              128.128.0.1/20
device eth0 eth1 eth2
r1 10.0.0.1/30 (Y) 30.0.0.2/30 (X) 96.96.0.254/24 (A)
r2 20.0.0.1/30 (Z) 10.0.0.2/30 (Y) 128.128.15.254/20 (C)
r3 30.0.0.1/30 (X) 20.0.0.2/30 (Z) 192.192.207.254/20 (B)
pc1 96.96.0.1/24 (A)
pc2 192.192.192.1/20 (B)
pc3 128.128.0.1/20 (C)
network prefix mask broadcast usable hosts
A 96.96.0.0/24 255.255.255.0 96.96.0.255 .1 - .254
B 192.192.192.0/20 255.255.240.0 192.192.207.255 192.192.192.1 - 192.192.207.254
C 128.128.0.0/20 255.255.240.0 128.128.15.255 128.128.0.1 - 128.128.15.254
X, Y, Z 30.0.0.0/30, 10.0.0.0/30, 20.0.0.0/30 255.255.255.252 .3 2 addresses

Mask and broadcast of a /20. 2020 network bits: the first two octets plus 44 bits of the third, so the third mask octet is 111100002=24011110000_2=240 and there are 1212 host bits: 212=40962^{12}=4096 addresses, 40944094 hosts. For B the third octet 192=110000002192=11000000_2 varies from 192192 to 110011112=20711001111_2=207; for C it varies from 00 to 1515. With a wrong /24, 128.128.0.1 and the router 128.128.15.254 would be in different networks.

Exercise 1: creating machines and addresses

bash
kathara vstart -n pc1 --eth 0:A                # pc1 with eth0 on domain A
kathara vstart -n r1 --eth 0:Y 1:X 2:A         # r1: eth0 on Y, eth1 on X, eth2 on A

r2: 0:Z 1:Y 2:C; r3: 0:X 1:Z 2:B; pc2 0:B; pc3 0:C. As a complete lab write lab.conf (r1[0]=Y, r1[1]=X, r1[2]=A, ...) and one .startup per machine.

bash
# pc1
ifconfig eth0 96.96.0.1 netmask 255.255.255.0 broadcast 96.96.0.255 up
# r1
ifconfig eth0 10.0.0.1 netmask 255.255.255.252 broadcast 10.0.0.3 up      # link Y
ifconfig eth1 30.0.0.2 netmask 255.255.255.252 broadcast 30.0.0.3 up      # link X
ifconfig eth2 96.96.0.254 netmask 255.255.255.0 broadcast 96.96.0.255 up  # LAN A
# others
ifconfig eth0 192.192.192.1/20 up       # pc2
ifconfig eth0 128.128.0.1/20 up         # pc3
ifconfig eth2 128.128.15.254/20 up      # r2 (LAN C)
ifconfig eth2 192.192.207.254/20 up     # r3 (LAN B)

Exercise 2: routing tables

Hosts: one default route to the router of their LAN.

bash
pc1: route add default gw 96.96.0.254          # r1.eth2
pc2: route add default gw 192.192.207.254      # r3.eth2
pc3: route add default gw 128.128.15.254       # r2.eth2

Routers: each has three far networks and needs one route for each.

router far network next hop interface
r1 Z = 20.0.0.0/30 10.0.0.2 (r2) eth0
r1 C = 128.128.0.0/20 10.0.0.2 (r2) eth0
r1 B = 192.192.192.0/20 30.0.0.1 (r3) eth1
r2 X = 30.0.0.0/30 10.0.0.1 (r1) eth1
r2 A = 96.96.0.0/24 10.0.0.1 (r1) eth1
r2 B = 192.192.192.0/20 20.0.0.2 (r3) eth0
r3 Y = 10.0.0.0/30 30.0.0.2 (r1) eth0
r3 A = 96.96.0.0/24 30.0.0.2 (r1) eth0
r3 C = 128.128.0.0/20 20.0.0.1 (r2) eth1
bash
# r1
route add -net 20.0.0.0/30 gw 10.0.0.2 dev eth0
route add -net 128.128.0.0/20 gw 10.0.0.2 dev eth0
route add -net 192.192.192.0/20 gw 30.0.0.1 dev eth1
# r2
route add -net 30.0.0.0/30 gw 10.0.0.1 dev eth1
route add -net 96.96.0.0/24 gw 10.0.0.1 dev eth1
route add -net 192.192.192.0/20 gw 20.0.0.2 dev eth0
# r3
route add -net 10.0.0.0/30 gw 30.0.0.2 dev eth0
route add -net 96.96.0.0/24 gw 30.0.0.2 dev eth0
route add -net 128.128.0.0/20 gw 20.0.0.1 dev eth1

Why correct: each next hop is in a directly connected network; for the /30/30 networks X, Y, Z the two paths are equivalent (one hop); far LANs are reached by the shortest path (one intermediate router). All 60 pings required have a forward and return path: there are 3⋅1+3⋅3=123\cdot1+3\cdot3=12 interfaces; each PC contacts 1111 others (3⋅11=333\cdot11=33), each router 99 (3⋅9=273\cdot9=27), total 6060.

Example. r1 receives from pc1 a packet for 128.128.0.1: 128.128.0.1 AND 255.255.240.0 == 128.128.0.0 matches the route 128.128.0.0/20, next hop 10.0.0.2 (r2). With several matches, the longest prefix wins. Between PCs ttl =64−2=62=64-2=62.

Trying all pings (show_pings.sh in /shared):

bash
#!/usr/bin/env bash
pcins="pc1 pc2 pc3 r1e0 r1e1 r1e2 r2e0 r2e1 r2e2 r3e0 r3e1 r3e2"
for pcin in ${pcins}
do
    if [[ "${pcin}" != *"${HOSTNAME}"* ]]            # skip itself
    then
        ping_status=`ping -w 1 -c 1 ${pcin} | grep ", 0%" > /dev/null 2>&1`
        if [ $? -eq "0" ]
        then echo "ping from ${HOSTNAME} to ${pcin}: OK"
        else echo "ping from ${HOSTNAME} to ${pcin}: Fails"
        fi
    fi
done

-c 1 sends one packet, -w 1 waits at most one second, grep ", 0%" looks for "0% packet loss". Names such as r1e0 (10.0.0.1) are defined in an /etc/hosts copied from /shared. COLLECT_RESULTS.sh runs the check on all six machines with kathara exec and computes the success percentage (100%100\%).

Exercise 3: what if defaults were allowed?

Defaults shorten the tables but can lengthen paths and, in a ring, create endless loops. With one default per router in a circle (r1 →\to r2 →\to r3 →\to r1): pc3 →\to pc1 crosses three routers instead of two; a packet for a non-existing address circulates until the TTL reaches 00 and ICMP time exceeded stops it. Compromise: one default plus specific routes where the default is not shortest: r1 default to r2 and a route for B to r3; r2 default to r1 and a route for B to r3; r3 default to r1 and a route for C to r2.

Exercise 4: traceroute

bash
root@pc1:~$ traceroute 128.128.0.1
 1  96.96.0.254   ...     # r1
 2  10.0.0.2      ...     # r2
 3  128.128.0.1   ...     # pc3
  1. traceroute sends datagrams with TTL = 1, then 2, 3, ... (three probes per value), usually UDP to high ports;
  2. TTL 1 reaches r1, which decrements it to 00, discards it and answers pc1 with an ICMP time exceeded (type 11) whose source is the router's address;
  3. TTL 2 is forwarded by the first router and zeroed by the second, and so on;
  4. at the destination there is no time exceeded: the host answers ICMP destination unreachable - port unreachable and traceroute stops.

In Wireshark: source and destination unchanged; TTL increasing by one per group of probes; protocol UDP (17) in probes and ICMP (1) in replies; changing identification. Routers do not know the full path: each applies its own table and passes the datagram to the next hop.

Part 2: RIP with FRRouting (Lab 5)

Routers no longer have hand-written tables: they build them by themselves. A router has several network cards and forwards packets not meant for it, using the routing table (destination, mask, next hop, interface); routing protocols update it automatically. In Katharà a router is a machine running the software implementing these protocols.

FRRouting

Definition. FRRouting (FRR) is a free suite of routing protocols for Linux: RIP (v1 and v2), OSPF (v2 and v3), IS-IS, BGP and others, derived from Quagga, itself derived from Zebra.

It is made of daemons: zebra manages the kernel routing table and talks to the others; ripd, ospfd, bgpd implement single protocols and exchange updates with neighbours. In Katharà use the image kathara/frr, either as default (kathara settings) or in lab.conf with r1[image]="kathara/frr".

/etc/frr/daemons says which daemons to start:

zebra=yes       # base daemon, always on
bgpd=no
ospfd=no
ripd=yes        # starts the RIP daemon
ripngd=no       # RIP for IPv6, off

/etc/frr/vtysh.conf contains service integrated-vtysh-config (single configuration file frr.conf for all daemons, recommended). /etc/frr/frr.conf lists configuration commands, for example:

router rip                   # enter the RIP configuration
network 100.1.0.0/16         # RIP works on interfaces with an address in this prefix
log file /var/log/frr/frr.log

FRR configuration is operative: the file is a list of commands bringing the router to the wanted state; to remove a command repeat it preceded by no. Files in r1/etc/frr/ are copied into the router at boot; to start FRR put systemctl start frr in the .startup file.

The vtysh shell is a single shell for all daemons, without password:

bash
root@r1:~$ vtysh
r1# ?
command effect
enable / disable enter / leave privileged mode
configure enter configuration
show ip route FRR routing table
show ip rip RIP table
show running-config current configuration
write save the configuration
ping send echo
no <command> undo a command
exit / quit leave the current mode

show ip route codes: K kernel, C connected, S static, R RIP, O OSPF, B BGP; > selected route, * installed in the kernel (FIB).

ip commands replace ifconfig and route:

ifconfig / route ip
ifconfig eth0 10.0.0.1/24 up ip address add 10.0.0.1/24 dev eth0 and ip link set eth0 up
route -n ip route
route add -net 10.1.0.0/16 gw 10.0.0.2 ip route add 10.1.0.0/16 via 10.0.0.2
route add default gw 10.0.0.2 ip route add default via 10.0.0.2

RIPv2 basics

router rip enables the protocol; network <prefix> activates RIP on interfaces with an address in the prefix (sending and receiving updates); redistribute connected announces all connected networks, even on interfaces where RIP is not active. RIP is distance vector; messages are UDP port 520 to the multicast 224.0.0.9 with ttl 1.

Formula (RIP metric). The metric is the number of routers crossed to reach the network: 11 for connected networks, plus 11 at each router forwarding the advertisement; 1616 means unreachable. The administrative distance of RIP is 120120.

Experience 1: three routers in a row (kathara-lab_frr)

 A = 100.0.0.0/24          B = 150.0.0.0/30         C = 200.0.0.0/30          D = 220.0.0.0/24
 (r1.eth0 .1) --- [r1] eth1 .1 ---- .2 eth0 [r2] eth1 .1 ---- .2 eth0 [r3] eth1 .1 --- (network D)
router interface domain address
r1 eth0 / eth1 A / B 100.0.0.1/24, 150.0.0.1/30
r2 eth0 / eth1 B / C 150.0.0.2/30, 200.0.0.1/30
r3 eth0 / eth1 C / D 200.0.0.2/30, 220.0.0.1/24
bash
ip address add 100.0.0.1/24 dev eth0     # r1
ip address add 150.0.0.1/30 dev eth1
systemctl start frr                      # starts zebra and RIP

frr.conf of r1: router rip, redistribute connected, network 150.0.0.0/8 (/8 covers all 150.x.x.x: 150.0.0.1 AND 255.0.0.0 == 150.0.0.0). r2: network 150.0.0.0/8 and network 200.0.0.0/8. r3: network 200.0.0.0/8. redistribute connected brings in 100.0.0.0/24 and 220.0.0.0/24, which are on interfaces without RIP neighbours.

After kathara lstart, within about a minute, show ip route on r3:

R>* 100.0.0.0/24 [120/3] via 200.0.0.1, eth0
R>* 150.0.0.0/30 [120/2] via 200.0.0.1, eth0
C>* 200.0.0.0/30 is directly connected, eth0
C>* 220.0.0.0/24 is directly connected, eth1

[120/3] is [administrative distance / metric]. Why 33: 100.0.0.0/24 is connected to r1 (metric 11), r2 receives it with 22, r3 with 33; 150.0.0.0/30 is 11 on r2 and 22 on r3. RIP computes the shortest path (number of hops) in a distributed way with Bellman-Ford.

Experience 2: five-router stub network (kathara-lab_rip)

An internal network of four routers (r1-r4) with a single exit router r4 towards r5, the "Internet".

router eth0 eth1 eth2 eth3
r1 H 100.1.0.13/30 G 100.1.0.9/30 E 100.1.0.1/30 A 100.1.1.1/24
r2 E 100.1.0.2/30 F 100.1.0.5/30 B 100.1.2.1/24
r3 F 100.1.0.6/30 G 100.1.0.10/30 I 100.1.0.17/30 C 100.1.3.1/24
r4 L 100.2.0.1/30 D 100.1.4.1/24 I 100.1.0.18/30 H 100.1.0.14/30
r5 L 100.2.0.2/30

Router links: r1-r2 on E, r2-r3 on F, r1-r3 on G, r3-r4 on I, r1-r4 on H; L joins r4 and r5; A, B, C, D are leaf LANs. All routers of 100.1.0.0/16 have network 100.1.0.0/16; r4 also has redistribute connected (network 100.2.0.0/30 is outside the prefix). The lab does not start FRR by itself.

Step 1: before RIP.

bash
root@r4:~$ ping 100.1.0.13           # connected network H: works
root@r4:~$ ping 100.1.2.1            # far network B
connect: Network is unreachable

The kernel knows only the connected networks (proto kernel).

Step 2: start RIP on every router except r5: systemctl start frr. Then ping 100.1.2.1 from r4 answers with ttl=63 (one router, r1). Kernel routes learned are marked proto rip metric 20: metric 20 is the priority FRR writes in the kernel, equal for all RIP routes; the real RIP metric is read in show ip rip.

Step 3: RIPv2 packets.

bash
root@r4:~$ tcpdump -tenni eth2 -v
100.1.0.17.520 > 224.0.0.9.520:
RIPv2, Response, length: 124, routes: 6 or less
 AFI IPv4, 100.1.0.0/30, metric: 2, next-hop: self
 AFI IPv4, 100.1.0.4/30, metric: 1, next-hop: self
 ...

The sender is r3 (100.1.0.17), the destination the multicast 224.0.0.9, UDP port 520520 on both sides, ttl 1, destination MAC 01:00:5e:00:00:09. length: 124 =4+6⋅20=4+6\cdot20 (44 header bytes plus 2020 per route; at most 2525 routes per message, 504504 bytes). It is a periodic Response (normally every 3030 s) with each route's metric. The networks learned from r4 (H, D, L) and I are missing: split horizon, a router does not advertise to a neighbour the routes learned from that neighbour.

show ip rip on r4 (via vtysh): E, F, G, A, C have metric 22; B has 33; H, I, D, L are connected (11). Towards G and B there are two equal-cost paths and RIP chooses one. The Time column counts down and restarts at each advertisement; at zero (timeout 180180 s) the route disappears.

Step 4: connecting the stub network to "Internet" with static routes.

  • Incoming traffic (for 100.1.0.0/16): r5 sends it to r4. Outgoing traffic (0.0.0.0/0): r4 sends it to r5.
bash
root@r5:~$ ip route add 100.1.0.0/16 via 100.2.0.1     # one aggregated route for the whole internal network
root@r5:~$ ping 100.1.2.1                              # ttl=62
root@r4:~$ ip route add default via 100.2.0.2          # default to r5

Then inject the default route into RIP:

bash
root@r4:~$ vtysh
r4# configure
r4(config)# router rip
r4(config-router)# route 0.0.0.0/0     # announce the static default in RIP
r4(config-router)# quit
r4(config)# quit
r4# exit

After a while r1 has default via 100.1.0.14 dev eth0 proto rip metric 20 (r4 on H). From r1, ping 193.204.161.1 gives Destination Net Unreachable from 100.2.0.2: the packet reached r5, which has no route and replies with ICMP net unreachable, so the default route works.

Step 5: interface failure.

bash
root@r1:~$ traceroute 100.1.0.10            # r3 on G: one hop
root@r1:~$ ip link set eth1 down            # G goes down
root@r1:~$ traceroute 100.1.0.10
 1  100.1.0.14  1 ms 1 ms 1 ms             # default to r4
 2  * * *                                    # packets lost: tables not yet updated

After RIP converges the path is 100.1.0.14 (r4), then 100.1.0.10 (r3): two hops instead of one. This is the advantage of RIP over static routes, at the price of a convergence time with inconsistent tables.

Property (default advertisements). Without other instructions RIP advertises the connected networks of the interfaces where it is active; redistribute connected makes it advertise all. The default behaviour differs by protocol: BGP advertises nothing unless told.

Common mistakes

  • Wrong mask: B and C are /20/20; missing return route; wrong next-hop interface (10.0.0.1 on r1 instead of 10.0.0.2); a default where forbidden; testing only the pings between PCs.
  • Forgetting systemctl start frr; starting FRR also on r5 (static routes only).
  • A network prefix that does not contain the interface address: RIP does not start on it.
  • Forgetting route 0.0.0.0/0 in RIP: r4 can exit, the others cannot.
  • Confusing kernel metric 20 with the RIP metric (hops).

Versione ripasso

Lab 3: advanced static routing

  • Goal. Every device pings every interface of every other (60 pings); routers: static routes only; hosts: default allowed.
  • Topology. Links: Y 10.0.0.0/30 (r1.eth0 .1, r2.eth1 .2), X 30.0.0.0/30 (r1.eth1 .2, r3.eth0 .1), Z 20.0.0.0/30 (r2.eth0 .1, r3.eth1 .2). LANs: A 96.96.0.0/24 (pc1 .1, r1.eth2 .254), B 192.192.192.0/20 (pc2, r3.eth2 192.192.207.254), C 128.128.0.0/20 (pc3, r2.eth2 128.128.15.254). B and C are /20/20: 40944094 hosts, broadcast 192.192.207.255, 128.128.15.255.
  • Creation. kathara vstart -n r1 --eth 0:Y 1:X 2:A (r2 0:Z 1:Y 2:C, r3 0:X 1:Z 2:B); ifconfig ethN IP netmask M broadcast B up.
  • Hosts. route add default gw 96.96.0.254 (pc1), 192.192.207.254 (pc2), 128.128.15.254 (pc3).
  • Routers. One route per far network, next hop in a connected network:
bash
# r1
route add -net 20.0.0.0/30 gw 10.0.0.2 dev eth0
route add -net 128.128.0.0/20 gw 10.0.0.2 dev eth0
route add -net 192.192.192.0/20 gw 30.0.0.1 dev eth1

r2: X and A via 10.0.0.1 (eth1), B via 20.0.0.2 (eth0). r3: Y and A via 30.0.0.2 (eth0), C via 20.0.0.1 (eth1). Between PCs ttl=62.

  • 60 pings. 1212 interfaces; PCs 3⋅11=333\cdot11=33, routers 3⋅9=273\cdot9=27. show_pings.sh uses ping -w 1 -c 1 and grep ", 0%"; COLLECT_RESULTS.sh with kathara exec.
  • Defaults. Shorter tables but longer paths and loops until TTL =0=0. Compromise: a default plus specific routes (r1 default r2 + B via r3; r2 default r1 + B via r3; r3 default r1 + C via r2).
  • traceroute. TTL =1,2,3,…=1,2,3,\dots (three UDP probes each); the router zeroing the TTL replies ICMP time exceeded (type 11); the destination replies port unreachable and traceroute stops. pc1 to pc3: 96.96.0.254, 10.0.0.2, 128.128.0.1. Probes use UDP (17), replies ICMP (1).
  • Mistakes: wrong mask; missing return route; wrong next-hop interface; default where forbidden; only PC pings.

Lab 5: RIP with FRRouting

  • FRR. Daemons: zebra (kernel table), ripd, ospfd, bgpd. Image kathara/frr (kathara settings or r1[image]="kathara/frr").
  • Files. /etc/frr/daemons (zebra=yes, ripd=yes), /etc/frr/vtysh.conf (service integrated-vtysh-config), /etc/frr/frr.conf (operative commands; undo with no). Start: systemctl start frr.
  • vtysh. enable, configure, show ip route, show ip rip, show running-config, write, ping, no, exit. Codes: K kernel, C connected, S static, R RIP, O OSPF, B BGP; > selected, * in kernel.
bash
ip address add 100.0.0.1/24 dev eth0      # address
ip route add 10.1.0.0/16 via 10.0.0.2     # static route
ip route add default via 10.0.0.2         # default route
systemctl start frr                       # start zebra and enabled daemons
  • RIPv2. router rip; network <prefix> (active on interfaces in the prefix); redistribute connected (announce all connected networks). Metric = hops: connected =1=1, +1+1 per router, 1616 = unreachable; administrative distance 120120 ([120/3]). UDP port 520 to 224.0.0.9, ttl 1, every 3030 s. Split horizon: do not advertise a route back to the neighbour it came from.
  • Experience 1. A 100.0.0.0/24, B 150.0.0.0/30, C 200.0.0.0/30, D 220.0.0.0/24. r1: network 150.0.0.0/8 + redistribute connected; r2: 150.0.0.0/8, 200.0.0.0/8; r3: 200.0.0.0/8. On r3: R>* 100.0.0.0/24 [120/3] via 200.0.0.1; metric 1+1+1=31+1+1=3.
  • Experience 2 (stub). 100.1.0.0/16: links E 100.1.0.0/30 (r1-r2), F .4/30 (r2-r3), G .8/30 (r1-r3), H .12/30 (r1-r4), I .16/30 (r3-r4), L 100.2.0.0/30 (r4-r5); LANs A-D 100.1.1.0/24-100.1.4.0/24. All have network 100.1.0.0/16; r4 also redistribute connected; r5 no FRR.
    • Before RIP: ping 100.1.2.1 from r4 gives Network is unreachable (only proto kernel routes).
    • Start: systemctl start frr on r1-r4; ping 100.1.2.1 gives ttl=63; kernel routes proto rip metric 20 (priority, not the RIP metric). On r4: E, F, G, A, C =2=2; B =3=3; H, I, D, L =1=1.
    • Packets: tcpdump -tenni eth2 -v: Response from 100.1.0.17 to 224.0.0.9, length 4+6⋅20=1244+6\cdot20=124 (max 2525 routes), six routes; H, D, L, I omitted by split horizon. Timeout 180180 s.
    • Exit: r5 ip route add 100.1.0.0/16 via 100.2.0.1; r4 ip route add default via 100.2.0.2, then in vtysh: configure, router rip, route 0.0.0.0/0. r1 learns default via 100.1.0.14 proto rip. ping 193.204.161.1 gives Destination Net Unreachable from 100.2.0.2 (error from r5, default works).
    • Failure: ip link set eth1 down on r1: traffic goes to r4 with * * * until convergence; then 100.1.0.14, 100.1.0.10 (2 hops). RIP adapts by itself, with a period of inconsistency.
  • Advertisements. RIP announces the connected networks of its active interfaces; redistribute connected announces all. BGP announces nothing unless told.
  • Mistakes: forgetting systemctl start frr; FRR on r5; network prefix not containing the interface address; forgetting route 0.0.0.0/0; confusing metric 20 with the RIP metric.

Teoria collegata