#!/bin/bash

./cleanup.sh

# Create connection with 2 IPv4 routes and activate
ip link add dummy0 type dummy
nmcli connection add type dummy ifname dummy0 con-name dummy0 \
	ipv4.method manual \
	ipv4.routes "198.51.100.1/32 0 table=50"\
	ipv6.method disabled
nmcli connection up dummy0

echo NM routes:
nmcli -g ipv4.routes connection show dummy0
echo "System routes (connection UP):"
ip route list table all | grep dummy0

nmcli connection down dummy0

echo "System routes (connection DOWN):"
ip route list table all | grep dummy0

sleep 1

nmcli connection up dummy0
nmcli connection delete dummy0

echo "System routes (connection DELETED):"
ip route list table all | grep dummy0

sleep 1
echo "System routes (after delay):"
ip route list table all | grep dummy0

