netmonitorbynetlink

The compilation is straightforward, nothing additional:

 gcc netmonitor.c -o netmon

And run:

./netmon

Now you can try to play with your network interfaces – unplug and plug back of the Ethernet cable, reconnect WiFi, and so on.

You will get something like this:

result: