All about IPv4

All about IPv4

IPv4 addresses allow hosts to participate on IPv4-based networks. IP addresses, in conjunction with routers, are responsible for sorting and delivering packets to and from clients on a network. Each packet contains the IP address of both the sender and the recipient. Routers use the IP address to send the packets to the specified destination network.

Keep in mind the following IPv4 rules:

  • Each network host must have a unique IPv4 address.

  • Each host on the same logical network must have the same network address.

  • Hosts can communicate directly only with other hosts on the same logical network. If hosts reside in different logical networks, then a router must be employed to route packets between networks.

Be aware of the following IPv4 concepts.

Concept

Description

Host

A host is a computer on a network.

IP Address

The IP address is a number assigned to identify hosts and other components on a network.

Network Address

The network address is the portion of the IP address that identifies a specific network. The remaining portion of the IP address identifies the host or other component on the network.

Subnet Mask

A subnet mask identifies the portion of the IP address that defines the network address and the portion of the IP address that defines the specific host.

Address Class

IPv4 addresses are divided into classes. The address class identifies the range of IPv4 addresses and a default subnet mask used for the range.

Default Subnet Mask

A default subnet mask is assigned to classes A - C as follows:255.0.0.0 is the default subnet mask for class A networks.255.255.0.0 is the default subnet mask for class B networks.255.255.255.0 is the default subnet mask for class C networks.

Broadcast Address

The broadcast address is the last address in the address range and is used to send messages to all hosts on the network.

Default Gateway

The default gateway is a device that performs the act of routing and enables a host to communicate with other hosts on other networks through the process of routing.A default gateway address must be configured on each host to allow internetwork communication. Without the default gateway, hosts will be able to communicate only with devices within the same subnet.The default gateway address must be on the same subnet as the host computer.Routers have multiple network interface cards attached to multiple networks.When configuring the default gateway, choose the address on the local subnet.

IP Address Structure

An IPv4 address is a 32-bit binary number represented as four octets (four 8-bit numbers).

  • Each octet is separated by a period. IPv4 addresses can be represented in one of two ways:

    • Decimal (for example, 131.107.2.200). In decimal notation, each octet must be between 0 and 255.

    • Binary (for example, 10000011.01101011.00000010.11001000). In binary notation, each octet is an eight-digit number.

  • To convert from binary to decimal and vice versa, memorize the decimal equivalent of the following binary numbers:

10000000

01000000

00100000

00010000

00001000

00000100

00000010

00000001

128

64

32

16

8

4

2

1

To convert from binary, take each bit position with a 1 value and add the decimal values for that bit together. For example, the decimal equivalent of 10010101 is: 128 + 16 + 4 + 1 = 149

Subnet Mask

The subnet mask is a 32-bit number that identifies the network portion of each IPv4 address.

  • In binary form, the subnet mask is always a series of 1s followed by a series of 0s (1s and 0s are never mixed in the mask).

  • A simple mask might be 255.255.255.0.

The following table shows the default address class for each IPv4 address range.

Class

Address Range

First Octet Range

Default Subnet Mask

CIDR Notation

A

1.0.0.0 to 126.255.255.255

1-126
(00000001--01111110 binary)

255.0.0.0

/8

B

128.0.0.0 to 191.255.255.255

128-191
(10000000--10111111 binary)

255.255.0.0

/16

C

192.0.0.0 to 223.255.255.255

192-223
(11000000--11011111 binary)

255.255.255.0

/24

D

224.0.0.0 to 239.255.255.255

224-239
(11100000--11101111 binary)

n/a

n/a

E

240.0.0.0 to 255.255.255.255

240-255
(11110000--11111111 binary)

n/a

n/a

Address Assignment

The following table describes options for assigning IPv4 addresses and other IPv4 configuration values.

Method

Uses

Dynamic Host Configuration Protocol (DHCP)

DHCP is an automatic method for assigning IPv4 address and other TCP/IPv4 configuration parameters to hosts. Client computers contact a DHCP server to receive TCP/IPv4 configuration information. Use DHCP:For small, medium, or large networks.For automatic host configuration.To automatically deliver additional configuration parameters such as default gateway and DNS servers.By default, all Windows computers try to use DHCP for TCP/IPv4 configuration information.

Automatic Private IPv4 Addressing (APIPA)

APIPA is an automatic configuration method where hosts automatically select their own IPv4 address within a specific range. With APIPA:Windows computers will use APIPA if a DHCP server cannot be contacted.Hosts select an IPv4 address in the 169.254.0.1 to 169.254.255.255 range with a mask of 255.255.0.0. After choosing the address, the host verifies that no other host on the network is using the selected address.APIPA sets only the IPv4 address and mask. Because it does not assign a default gateway, APIPA can be used on a single subnet, but cannot be used if communication with other subnets is required.Use APIPA for small, single-subnet networks that do not use DNS servers or do not have Internet or connectivity outside of the local subnet.

Static (Manual) Assignment

You can manually assign TCP/IPv4 configuration values for a host.When you configure a static IPv4 address, you must also configure the subnet mask and default gateway.When you configure a static IPv4 address, you disable DHCP and APIPA.If you use DHCP, you can also assign DNS server addresses manually.Use static addressing:For small networks that do not often change or grow.If your network does not have a DHCP server, or if you want to eliminate DHCP traffic from your network.For specific hosts that must have the same address each time, such as servers. You can use DHCP on the rest of the network and use static addressing for only a few hosts. However, before you use static addressing, explore the possibility of using a DHCP server to assign the same IPv4 address to specific hosts each time an address is requested.For non-DHCP hosts (hosts that cannot accept an IPv4 address from DHCP).

Alternate IPv4 configuration

With an alternate IPv4 configuration, the system attempts to use DHCP for TCP/IPv4 configuration information. If a DHCP server cannot be contacted, the static configuration values are used. Use an alternate configuration:If you have a computer, such as a laptop, that connects to two networks, one with a DHCP server and another without a DHCP server.If you want to provide values to properly configure the computer in case the DHCP server is unavailable.When you configure an alternate IPv4 address, APIPA is no longer used.

A Network Address Translation (NAT) router translates multiple private addresses into the single registered IP address.

  • The Internet is classified as a public network. All devices on the public network must have a unique registered IP address; this address is assigned by the ISP. No two hosts on a public network can have the same IP address.

  • The internal network is classified as a private network. All devices on the private network use private IP addresses internally, but share the public IP address when accessing the Internet.

  • A NAT router associates a port number with each private IP address. Port assignments are made automatically by the NAT router. Communications from the Internet are sent to the public IP address. The NAT router translates the public IP address into the private IP address of the host.

  • The Internet Assigned Number Authority (IANA) controls and issues public addressing.

  • The private network can use addresses in the following ranges that have been reserved for private use by IANA:

    • 10.0.0.0 to 10.255.255.255

    • 172.16.0.0 to 172.31.255.255

    • 192.168.0.0 to 192.168.255.255 By default, Internet routers are configured not to route private IP addresses.


I hope you find it useful, let me know your thoughts on this in the comments. If you have any issues or questions about it, feel free to contact me. Thank you 🌟 for reading! like, share and subscribe to my newsletter for more! 💖

🔗Debasish Lenka

Did you find this article valuable?

Support Debasish Lenka by becoming a sponsor. Any amount is appreciated!