Ip addressing
From Cloonix wiki
IP Addressing / IP routing
IP routing is a method to answer (2) questions for your computing device
1) What network(s) exist on immediately attached networks?
2) Can I go somewhere else if it's not connected to me?
IP Addressing
IP addressing describe in what networks an interface participates.
It will help to have an understanding of base(2), base(10) and base(8) math at this point.
In normal day to day language or writing, the number 10 (ten) represents / notates a particular sum of exponents in a numbering system based on the power of 10. It also permits only 10 digits be used in any number position [0123456789]
In base 10 the arithmetic expansions / representations are:
10 = 1 * (10^1) + 0 * (10^0) [ten]
19 = 1 * (10^1) + 9 * (10^0) [nineteen]
110 = 1 * (10^2) + 1 * (10^1) + 0 [ One hundred and ten ]
There is no reason that other bases couldn't be used for numbering - computers only understand bits (which are base (2)). Base (2) only permits 2 digits be used in any exponential position [01]. In base (2) a single position is sometimes called a bit (it's the smallest amount of information that can be stored.) It is either 1 or 0.
In base 2 the same arithmetic expansions are:
10 = 1 * (2^1) + 0 * (2^0) [two]
110 = 1 * ( 2^2) + 1 * (2^1) + 0 * 2^0 [six]
10011 = 1* 2^4 + 1 * (2^1) + 1* 2^0 [nineteen]
Base 8 is very similar except the numbering is [01234567]
10 = 1*8^1 = [eight]
23 = 2*8^1 + 3*8^1 [nineteen]
OK, enough of the base n numbering examples. IPv4 network addresses are 32 bits long. That means there is a potential set of number representations (in base 2) from
base 2
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
to
11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
base 10
0 to 4294967295
BC it would be incredibly difficult for human beings to remember either of those notational forms - the ip address were seperated into dotted quads (which is just a way to create (4) groups of 8 bits each)
base (2)
00000000.00000000.00000000.00000000
11111111.11111111.11111111.11111111
base 10
0.0.0.0
255.255.255.255
Hmm - this should start looking familiar if you are remember ever seeing a dotted quad in a configuration file or a web address. The ip address is simply a number which represents an interface of your computer on the network.
It should also make sense why there are no addresses like 511.511.511.511, in order to get 511, there would have to be (36 bits of addressing - and there are only (32) ) so if you ever see a quad that is > 255 - be very very suspicious in the ipv4 world.
Network Masks
There is only one more thing that is required with any ip address - and this is the netmask. The netmask is a short term for network mask. It signifies the network / host significant sections of the particular ip address. I will only describe masks in terms of quad boundaries (/8, /16, /24, /32) - but a mask can be anything from ( /2 .. /32)
So wait - what does the mask matter - why do I care. It's essential to understand the mask, as it tells your routing table what networks are reachable locally vs which networks need to be routed.
/8 netmask = 11111111.00000000.00000000.00000000 = 255.0.0.0
/16 netmask = 11111111.11111111.00000000.00000000 = 255.255.0.0
/24 netmask = 11111111.11111111.11111111.00000000 = 255.255.255.0
So look at the netmasks above - there is a bunch of 1's next to a bunch of 0's. When you look at the netmask from the left to the right - The portion of the ip address that maskes / lined up with the 1's represent's the network part of the address - and the portion of the address represents the host portion of the address.
Let me give you some examples.
5.5.5.5/24 or 5.5.5.5/255.255.255.0 or 00000101.00000101.00000101.00000101/11111111.11111111.11111111.00000000
(typically shown as the first (2)
5.5.5 = the first 24 bits of the address - the network
.5 = the last 8 bits of the address - the host
The network address for 5.5.5.5/24 is 5.5.5.0
The host address for 5.5.5.5/24 is 5
Let's do another (they get pretty boring quickly once you get the hang of it)
172.16.32.3/16
172.16 = the first 16 bits of the address - the network address
32.3 = the last 16 bits of the address - the host address
There are a couple of rules to remember when you are troubleshooting ip problems.
1) Hosts that should be on the same network should have the same network prefix and the same netmask
2) If the networks aren't the same - they will require a router to communicate
3) If the netmasks aren't the same - they may be able to communicate without a router - but likely there is a problem
4) If the networks and netmasks match - and the ip addresses are different - they can be plugged in directly (crossover cable / switch / hub)
At this point - please check out the ip addressing lab to review the concepts discussed above.
