Less usage of deprecated net-tools. Use iproute2 instead.

And some refactoring.