Linux

Sort IP address

Sorting IP addresses using sort is not easy because the dot confuses sort. This line makes it possible to sort by the whole value of the address sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 ipaddresses.txt You can also sort by the last octet sort -r. -n +3.0 ipaddresses.txt

Read More
Network

Linux routing magic

Suppose you’re setting up a test environment, and you want a server to be able to handle some improbably large number of IP addresses, like a /16 or even larger. You could just write a script to add them all one at a time, or you could use this little shortcut and add the entire […]

Read More