FRR Learning Day 4 - Routing Aggregation

Today, learn how to use frr to build a bgp network environment. Practice the following functions:

  1. Two frr routers establish neighborhood relationship
  2. Routing aggregation
  3. Realizing the Interworking of Two Networks through Dynamic Routing

Experimental Topology

Configure Host

Host 1

#bgp configuration
router bgp 7675
 bgp router-id 192.168.59.128
 neighbor 192.168.59.129 remote-as 7676
 !
!
#Configure a host
sudo ip netns add ns1 
sudo ip link add veth1 type veth peer name eth0 netns ns1
sudo ip netns exec ns1 ip link set eth0 up
sudo ip netns exec ns1 ip link set lo up
sudo ip netns exec ns1 ip addr add 2.2.2.2/24 dev eth0
sudo ip netns exec ns1 ip route add default via 2.2.2.254 dev eth0
sudo ip link set veth1 up
sudo ip link add br1 type bridge
sudo ip link set br1 up
sudo ip link set veth1 master br1
sudo ip addr add 2.2.2.254/24 dev br1
#Turn on the forwarding switch
ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# echo 1 > /proc/sys/net/ipv4/ip_forward

#Adding routing to several other segments
ubuntu@ubuntu:~$ sudo ip route add 2.2.3.0/24 via 192.168.59.129 dev ens34    
ubuntu@ubuntu:~$ sudo ip route add 2.2.4.0/24 via 192.168.59.129 dev ens34 
ubuntu@ubuntu:~$ sudo ip route add 2.2.5.0/24 via 192.168.59.129 dev ens34 
ubuntu@ubuntu:~$ sudo ip route add 2.2.6.0/24 via 192.168.59.129 dev ens34 

Host 2

#bgp configuration
router bgp 7676
 bgp router-id 192.168.59.129
 neighbor 192.168.59.128 remote-as 7675
 !
!
#Configure a host
sudo ip netns add ns1 
sudo ip link add veth1 type veth peer name eth0 netns ns1
sudo ip netns exec ns1 ip link set eth0 up
sudo ip netns exec ns1 ip link set lo up
sudo ip netns exec ns1 ip addr add 3.3.3.3/24 dev eth0
sudo ip netns exec ns1 ip route add default via 3.3.3.254 dev eth0
sudo ip link set veth1 up
sudo ip link add br1 type bridge
sudo ip link set br1 up
sudo ip link set veth1 master br1
sudo ip addr add 3.3.3.254/24 dev br1
#Turn on the forwarding switch
ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# echo 1 > /proc/sys/net/ipv4/ip_forward

Aggregation carries the summary-only option, which only declares aggregate addresses, not more specific addresses.

Host 1: Publishing through Configuration Aggregation

ubuntu(config-router)# aggregate-address 2.2.0.0/16 summary-only
ubuntu(config-router)# network 2.2.3.0/24

Host 2

ubuntu(config-router)# network 3.3.3.0/24

View configuration results

Host 1

ubuntu# show ip bgp
BGP table version is 25, local router ID is 192.168.59.128, vrf id 0
Default local pref 100, local AS 7675
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.0.0/16       0.0.0.0                            32768 i
s> 2.2.3.0/24       0.0.0.0                  0         32768 i
*> 3.3.3.0/24       192.168.59.129           0             0 7676 i

Displayed  3 routes and 3 total paths
ubuntu# 
#You can see the letter s in front of 2.2.3.0/24, which indicates that more specific routing is suppressed.

Host 2

ubuntu# show ip bgp 
BGP table version is 24, local router ID is 192.168.59.129, vrf id 0
Default local pref 100, local AS 7676
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.0.0/16       192.168.59.128                         0 7675 i
*> 3.3.3.0/24       0.0.0.0                  0         32768 i

Displayed  2 routes and 2 total paths
ubuntu# 
#Aggregate routing that receives only peers

As you can see from the above, the summary-only option, which only declares aggregate addresses, does not declare more specific addresses. Specific routing will be suppressed, labeled s >.

test

Host 1

ubuntu@ubuntu:~$ sudo ip netns exec ns1 ping 3.3.3.3 -c 2
PING 3.3.3.3 (3.3.3.3) 56(84) bytes of data.
64 bytes from 3.3.3.3: icmp_seq=1 ttl=62 time=0.372 ms
64 bytes from 3.3.3.3: icmp_seq=2 ttl=62 time=0.339 ms

--- 3.3.3.3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 32ms
rtt min/avg/max/mdev = 0.339/0.355/0.372/0.025 ms
ubuntu@ubuntu:~$ 

Host 2

ubuntu@ubuntu:~$ sudo ip netns exec ns1 ping 2.2.2.2 -c 2
PING 2.2.2.2 (2.2.2.2) 56(84) bytes of data.
64 bytes from 2.2.2.2: icmp_seq=1 ttl=62 time=0.564 ms
64 bytes from 2.2.2.2: icmp_seq=2 ttl=62 time=0.359 ms

--- 2.2.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 0.359/0.461/0.564/0.104 ms
ubuntu@ubuntu:~$ 

Tags: C++ sudo Ubuntu network

Posted on Wed, 31 Jul 2019 09:14:00 -0700 by ypkumar