IP Addresses


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 Addresses

An 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:

  • Class A ” Used for the largest networks, it permits 16,777,214 addressable hosts. In a class A network, the first eight bits of the IPv4 address define the network portion, and the first (leftmost) bit is always (binary). This produces 128 possible class A networks (1 “127), although the 127.0.0.0 network cannot be used because this contains the reserved loopback address ( 127.0.0.1 ). The remaining 21 bits are used to identify the hosts. An example of a class A IPv4 address is 47.20.16.8 (the network is 47 and the host is 20.16.8 ).

  • Class B ” Used for large-and medium- sized networks, it permits 65,534 addressable hosts. In a class B network, the first sixteen bits of the IPv4 address define the network portion, and the first two (leftmost) of these bits are always 10 (binary). This produces 16,384 class B networks (128 “191). The remaining sixteen bits are used to identify the hosts. An example of a class B IPv4 address is 145.212.8.15 (the network is 145.212 and the host is 8.15 ).

  • Class C ” Used for smaller networks, it permits 254 addressable hosts. In a class C network, the first 24 bits of the IPv4 address define the network portion, and the first three (leftmost) of these bits are always 110 (binary). This produces 2,097,152 class C networks (192 “223). The remaining 8 bits are used to identify the hosts. An example of a class C IPv4 address is 215.156.18.185 (the network is 215.156.18 and the host is 185 ).

graphics/alert_icon.gif

The IANA (Internet Assigned Numbers Authority) reserved a range of IPv4 addresses in each class for private networks that will not be connected to the Internet. These networks have no routing established and can be used by private individuals or companies for their local networks. The ranges of private IPv4 addresses are defined in RFC 1918. The reserved addresses are

  • Class A 10.0.0.0 10.255.255.255

  • Class B 172.16.0.0 172.31.255.255

  • Class C 192.168.0.0 192.168.255.255


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.

graphics/04fig01.gif

graphics/alert_icon.gif

For each IPv4 network address that is assigned, without respect to its class, both the first and last host addresses are reserved and cannot be used as operational IPv4 addresses because they represent the network itself (the first address) and the broadcast address (the last address). For example, if you are assigned the network 192.168.28 , then the address 192.168.28.0 is the network itself and 192.168.28.255 is the default broadcast address. This is why a class C network address, for example, permits only 254 addressable hosts, instead of the 256 that you might expect from eight bits.


Multicast IPv4 Addresses

A 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 .

graphics/alert_icon.gif

There is a class E IPv4 address type where the first octet is 240 or above. This address class is currently reserved and cannot be assigned for normal use on a Solaris system.


Broadcast IPv4 Addresses

A 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 :

  • Class A ” The leftmost octet identifies the network address, for example 10 . The default broadcast address for this network is 10.255.255.255 .

  • Class B ” The leftmost two octets identify the network address, for example 172.16 . The default broadcast address for this network is 172.16.255.255 .

  • Class C ” The leftmost three octets identify the network address, for example 192.168.1 . The default broadcast address for this network is 192.168.1.255 .

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 Masks

A 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:

  • To provide additional security by limiting access to a particular subnetwork of hosts

  • To make better, more effective use of the assigned IPv4 address range

  • To divide administrative domains into smaller logical units

  • To reduce the network traffic by isolating subnetworks

  • To associate a subnetwork with a specific organizational department, based on geographical location, or function within the organization

The /etc/inet/ netmasks File

For 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.

graphics/alert_icon.gif

Entries in /etc/inet/netmasks are normally in decimal dot notation. Even though you can specify the network mask in hexadecimal (for example ffffff00 ) by using the ifconfig command, you must prefix hexadecimal addresses with 0x when making permanent entries in this file. You might be asked about the format of entries in the /etc/inet/netmasks file.


Each IPv4 unicast address class has a default network mask associated with it. They are as follows:

  • Class A ” Default network mask is 255.0.0.0 .

  • Class B ” Default network mask is 255.255.0.0 .

  • Class C ” Default network mask is 255.255.255.0 .

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.

graphics/note_icon.gif

You can assign a network mask that does not consist of contiguous 1 s, such as 255.255.254.128 ( 11111111 11111111 11111110 10000000 in binary), but this is not normally done because it increases the complexity of administering the network address space.


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 
graphics/alert_icon.gif

The file /etc/netmasks is a symbolic link to /etc/inet/netmasks and is included for Berkeley Software Distribution (BSD) compatibility. The actual file is /etc/inet/netmasks ; be aware of this because it is a frequent exam question.


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 Network

So 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

Network Address

Addressable Hosts Range

Broadcast Address

Network Mask

192.168.28.0

192.168.28.1 “192.168.28.14

192.168.28.15

255.255.255.240

192.168.28.16

192.168.28.17 “192.168.28.30

192.168.28.31

255.255.255.240

192.168.28.32

192.168.28.33 “192.168.28.46

192.168.28.47

255.255.255.240

192.168.28.48

192.168.28.49 “192.168.28.62

192.168.28.63

255.255.255.240

192.168.28.64

192.168.28.65 “192.168.28.78

192.168.28.79

255.255.255.240

192.168.28.80

192.168.28.81 “192.168.28.94

192.168.28.95

255.255.255.240

192.168.28.96

192.168.28.97 “192.168.28.110

192.168.28.111

255.255.255.240

192.168.28.112

192.168.28.113 “192.168.28.126

192.168.28.127

255.255.255.240

192.168.28.128

192.168.28.129 “192.168.28.142

192.168.28.143

255.255.255.240

192.168.28.144

192.168.28.145 “192.168.28.158

192.168.28.159

255.255.255.240

192.168.28.160

192.168.28.161 “192.168.28.174

192.168.28.175

255.255.255.240

192.168.28.176

192.168.28.177 “192.168.28.190

192.168.28.191

255.255.255.240

192.168.28.192

192.168.28.193 “192.168.28.206

192.168.28.207

255.255.255.240

192.168.28.208

192.168.28.209 “192.168.28.222

192.168.28.223

255.255.255.240

192.168.28.224

192.168.28.225 “192.168.28.238

192.168.28.239

255.255.255.240

192.168.28.240

192.168.28.241 “192.168.28.254

192.168.28.255

255.255.255.240

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

Network Address

Addressable Hosts Range

Broadcast Address

Network Mask

192.168.28.0

192.168.28.1 “192.168.28.126

192.168.28.127

255.255.255.128

192.168.28.128

192.168.28.129 “192.168.28.190

192.168.28.191

255.255.255.192

192.168.28.192

192.168.28.193 “192.168.28.254

192.168.28.255

255.255.255.192

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 Datagrams

Just 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.

graphics/04fig02.gif

The fields are as follows:

  • Protocol version ” The IP version number, currently 4.

  • Header length ” The length (in 32-bit words) of the IPv4 datagram header. The header length is always a minimum of 5 words (20 bytes), but because of the field's 4-bit length, there is a maximum of 15 words (60 bytes).

  • Type of service ” This field consists of a 3-bit precedence field, which is ignored, a 4-bit service field, and an unused bit. The service bits indicate the quality of service, with four possible values:

    • 1000 ” Minimize delay

    • 0100 ” Maximize throughput

    • 0010 ” Maximize reliability

    • 0001 ” Minimize monetary cost

    Not all implementations support this field, but some have additional information in the routing table to indicate delay, throughput, reliability, and monetary cost.

  • Total length ” The total length of the datagram, including the data (in bytes). The header length is already known from the header length field, so the data length can be known by calculating total length header length . The maximum total length of an IPv4 datagram is 65,535 bytes.

  • Identifier ” This field is a 16-bit identification field. If a datagram is fragmented into a number of frames , then the same identifier is used so that the fragments can be correctly reassembled at the destination.

  • Flags ” This 3-bit field consists of an unused bit and two flag fields, DF and MF . The DF bit (Do not Fragment), if set, is an instruction to routers not to fragment the data, normally because the destination is not able to reassemble the pieces. The MF bit (More Fragments) is set when there are more fragments to follow. Only the last fragment will see this bit set to .

  • Fragment offset ” This 13-bit field identifies the location of the fragment in the IPv4 datagram.

  • Time to live ” The maximum number of routers through which the datagram can pass. Each router decrements the value by one until it reaches zero, when it is discarded. TCP sets this value by default to 64 , whereas UDP sets it to 255 . You can see the current values by using the ndd command as shown here:

    • The TCP value:

       #ndd /dev/tcp tcp_ipv4_ttl 64 
    • The UDP value:

       #ndd /dev/udp udp_ipv4_ttl 255 
  • Protocol ” This field identifies the Transport layer protocol to which the datagram should be delivered. A value of 6 indicates TCP, whereas a value of 17 indicates UDP. These values are listed in the protocols file ” /etc/inet/protocols .

  • Header checksum ” This field verifies the integrity of the datagram header to ensure it has not become corrupted. Note that the checksum applies to only the header and does not include the data.

  • Source IP address ” The IPv4 address of the system sending the datagram.

  • Destination IP address ” The IPv4 address of the final destination system that will receive the datagram.

  • Options ” This field contains optional information and may not always be present. This field can contain five options and will always end on a 32-bit boundary, using padding if necessary:

    • Security ” Specifies the datagram's security level.

    • Strict source routing ” Specifies the entire path to be followed.

    • Loose source routing ” Specifies a list of routers that must not be missed.

    • Record route ” Specifies that each router must append its own IP address.

    • Timestamp ” Specifies that each router must append its own IP address and also append a timestamp.

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.



Solaris 9 Network Administration Exam Cram 2 (Exam Cram CX-310-044)
Solaris 9 Network Administrator Exam Cram 2 (Exam CX-310-044)
ISBN: 0789728702
EAN: 2147483647
Year: 2003
Pages: 174
Authors: John Philcox

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net