test me

Site Search:

Subnetting Basics


If we put too many hosts in the same Ethernet segment (collision domain), due to heavy data transfer, the packets become slow because of collision and retransmission. This can be avoided by using SUBNET.

Subnetting divides a single network address into many segments, so that each network segment can have its own unique address. One way of spitting up a single network is to place routers between network segments and attach number of hosts to each segment. And all network segments can be connected to the Internet through a single gateway router. The actual details of the internal network enviroment and how the network is divided into multiple subnetworks are hinden behind this gateway router. To other IP networks, they see only the IP network addresses exposed by the gateway router.

subnet

There are many benefits of subnetting:

  1. We conserved IP addresses by assigning less hosts per subnet.

  2. We get smaller collision domains -- the collisions happened in one subnet won't effect other subnets.

  3. We get smaller broadcast domains -- the broadcast from one subnet won't propagate to other subnets.

  4. We can more easily apply network security measures at the interconnections between subnets than throughout the entire network.

  5. We can easily map subnets to geographical or functional requirements to a cooperation. For example, we give a subnet to market department, another to engineer department, so that each department is responsible for their own network.



Recall normal address mask we have learned previously.
Class A: 1-126, Default Mask 255.0.0.0, 8 Network bits, 24 Host bits

Class B: 128-191, Default Mask 255.255.0.0, 16 Network bits, 16 Host bits

Class C: 192-223, Default Mask 255.255.255.0, 24 Network bits, 8 Host bits

This is actually a two-level address schema with network address as one level and host address as the other. Each address class (A, B, and C) had a default mask associated with it, and because the mask was predefined, it was not necessary to explicitly configure the mask. As more networks joined the internet, this two level schema proved to be insufficient. A third level of addressing consisting of subnets, was developed. A subnet address includes the original classful network portion plus a subnet field. This is also known as the extended network prefix. Because of subnet field, the actual mask is longer than the default mask for address classes (A, B, and C), we need to explicit configure the subnet mask.

Very similar to the normal network mask, in subnet mask, the network bits are represented by the 1s in the mask. The host bits are represented by the 0s in the mask. The result of a bit-wise logical 'AND' operation between the IP address and the subnet mask is a Network Address or Number or Subnet Address.

Before a host can send a packet to its destination, it must first determine whether the destination address is on the local network. The sending host will compare the network bits in the destination address with the network bits of the sending station. If they are the same, the destination host and the source host are in the same subnet. The source host will use the ARP process to bind the destination IP address to the destination MAC address. If the network bits are different, they source host and destination host are in different subnet, the source host must forward the packet to the MAC address of the default gateway, a router on the subnet. The gateway router, then route the packet cross different subnets.

A subnet mask also tells the router to look at the network and subnet bits portions of an IP address in order to build the routing table. The router create the routing table with the network-significant part of all known networks. When configuring routers, each interface is connected to a different network or subnet segment. An available host address from each different network or subnet must be assigned to the interface of the router that connects to that network or subnet.

A subnet is defined by changing the bit mask of the IP address, that is, we create subnets by "borrowing" bits from the default host bits. A subnet mask functions in the same way as a normal address mask: an "on" bit is interpreted as a network bit; an "off" bit belongs to the host part of the address. The difference is that a subnet mask is only used locally. In the outside world the address is still interpreted as a standard IP address.



  • The broadcast address is the subnet portion plus the host portion all set to 1.

  • The applicable host range for this subnet is 1 off the subnet address and 1 before the broadcast address.
For example, we have IP address 203.200.10.60 with subnet mask 255.255.255.248
Looking at the subnet mask, the first 24 bits are all 1, so we know the subnet portion is 203.200.10.?, the first three octets remain unchanged, we just need to calculate the 4th octet.
Now, let's focus on the 4th octet or the last 8 bits of the subnet mask, 248 in binary is 11111000.
The 4th octet of IP address 60 in binary is 00111100.
Apply logical AND to 0011100 and 11111000, we get 00111000, which is binary 56.
128   64   32   16   8   4   2   1           
0       0     1     1     1   1   0   0                 60    (yes, the video's slides have a typo)
1       1     1     1     1   0   0   0                 248
-------------------------------------
0       0     1     1     1   0   0   0                 56

Therefore, the subnet portion of the IP address 203.200.10.60 with subnet mask 255.255.255.248 is 203.200.10.56.
We can calculate the broadcast address by set the host portion all to 1, and we get binary 00111111 or digital 63.
Therefore, the broadcast address of 203.200.10.60 with subnet mask 255.255.255.248 is 203.200.10.63.

128   64   32   16   8   4   2   1
0       0     1     1     1   0   0   0                  56
0       0     1     1     1   1   1   1                  62

With subnet portion known to be 203.200.10.56 and the broadcast address known to be 203.200.10.63, we deduce that the applicable host range for this subnet is from 203.200.10.57 to 203.200.10.62.

1 comment: