IPv4 addresses are logical and are assigned by the network administrator, unlike ethernet addresses, which are physical addresses relating to a network component. An IPv4 address is 32 bits long, consisting of four octets, each of eight bits. IPv4 addresses are represented in decimal, using what is called dot notation ; that is, each octet is separated by a dot (.). An example of an IPv4 address is 192.168.28.25 . An IPv4 address is used to identify a host on the network, through a combination of network number and host number within the network number. The preceding example represents host number 25 on network 192.168.28 , but as you'll see in the following subsections, the portion of the IP address assigned to the network varies according to its class. IPv4 uses three types of addresses: unicast, multicast, and broadcast. Unicast IPv4 AddressesAn IPv4 unicast address is used for one-to-one communication, that is, when a single host communicates with another single host. There are three classes of IPv4 unicast address ”class A, B, and C ”which are assigned depending on the size of your network and the number of hosts that need to be addressed:
Figure 4.1 shows the three classes of IPv4 unicast addresses in binary format, along with the relevant ranges applicable to each class. Figure 4.1. IPv4 unicast class types.
Multicast IPv4 AddressesA multicast address is one where data is transmitted from a single host to a number of specific hosts at the same time, and it is referred to as a class D IPv4 address. This differs from the unicast address, where data is sent to a single host, in that it applies to a group of hosts that are associated with the multicast address ”that is, they belong to the same multicast group . A multicast address might be used for example, to distribute an online newsletter to a list of subscribed hosts, or to update mobile address books. An IPv4 multicast address is 32 bits long, like all other IPv4 addresses, but the first (leftmost) four bits are always 1110 (binary), making the first octet in the range 224 “ 239 . The remaining 21 bits make up the multicast address for a specific group. The most common multicast address used by Solaris 9 is 224.0.0.1 , which references a multicast group comprising all hosts on this subnet. The three octets ( 0.0.1 ) are mapped to the lower three octets of the ethernet multicast address for the network interface, so if your ethernet address is 08:00:20:4b:1e:52 , the ethernet multicast address will be 08:00:20:00:00:01 .
Broadcast IPv4 AddressesA broadcast address is one in which data is transmitted to all systems on the LAN at the same time, using a reserved host address for each network. In binary, the host address is all 1 s; in decimal it is 255 . The default broadcast addresses for each unicast IPv4 address type are as follows :
The broadcast address 255.255.255.255 is a special kind of broadcast address because it refers to all hosts on all networks, not just the hosts on your own particular network. Using this address is not recommended because you can flood the network with excessive, unwanted traffic, especially if a host is connected to the Internet. Subnetworks and Network MasksA network address can be subdivided into a number of smaller networks, called subnetworks. The reasons that an organization might want to do this include the following:
The /etc/inet/ netmasks FileFor any given IPv4 address, or range of addresses, it is necessary to be able to calculate the network portion of the address. The file /etc/inet/netmasks exists for this purpose, to associate IPv4 address masks with IPv4 network numbers. The entries in this file are permanent and persist across system reboots.
Each IPv4 unicast address class has a default network mask associated with it. They are as follows:
A network mask entry is 32 bits long ”the same as an IPv4 address. If you convert the network mask to binary, you will see that it consists of a number of contiguous 1 s ( 255 in decimal is equal to 11111111 in binary) followed by a number of contiguous s. It is the 1 s portion of the mask that determines the network part of the IPv4 address. You'll see that for a class C IPv4 address, the default network mask is 255.255.255.0 , indicating that the first 24 bits of the mask are 1 s and the last 8 bits are s.
The format of entries in the /etc/inet/netmasks file is: <network number> <network mask> The host portion of the address is entered as and the separator character can be spaces or tabs, so for a system with an IPv4 address of 172.16.24.56 (class B), the entry is as follows: 172.16.0.0 255.255.0.0
The /etc/inet/netmasks file is referenced when the system boots up to establish network masks for the network interfaces installed in the system. At the single user level, the startup script /etc/rcS.d/S30network.sh first references this file, and later on at run level 2, the startup script /etc/rc2.d/S72inetsvc recalculates the network mask in case a naming service is running. Subnetting a NetworkSo far, you've seen the default network masks that are assigned to the relevant classes of IPv4 addresses. Sometimes it is necessary to divide your network into a number of smaller networks. You can do so by specifying your own network mask to create a number of smaller networks with fewer hosts on each one. As an example, take the class C network 192.168.28 : The default network mask is 255.255.255.0 . Suppose you want to split this network into 16 smaller networks, each comprising 14 useable hosts (because the first address is the network itself and the last address is the broadcast address). The network mask to use to do this is 255.255.255.240 . What you're effectively doing is allocating some of the host address space to the network address. Table 4.1 shows how this network address would break down into its separate subnetworks, as well as the useable host addresses that each subnetwork creates. Table 4.1. Dividing a Class C Network Address
Note that the network address (the first address) does not end in , except for the first subnetwork, and that the broadcast address is different for each subnetwork. Each of the subnetworks created must also have its own entry in the /etc/inet/netmasks file so that the correct assignments are made when the system initiates the network interface at boot time. The /etc/inet/netmasks file now looks like this: # cat /etc/inet/netmasks # # The netmasks file associates Internet Protocol (IP) address # masks with IP network numbers. # # network-number netmask # # The term network-number refers to a number obtained from the Internet Network # Information Center. # # Both the network-number and the netmasks are specified in # "decimal dot" notation, e.g: # # 128.32.0.0 255.255.255.0 # 192.168.28.0 255.255.255.240 192.168.28.16 255.255.255.240 192.168.28.32 255.255.255.240 192.168.28.48 255.255.255.240 192.168.28.64 255.255.255.240 192.168.28.80 255.255.255.240 192.168.28.96 255.255.255.240 192.168.28.112 255.255.255.240 192.168.28.128 255.255.255.240 192.168.28.144 255.255.255.240 192.168.28.160 255.255.255.240 192.168.28.176 255.255.255.240 192.168.28.192 255.255.255.240 192.168.28.208 255.255.255.240 192.168.28.224 255.255.255.240 192.168.28.240 255.255.255.240 The action of subnetting has actually reduced the number of useable host addresses you have to 224 (from 254 when it was a single network), but you now have sixteen separate subnetworks. Variable Length Subnet Mask (VLSM)The previous section showed how a network can be divided into a number of smaller networks, but they were all the same size. Now you'll see how to divide a network into a number of smaller networks, but each will be a different size and, consequently, have a different network mask. You can divide a single network this way by using a number of network masks, known as variable length subnet masks (VLSM). Although you might wonder why anyone would want to do this, it could make much better use of the available IPv4 addresses. As an example, imagine a company with a large accounting department (for example, 125 people), a medium-sized HR department, and a medium-sized administration marketing department (for example, 60 in each). With your class C network ( 192.168.28.0 ), you can divide this network into three smaller networks, one with 126 addressable hosts and two further networks with 62 addressable hosts in each. Table 4.2 shows how this network address would break down into the three separate subnetworks, as well as the useable host addresses that each subnetwork creates. Table 4.2. Using VLSM to Divide a Class C Network Address
Each of the subnetworks created must also have its own entry in the /etc/inet/netmasks file so that the correct assignments are made when the system initiates the network interface at boot time. The /etc/inet/netmasks file now looks like this: # cat /etc/inet/netmasks # # The netmasks file associates Internet Protocol (IP) address # masks with IP network numbers. # # network-number netmask # # The term network-number refers to a number obtained from the Internet Network # Information Center. # # Both the network-number and the netmasks are specified in # "decimal dot" notation, e.g: # # 128.32.0.0 255.255.255.0 # 192.168.28.0 255.255.255.128 192.168.28.128 255.255.255.192 192.168.28.192 255.255.255.192 IP DatagramsJust as the Ethernet frame is the basic unit of transfer at the Network Interface layer of the TCP/IP model (discussed in Chapter 1, "Local Area Networks"), the IP datagram is the basic unit of transfer at the Internet layer. Figure 4.2 shows the structure of an IPv4 datagram header. Figure 4.2. IPv4 datagram header format.
The fields are as follows:
An IPv4 datagram consists of a header and some data. The data portion of the datagram can consist of a TCP segment, a UDP datagram, an ICMP message, or an IGMP message. |