Posts tagged english
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
-n, –numeric-sort compare according to string numerical value
-t, –field-separator=SEP use SEP instead of non-blank to blank transition
-k, –key=POS1[,POS2] start a key at POS1 (origin 1), end it at POS2
If you like a well written explanation of this, I invite you to read this article by Paul Heinlein.
Partially taken from http://www.tomax7.com/mcse/neteworking2005.htm
Internet Protocol and the Transmission Control Protocol.
IP address is a 32-bit logical number to address a network device. IP are normally represented by decimal numbers, but could be useful sometimes to represent them in binary.
172. 19. 88. 73
An IP address is divided in 4 parts (each 8 bits), these parts are called octets. In the IPV4 there are 5 address classes:
Class A from 1 to 126, in binary the octet start with 0xxx
127 Reserved for loopback, 01111111
Class B from 128 to 191, in binary the octet start with 10xx
Class C from 192 to 223, in binary the octet start with 110x
Class D from 224 to 239, in binary the octet start with 1110 Don’t use. Reserved for the future.
Class E from 240 to 254, in binary the octet start with 1111
IANA reserved 4 address ranges to be used in private networks, these addresses won’t appear on the Internet avoiding IP address conflicts.
10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 that means:
– 10.0.0.0 through 10.255.255.255
– 172.16.0.0 through 172.31.255.255
– 192.168.0.0 through 192.168.255.255
– 169.254.0.1 through 169.254.255.254 (reserved for Automatic Private IP Addressing)
The meaning of 8,12 and 16 is
8 = 255.0.0.0
12 = 255.240.0.0
16 = 255.255.0.0
These are subnet mask.
A subnet mask is used to determine which part is the network (n) part and which is the host (H) part.
Default subnet masks:
Class A 255.0.0.0 that is nnnnnnnn.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class B 255.255.0.0 that is nnnnnnnn.nnnnnnnn.HHHHHHHH.HHHHHHHH
Class C 255.255.255.0 that is nnnnnnnn.nnnnnnnn.nnnnnnnn.HHHHHHHH
Bitwise (logical AND) between IP address and subnet mask to have the IP of the network
To calculate how many subnet in a net mask I can have use the formula (2^n) -2 where n is the number of bits in either field. For example the subnet 255.255.240.0 (11111111.11111111.11110000.00000000 could have (2^4) – 2 = 14 subnets.