THOUSANDS OF FREE BLOGGER TEMPLATES

Thursday, November 11, 2010

Comp.-Sci. Notes: Logical Addressing

I’ve never been a person who does things ‘inside a box’ or in a specific, orderly way. As such I’ve never believed in studying things in order. But rather cover the work I’m not very sure of (read: didn’t study for the previous test) first. So with that having been said I will now do the ‘Network Layer-Logical Addressing’.

 

IPv4 Addresses:

IPv4 Address:

  • 32 bits long
  • unique (each address defines one and only one connection to the Internet)
  • universal (accepted by any host connecting to the Internet)

Address Space:

  • the total number of addresses used by the protocol
  • each bit can have 2 values (1 or 0) therefore an address of N bits will have an address space and values equal to 2^N
  • IPv4 uses a 32-bit address, so the address space is
    • 2^32 = more than 4 billion (if there were no restrictions)

Notations:

  • Binary Notation:
    • displayed as 32 bits or 4 bytes
    • eg: 01110101 10010101 00011101 00000010
  • Dotted Decimal Notation:
    • more compact and easier to read
    • written in decimal form with a decimal point separating the bytes(every 8 bits)
    • eg: 117.149.29.2

Converting:

  • each weight is 2^pos where pos is the position of the bit
  • eg: at position 0 it is 2^0 = 1, at position 1 it is 2^1 = 2

Binary to Decimal:

  • Multiply each symbol by it’s weight
  • Then add the results
  • eg: for binary 1001110

                       1     0     0    1    1    1    0

pos:              6      5     4    3    2    1    0

2^pos:          64   32   16   8   4    2    1

multiply:   65    0      0    8    4    2    0

 

Add:           65+8+4+2 = 78

therefore the decimal is 78

Decimal to Binary:

  • Divide the number by 2 which becomes the ‘quotient’
  • Write down the remainder (1 or 0) which is ‘the least significant binary digit’
  • then divide the quotient by 2 and write down the new remainder in the next position
  • (continue until the quotient becomes 0)
  • eg: for decimal 78

78 / 2 = 39   r = 0

39/ 2 = 19    r = 1

19/ 2 = 9      r = 1

9 / 2 = 4      r = 1

4 / 2 = 2      r = 0

2 / 2 = 1      r = 0

1 / 2 = 0      r = 1

 

Therefore the binary notation is: 1001110

 

Classful Addressing:

  • Address space is divided into 5 classes – A, B, C, D, E
  • In Binary notation – use the first few bits
    • Class A : 0
    • Class B :  10
    • Class C :  110
    • Class D :  1110
    • Class E  :  1111
  • In Decimal notation –use the first byte
    • Class A : 0 – 127
    • Class B : 128 – 191
    • Class C : 192 – 223
    • Class D : 224 – 239
    • Class E : 240 – 255

Classes and Blocks:

Class    Number of Blocks    Block Size        Application

  A           128                               16777216            Unicast

  B            16384                           65536                  Unicast

  C            2097152                      256                       Unicast

   D           1                                   268435456          Multicast

   E            1                                   268435456          Multicast

Therefore it can be seen that a large part of the available address space was wasted in classful addressing

Netid and hostid:

  • Only given to Classes A, B, C
  • Class A – 1 byte netid, 3 bytes hostid
  • Class B – 2 bytes netid, 2 bytes hostid
  • Class c – 3 bytes netid, 1 byte hostid

Mask:

  • although the netid and hostid are predetermined, a mask can also be used
  • 32 bit number
  • contiguous 1s followed by contiguous 0s

Default masks for classful addressing:

Class Binary                                                                Decimal       CIDR

A     11111111 00000000 00000000 000000000  255.0.0.0        /8

B      11111111 11111111 00000000 000000000  255.255.0.0   /16

C      11111111 11111111 11111111 000000000 255.255.255.0/24

CDIR = Classless Interdomain Routing = mask = /n (n = bits)

Subnetting:

  • Only Class A or B
  • divide the addresses into several contiguous groups
  • each small group  assigned is called a subnet
  • this increases the number of 1s in the mask

Supernetting:

  • only Class C
  • combine several class C blocks to  create a supernet
  • decreases the number of 1s in the mask
  • eg: if combining 4 class Cs, the mask would change from/24 to /22

Classless Addressing:

Address Blocks:

  • the size of the block is not fixed but varies
  • Three rules:
  •           - the addresses in a block must be contiguous
  •           - the number of addresses in a block must be a power of 2 (1,2, 4,8….)
  •           - the 1st address must be evenly divisible by the number of addresses

Mask:

  • can take any value from 0 –32 in classless
  • a block of addresses  take the form:
  •            - x.y.z.t /n

First Address:

  • convert the address to binary
  • 32 - n
  • set the 32 – n right-most bits to 0s
  • then convert back to decimal

Last Address:

  • convert the address to binary
  • 32 - n
  • set the 32 - n right-most bits to 1s
  • then convert back to decimal

Number of Address:

  • the difference between the last and first address
  • use the formula 2^(32-n)

Network Address:

  • the 1st address in a class of addresses is the network address
  • it defines the organisation to the rest of the world

Two level Hierarchy – no subnetting:

  • the n left-most bits define the network (common to all addresses in the network)
  • the 32 – n right-most bits define the host to the network (change from device to device)

Three level Hierarchy – subnetting:

      To subnet within an organisation and change the host:

  • take the original mask of /n
  • take the number of addresses needed for the first subblock and make it equal m
  • use the formula 2^(32-n) = m
  • workout what n must be, and that is your new mask(continue for all subblocks)

Network Address Translation (NAT):

Absolutely nothing I feel like making notes on in this section. It looks completely boring and exactly like the subnetting I have just done. So that’s that, next section:

IPv6 Addresses:

  • 16 bytes or 128 bits long

Hexidecimal Colon Notation:

  • each address is divided into 8 sections of 2-bytes each
  • 2 bytes represents 4 hexadecimal digits
  • therefore the address consists of 32 hexadecimal digits
  • every four digits is separated by a colon
  • eg: FDEC:0074:0000:0000:0000:B0FF:0000:FFFF

Abbreviation:

  • leading 0s of a section can be dropped
  • not trailing 0s
  • if the section is only 0s then one 0 must be left behind

Address Space:

  • larger address space of 2^128

The rest of this chapter is not for studying!!! YAYNESS!!! :D one down, only 13 more to go…

No comments:

Post a Comment