Networking Basics
-
IP Address: is a numeric assigned to each device connected to a computer network to identify the device.
- Two flavors of IpAddressing
- IPv4: 32 bit number
- IPv6: 128 bit number
- Two flavors of IpAddressing
-
IPv4 addresses:
- has the size of 32 bits which theoritically allows to connect to 2^32 addresses. We are not allowed to use all the addresses as some of them reserved
- An IPv4 address is represented as
x.x.x.x
. Each x is 8 bit number so x can be any where between 0 to 2^8-1 (255). Range of ip address (0.0.0.0 to 255.255.255.255) - Launch cmd and execute ipconfig
- IP address uniquely identifies your device. In the above case ip address was 192.168.0.106. But why do i require subnet mask and Default gateway?
-
Basic Networking Principles
- A device in a network can communicate with other devices in the same network
-
When we look at ip address it is representation of
- network identifier:
- id of your network
- All the devices with same id can communicate with each other
- host identifier:
- device id on your network
- network identifier:
-
But how would i know what is network id and what is host id by looking at ipaddress?
- It is not possible to know network id from a ip address without knowing what subnet mask.
ip addresss: 192.168.0.106 subnet mask: 255.255.255.0 network id: 192.168.0.0 host id: 106 ip address: 10.10.12.14 subnet mask: 255.255.0.0 network id: 10.10.0.0 host id: 12.14
-
The host id size will reveal size of network i.e. how many devices you can connect on the network. Size of network => 2^n – 2 (n = size of host id in bits)
ip addresss: 192.168.0.106 subnet mask: 255.255.255.0 network id: 192.168.0.0 host id: 106 size (hostid): 8 bits : 2^8 -1-1 : 254 ip address: 10.10.12.14 subnet mask: 255.255.0.0 network id: 10.10.0.0 host id: 12.14 size (hostid): 16 bits : 2^16-2 : 65534
-
Older approach: Use classful addressing Refer Here
- Possible subnet masks which i can have in this approach is
- Class A => 255.0.0.0 => number of address => 2^24-2 ~= 16,777,216
- Class B => 255.255.0.0 => number of address => 2^16-2 ~= 65000
- Class C => 255.255.255.0 => number of address => 2^8-2 ~= 250
- Possible subnet masks which i can have in this approach is
-
Scenarios:
- If i need a network which has to connect to 200 devices. Based on classful networking i need to use class C network
- If i need a network which has to connect to 400 devices. Use class B. But class B is of size 65000 which is way beyond 400 (so many address will be wasted)
-
A new ip addressing scheme called as CIDR (Classless inter domain routing) convention came into play
- Now convert subnet mask into binary
network: 192.168.0.0 subnet mask: 11111111.11111111.11111111.00000000 255.255.255.0 cidr notation => 192.168.0.0/24 how many zeros => 8 (size of network) till what position do you consecutive 1 => 24 size of network => 2^8-2 = 254 network: 192.168.0.0 subnet mask: 11111111.11111111.11111110.00000000 255.255.254.0 cidr notation => 192.168.0.0/23 how many 1s => 23 how many 0 => 9 size of network => 2^9-2 => 510
- Create a classless network for 1000 devices. Refer Here from this table find smallest number that is approximately thousand
value=> 2^10 =1024 so our value = 10 10 for host id subnet mask: 11111111.11111111.11111100.00000000 : 255.255.252.0