Networking

You sometimes want to check if a program that you've installed is doing anything funky. While you could install a full-blown packet analyser like WIreshark, sometimes, that is overkill. A quicker and handier option would be to just rely on good old netstat. Like so:

netstat -bn 10

as well as

netstat -bf 10

-b: displays the program name (executable)

-n: displays the IP address

-f: displays the resolved form of the IP address

10: indicates that the command should be repeated after 10 seconds

So I have a couple of routers connected to my network each linking to a different ISP. When an ISP goes down, I want to easily switch ISPs from the command line and these are the couple of lines I use to do so:


#!/bin/bash

sudo ip route del default

if [ $1 == 'isp1' ]
then
echo "Switching ISP to $1"
sudo ip route add default via 192.168.1.1
else
echo "Switch ISP to ISP2"
sudo ip route add default via 192.168.0.1
fi

One of my laptops which is running on Kubuntu Lucid decided to stop connecting to my network today. I found that the KDE network-manager applet (or is it a plasmoid? :S) had decided to disable itself. Clicking it stated so with no option to re-enable it (nice UI, boys). Getting to the commandline and starting the network-manager service did not help. I also found that accessing the System settings networking configuration gave me corrupt XML file errors.

All times are UTC. All content licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.