3.2 IPv4/Subnetting
3.2.1 IPv4 Facts
IPv4 Address Facts
IP addresses allow hosts to participate on IPbased networks. An IP address:
    • Is a32-bit binary number represented as four octets (four 8-bitvalues). Each octet is separated  by a period.
    • IPaddresses can be represented in one of two ways:
      • Decimal(for example 131.107.2.200). In decimal notation, each octet mustbe between  0 and 255.
      • Binary(for example 10000011.01101011.00000010.11001000). In binarynotation, each  octet is an 8-digit number.
    • The IPaddress includes both the network and the host address.
    • Thesubnet mask is a 32-bit number that is associated with each IPaddress that identifies the  network portion of the address.In binary form, the subnet mask is always a series of 1's followed by a series of 0's (1's and 0's are never mixed insequence in the mask). A simple  mask might be255.255.255.0.
    • Slashnotation allows you to represent the subnet mask at the end of theIP address by using a  slash (/) followed by the total numberof ones in the subnet mask (e.g., /24 represents the  subnetmask 255.255.255.0 or 11111111.11111111.11111111.00000000).
IP addresses have a defaultclass. The address class identifies the rangeof IP addresses and a  default subnet mask used for the range.The following table shows the default address class for eachIP  address range.
Class
AddressRange
First OctetRange
Default SubnetMask
Default SubnetMask
A
1.0.0.0 to  126.255.255.255
1-126
255.0.0.0
/8
B
128.0.0.0 to  191.255.255.255
128-191
255.255.0.0
/16
C
192.0.0.0 to  223.255.255.255
192-223
255.255.255.0
/24
D
(multicast)
224.0.0.0 to  239.255.255.255
224-239
n/a
n/a
E
(experimental)
240.0.0.0 to  255.255.255.255
240-255
n/a
n/a
Note: Class D addresses are used formulticast groups rather than network and host IDs. ClassE  addresses are reserved for experimental use.
Older TCP/IP protocols are described as usingclassful addresses because they use theaddress  class, and therefore the default subnet mask (andnot an explicit subnet mask value), to identify the  networkportion of the address.
VLSM Facts
Using classful addressing means that subnetboundaries exist only along default class boundaries, and  thenumber of hosts for each subnet remains fixed. However, for smalleror larger subnets, using  classful addresses means that largersubnets are not possible, while smaller subnets result in awaste  of possible IP addresses. The use of custom subnetmasks with classless addressing allows you to  customize thenumber of subnets and the number of hosts allowed on eachsubnet.
When you use a variable length subnet mask(VLSM), you vary the number of bits in the subnet mask  to dothe following:
  • Subnet a single network address into multiple smallersubnets. For example, subnetting allows  a single Class Cnetwork address to be divided to identify multiple smaller subnets.When you  subnet a network address, you increase the number ofmasked bits in the subnet mask. This  creates additionalsubnets, but reduces the number of hosts on each subnet.
  • Create asupernet which combines multiple network addresses into asingle larger subnet. For  example, this allows multiple ClassC addresses to be combined into a single network. When  youcreate a supernet, you decrease the number of masked bits in thesubnet mask. This  reduces the number of available subnets,but increases the number of hosts on each subnet.
As you create subnets, you modify the number ofbits in the subnet mask to create smaller subnets with  fewerhosts per subnet. The following table lists several operations youneed to be able to perform,  along with a possible method forcompleting the task.
Scenario
Solution
Given a classful  network address and a custom  subnet mask, how  many subnets do  youget?
Use the following process to identify thenumber of additional subnets you gain by  using a customsubnet mask:
  • If thesubnet mask is in decimal format, convert the mask to binary.For  example, a mask of 255.255.248.0 converts to:
    11111111.11111111.11111000.00000000
  • Countthe number of 1 bits that are extra beyond the default subnetmask.  In this example, if the address was a class B address,the mask would  include 5 additional bits.
  • Use theformula 2n to calculate the number of subnets, wheren is the  number of extra masked bits. In thisexample:
    2n = 25 = 32 subnets
 
Given a classful  network address and a custom  subnet mask, what  are the possible subnet addresses?
Use the following process to identify thepossible subnet addresses when using  a custom subnet mask:
  • If thesubnet mask is in decimal format, convert the mask to binary.For  example, a mask of 255.255.224.0 converts to:
    11111111.11111111.11100000.00000000
  • Identifythe octet that includes both 1's and 0's. Write out eachpossible  combination of values, modifying only the 1 bits. Inthis example,  possible values for the third octet are:
 
 
 
00000000
 
 
10000000
 
 
00100000
 
 
10100000
01000000
 
 
11000000
01100000
 
 
11100000
  • For eachvalue, convert the decimal number to binary. In this example, you would have possible third octet values of: 0, 32, 64, 96, 128,160,  192, 224.
  • From theoriginal classful network, complete the remaining octets.
    • For anoctet where the mask is 255, use the original decimal  valuefrom the network address.
    • For theoctet where the additional bits were used, use the  valuesobtained in step 3.
    • For allremaining octets where the mask was 0, use 0 for the  subnetaddress.
For example, if you were subnetting a classB address 166.12.0.0, you  would have the following possiblesubnet addresses:
 
 
166.12.0.0
 
 
166.12.128.0
166.12.32.0
 
 
166.12.160.0
166.12.64.0
 
 
166.12.192.0
166.12.96.0
 
 
166.12.224.0
Tip: Instead of writing out everypossible combination and converting each  value in steps 2 and3, you can take a shortcut by identifying an increment value (sometimes referred to as a magic number):
  • Identifythe last 1 bit in the subnet mask. Convert all other bits inthat  octet to 0. A mask of 255.255.224.0 gives you an octetvalue of  00100000.
  • Convertthis binary value to decimal to get the increment value. (00100000 = 32)
  • Startwith 0 as the first subnet address value. For each subsequent subnet, add the increment value to the previous value. In thisexample,  this gives you the possible values of: 0, 32, 64,96, 128, 160, 192, 224.
 
Given a subnet  address and the subnet mask, how  many hosts can  you have on the subnet?
To identify the number of hosts that areallowed on a subnet, use the following  process:
  • If thesubnet mask is in decimal format, convert the mask to binary.For  example, a mask of 255.255.248.0 converts to:
    11111111.11111111.11111000.00000000
  • Countthe number of unmasked bits. These are the bits that identify thehost  addresses.
  • Use theformula 2n - 2 to calculate the number of hosts, wheren is the  number of unmasked bits. In thisexample:
    2n - 2 = 211 - 2 = 2048 - 2 = 2046 hostaddresses
Remember, the first address in a range on thesubnet is the subnet address, and  the last address in a rangeon the subnet is the broadcast address. These  addressescannot be assigned to hosts.
Given a subnet  address and the subnet mask, what  is the range of  possible host addresses?
To identify the specific host values thatcan be assigned on a subnet:
  • Use theprocess described above (row 2 in the table) to identify thenext  possible subnet address. For example, if you had asubnet address of  166.12.64.0 with a mask of 255.255.224.0,the next possible subnet  address would be 166.12.96.0.
  • Add 1 tothe subnet address to get the first host address, in thisexample  166.12.64.1.
  • Subtract2 from the next subnet address to get the last possible host address, in this example 166.12.95.254. Note: Subtracting 1from the next  possible subnet address gives you the broadcastaddress for the current  subnet. Because this address cannotbe assigned to hosts, subtract one  more to get the last hostaddress on the subnet.
 
  
Subnetting Tables
As you work with subnetting operations, use thefollowing tables to quickly find the information you  need. Bymemorizing these tables, you will be able to quickly reproduce thevalues necessary for  identifying the binary and decimalvalues you use most.
The following table lists the exponent values forpowers of 2.
Exponent
21
22
23
24
25
26
27
28
210
216
Exponentvalue
2
4
8
16
32
64
128
256
1024
65,536
Tip: Memorize the shaded values. To findsmaller or larger values, divide or multiply the exponent value by 2. For example, to get the decimal value of211, multiply 210 by 2 (giving you 2048). Tofind the  value of 212, use 210 x 2 x 2= 4096.
The following table lists the common binary anddecimal values used in subnet masks:
Subnet maskvalue
Decimalequivalent
00000000
0
10000000
128
11000000
192
11100000
224
11110000
240
11111000
248
11111100
252
11111110
254
11111111
255
Use the table as a shortcut guide to subnetting.Tip: Look for patterns in the table so you can easily reproduce the table at any time.
MaskedBits
MaskValue
Number ofSubnets*
Number of Hostsper Subnet
Approximate
Actual (2n- 2)**
/20
255.255.240.0
16
4000
4094
/21
255.255.248.0
32
2000
2046
/22
255.255.252.0
64
1000
1022
/23
255.255.254.0
128
500
510
/24
255.255.255.0
1 or 256
256 or250
254
/25
255.255.255.128
2
128 or 125
126
/26
255.255.255.192
4
64 or 60
62
/27
255.255.255.224
8
32 or 30
30
/28
255.255.255.240
16
16 or 15
14
/29
255.255.255.248
32
8
6
/30
255.255.255.252
64
4
2
*The number of subnets is the number ofsubnets you get by subnetting a default network address (either class B or class C in this table). For example, if yousubnet a class B network using a /24 mask,  you would have 256subnets.
**To identify the actual number of hosts per subnet, use theformula 2n - 2, where n is the number of  unmaskedbits in the subnet mask. Remember to subtract 2 for the addressesthat are not assigned to  hosts:
    • Thefirst address in the range is the subnet address andcannot be assigned to hosts.
    • The lastaddress in the range is the broadcast address and cannotbe assigned to hosts.
Subnet Chart
graphic
graphic
IPv4 Config Facts
The following configuration values allow you toconnect an IPv4 host to a network and enable  communicationwith other hosts.
Parameter
Purpose
IPaddress
Identifies both the logical host and logicalnetwork addresses. Two devices on the  same network must haveIP addresses with the same network portion of the address.
Subnetmask
Identifies which portion of the IP address is thenetwork address. Two devices on the  same network must beconfigured with the same subnet mask.
Defaultgateway
Identifies the router to which packets for remotenetworks are sent. The default gateway address is the IP address ofthe router interface on the same subnet as the local host. Without a default gateway set, most clients will be unable tocommunicate with hosts  outside of the local subnet.
Hostname
Identifies the logicalname of the local system.
DNSserver
Identifies the DNS server that is used to resolveDNS host names to IP addresses. A  DNS server is required whenusing an application, such as a Web browser, where  logicalnames are used to identify hosts.
WINSserver
Identifies the WINS server that is used toresolve NetBIOS host names to IP  addresses. A WINS serveraddress is only required if NetBIOS names are used  acrossmultiple subnets.
MACaddress
Identifies the physical address. On an Ethernetnetwork, this address is burned in to  the network adapterhardware.
Note: A host requires an IP address andsubnet mask to communicate on a single subnet. A default gateway address is required to enable inter-subnet communications.At least one DNS server address  is required for the host touse hostnames when contacting other hosts.
You can configure IPv4 configuration settings ona host system using the following methods:
Method
Uses
Static (manual)  assignment
You can manually assign TCP/IPconfiguration values for a host.
    • When youconfigure a static IP address, you must also configure the subnet mask and default gateway.
    • When youconfigure a static IP address, you disable DHCP and APIPA.
    • If youuse DHCP you can also assign DNS server addresses manually.
Use static addressing:
    • Forsmall networks that do not often change or grow.
    • If yournetwork does not have a DHCP server, or if you want toeliminate  DHCP traffic from your network.
    • Forspecific hosts that must have the same address each time (suchas  servers). You can use DHCP on the rest of the network andonly use static  addressing for a few hosts. However, beforeyou use static addressing,  explore the possibility of using aDHCP server to assign the same IP  address to specific hostseach time the address is requested.
    • Fornon-DHCP hosts (hosts that cannot accept an IP address fromDHCP).
Dynamic Host  Configuration Protocol (DHCP)
DHCP is an automatic method for assigningIP address and other TCP/IP  configuration parameters tohosts. Client computers contact a DHCP server to  receiveTCP/IP configuration information. Use DHCP:
    • Forsmall, medium, or large networks.
    • Forautomatic host configuration.
    • Toautomatically deliver additional configuration parameters (suchas  default gateway, DNS servers).
By default, all Windows computers try to use DHCPfor TCP/IP configuration  information.
Automatic Private  IP Addressing (APIPA)
APIPA is an automatic configuration methodwhere hosts automatically select their own IP address within aspecific range. With APIPA:
    • Windowscomputers will use APIPA if a DHCP server cannot be contacted.
    • Hostsselect an IP address in the 169.254.0.1 to 169.254.255.255 rangewith a mask of 255.255.0.0. After choosing the address, the hostverifies  that no other host on the network is using theselected address.
    • APIPAsets only the IP address and mask. Because it does not assigna  default gateway, APIPA can be used on a single subnet, butcannot be  used if communication with other subnets isrequired.
Use APIPA for small, single-subnet networks thatdo not use DNS servers or have Internet or connectivity outside ofthe local subnet.
Alternate IP  configuration
With an alternate IP configuration, thesystem attempts to use DHCP for TCP/IP  configurationinformation. If a DHCP server cannot be contacted, the static configuration values are used. When you configure an alternate IPaddress,  APIPA is no longer used.
Use an alternate configuration:
    • If youhave a computer (such as a laptop) that connects to twonetworks:  one with a DHCP server and another without a DHCPserver.
    • If youwant to provide values to properly configure the computer incase  the DHCP server is unavailable.
  
3.2.2 Config Static IP
    • ClickStart/Control Panel.
    • Double-click Network and Sharing Center.
    • ClickManage network connections.
    • InNetwork Connections, right-click the applicable network connectionand select Properties .  Click Continue asnecessary.
    • SelectInternet Protocol Version 4 (TCP/IPv4) from the list ofitems used by the connection. Then  click theProperties button.
    • Selectthe Use the following IP address: option.
    • Type theIP address and press the Tab key.
    • Keep thedefault subnet mask or type a new subnet mask if the default maskwill not be used.  Then press the Tab key.
    • To routedata to another subnet, type the default gateway address. If allcomputers are on a single  subnet, you can leave this valueblank.
    • Toassign a preferred DNS server, select Use the following DNSserver address: option.
    • Type theaddress and then press the Tab key.
    • Toassign an alternate DNS server, select the Alternate DNSServer option.
    • Type inthe address the press the Tab key.
    • ClickOK to save the changes.
3.2.3 Config DHCP or Alternate
Configure Automatic DHCP and DNSAddressing
    • ClickStart/Control Panel.
    • UnderNetwork and Internet, select View network status andtasks.
    • ClickManage network connections to open the Local AreaConnection Status dialog.
    • Right-click the applicable network connection and selectProperties . Click Continue as  necessary.
    • SelectInternet Protocol Version 4 (TCP/IPv4), then clickProperties.
    • Toconfigure automatic IP addressing through DHCP, select Obtain anIP address  automatically.
    • Toconfigure automatic DNS addressing, select Obtain DNS serveraddress automatically.
    • ClickOK to close the Internet Protocol Version 4 (TCP/IPv4)Properties dialog.
    • ClickClose to close the Local Area Connection Propertiesdialog.
    • ClickClose to return to the Network and SharingCenter.
Configure Alternate TCP/IPAddressing
    • ClickStart/Control Panel.
    • UnderNetwork and Internet, select View network status andtasks.
    • ClickManage network connections to open the Local AreaConnection Status dialog.
    • Right-click the applicable network connection and selectProperties . Click Continue as  necessary.
    • SelectInternet Protocol Version 4 (TCP/IPv4), then clickProperties.
    • Clickthe Alternate Configuration tab. (Note: The Obtainan IP address automatically setting  must be configuredbefore you see the Alternate Configuration tab.)
    • Toconfigure alternate IP settings, select User configured,then enter the values for the  following, as necessary:
      • IP address:
      • Subnet mask:
      • Default gateway:
      • Preferred DNS server:
      • Alternate DNS server:
      • Preferred WINS server:
      • Alternate WINS server:
    • ClickOK.
    • ClickOK to close the Local Area Connection Propertiesdialog.
    • ClickClose to return to the Network and SharingCenter.
3.2.4 Allow PING thru Firewall
1. Go to AdvancedFirewall
2. Right click Inbound Rule,click New Rule. New Inbound Rule Wizard box appears.
3. For PING the rule has tobe custom. Click "Custom" then Next.
4. Click All Programs, thenNext.
5. Choose Protocol Type:ICMPv4. (Can click Advanced and click Echo Request), ClickNext.
6. Choose which Ip Addressesyou want to allow to ping. (All/Any). Click Next.
7. Click Allow theConnection, Click Next.
8. Click Network types toallow the rule. Click Next.
9. Name the Rule, ClickFinish.
3.2.5 TCP/IP Math Facts
The following table shows the decimal value forvarious binary values with a single 1 bit.
BinaryValue
10000000
01000000
00100000
00010000
00001000
00000100
00000010
00000001
DecimalValue
128
64
32
16
8
4
2
1
To find the decimal value of a number withmultiple 1 bits, simply add the decimal value of the bits together. You can do this using a grid. For example, the decimalvalue of the binary number 10010101 is:
BinaryValue
1
0
0
1
0
1
0
1
DecimalValue
128
64
32
16
8
4
2
1
Total = 128 + 16 + 4 + 1 = 149
You also need to know how to convert hexadecimalnumbers to binary. The easiest way to do so is to  memorizethe binary values for each hexadecimal number using the followingtable.
Hexadecimal  Value
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
BinaryValue
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
DecimalValue
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15