TCP/IP Basics - II

Continuing from the previous post, in this blog, I will talk about routing and subnets.
Subnets can be considered as a collection of machines that can communicate with each other without going via a router. Router's job is to connect different subnets. Subnets is defined by the combination of IP address and subnet mask. Subnet mask is usually defined similar to IP but it has certain bits turned off. For ex. a typical subnet mask would look like Here the fourth octate is turned off. Now if the IP is combining with subnet mask we know that the first 3 octates 114.124.134 define the network and 144 defines the node. So with this configuration in this subnet, we can have the IPs ranging from to Any two machines in the same subnet can talk directly by knowing the node value. 
We can use the tracert command and the pathping command to trace the route of a request. pathping command provides more reliable info as it sends multiple requests to each hop to calculate statistics.

Now we know that how computers reach each other if they are in the same subnet. But how does a computer determine how to reach other subnets? For this the Routes table comes into picture. We can see the route table by using the command route print. The request tries to find the entry in the table that matches the most to figure out the gateway to contact. Usually the first entry in the table has a destination of, netmask of and default gateway IP address as defined in the ipconfig. This means that for any IP the request should be routed to the default gateway. If you see the gateway as "On-link" that means the same machine. There is also another entry, usually in the end which has a destination of, netmask and gateway as "On-link". This means that its a broadcast. Broadcasts don't cross routers. Broadcast is to send traffic destined only for the subnet.

Private IP
Since there is shortage of IPs, mostly at homes the ISP provides you with only  one IP. Then lets say at home you have your mobile phone, laptop, xbox and tv connected to internet, they all have 4 IPs taken from a private range. Whenever these devices communicate with outer world, a process called network address translation (NAT) converts them to the IP ISP provided. Simimlarly when the response comes back the ISP IP is converted to the private IP. The private IP/subnet range is,,