Networking - Linux Administration (2016)

Linux Administration (2016)

Networking

In this chapter, you will learn about the TCP/IP protocol and the most important aspects of IP networking. You'll also be introduced to network classes and classful networks. Additionally, you'll be learning about subnet masks and broadcast addresses. Next you'll learn about classless interdomain routing and, finally, you'll learn what IP addresses are meant to be used on private networks.

Today, TCP/IP is the de facto standard for transmitting data over networks. TCP/IP stands for Transmission Control Protocol (TCP) and Internet Protocol (IP). TCP is responsible for establishing and maintaining network conversations so that two devices can exchange data. The Internet Protocol is responsible for sending data from one device to another device on a network. Each one of these network devices is known as a host and has at least one IP address.

For a device on a network to communicate properly, it needs three pieces of information: an IP address, a subnet mask, and a broadcast address. Each one of these numbers is comprised of four octets separated by a dot. An octet represents eight-bits and therefore can have a value starting at 0 and going up to 255.

Example IP Address: 199.83.131.168

Example Subnet Mask: 255.255.255.0

Example Broadcast Address: 199.83.131.255

In the example IP Address of 199.83.131.186, the first octet contains a value of 199, the second octet is 83, the third octet is 131, and the last octet is 186.

IP addresses are comprised of two parts. The first part of an IP address is the network address and the second part is the host address. The network portion of the IP address tells routers what network the host belongs to and thus where to route data that is destined for that host. The host address tells routers the specific device that the data should be sent to. For routing to work properly, each group of devices, or network, needs to have a unique network address. Also, each device within that network needs to have a unique host address.

The class of an address determines what portion is used as the network address and what portion is used for host addresses.

Class

Network

Hosts Allowed

A

1 -> 127

Ex: 17.24.88.9

16,777,216

B

128.0 -> 191.255

Ex: 183.194.46.31

65,536

C

192.0.0 -> 233.255.255

Ex: 199.83.131.186

255

By looking at the first octet of an IP address, you can tell what class it is. An IP address with a first octet that falls between 1 and 127 is a class A IP address. For example, the IP address 17.24.88.9 belongs to a class A network. Class B addresses begin with 128.0 and end at 191.255. For example, 183.194.46.31 belongs to a class B network. Class C addresses start with 192.0.0 and end with 233.255.255. An example IP address that belongs to a class C network is 199.83.131.186.

A class determines the possible number of networks and the addressable space per network. For example, a Class A network can accommodate about 16 million host addresses. A Class B network can have up to 65,536 hosts in it, and a class C network can address 255 hosts.

The following table lists the subnet mask used for each of the network classes. The network portion of an IP address corresponds to the 255s in the subnet mask. For example, the first octet of a Class A network is the network portion while the three remaining octets are the host portion. For Class B networks, the first two octets are for network addresses while the last two octets are for host addresses. Finally, Class C networks use the first three octets for the network and just the last octet for the host addresses.

Class

Subnet Mask

A

255.0.0.0

B

255.255.0.0

C

255.255.255.0

Let's take the IP address 183.194.46.31 as an example. That particular IP address is in a class B network since it falls in the range of 128.0 to 191.255. The network port of the address is 183.194 and the host portion is 46.31.

Netmask

255

255

0

0

IP Address

183

194

46

31

The netmask is listed right above the IP address so you can see how the network portion aligns with the 255 values and the host portion aligns with the 0 values.

A broadcast address is a special logical address used to send data to all hosts on a given network. In addition to their own IP addresses, all network hosts receive data sent to the broadcast address. You can quickly determine the broadcast IP address by using the value 255 in the octets where there are 0's in the subnet mask. The following table lists a few examples. For the class A network of 17.0.0.0 that uses a netmask of 255.0.0.0, the broadcast address is 17.255.255.255. The next two examples follow the same pattern as you might expect. The Class B network employs the default 255.255.0.0 subnet mask and the Class C network uses a 255.255.255.0 subnet mask.

Class

Network

Subnet Mask

Broadcast

A

17.0.0.0

255.0.0.0

17.255.255.255

B

183.194.0.0

255.255.0.0

183.194.255.255

C

199.83.131.0

255.255.255.0

199.83.131.255

Classless Inter-Domain Routing

CIDR stands for Classless Inter-Domain Routing. It allows networks to be subdivided regardless of their traditional class. These subdivided networks are called subnets. For example, the IP address 121.67.198.94 falls in the Class A network range. By default, the network is 121.0.0.0, the subnet mask is 255.0.0.0, and the broadcast address is 121.255.255.255. However, if you specify a subnet mask, you can alter the portion of the IP address that is used as the network and the portion that is used as the host address. By specifiying a 255.255.255.0 subnet with the 121.67.198.94 adress, the network becomes 121.67.198.0 and the broadcast address becomes 121.67.198.255.

Reserved Private Address Space

There are ranges of IP addresses that are dedicated for use in private networks. You'll often see these types of IP addresses being used in your company's internal network and you'll most likely being using a range of these IP addresses for your home network as well.

These private addresses are also called non-routable IPs since they are not routed through the public Internet. You'll also hear these IP addresses referred to as RFC1918 address, which refers to the RFC1918 standards document where these private ranges were initially defined.

As you can see in the following table, there is a dedicated range of non-routable private address space for each network class. Keep in mind that you can subnet these networks however you like, regardless of their associated traditional class.

Class

Range

Private Address Space

A

1.0.0.0 - 127.255.255.255

10.0.0.0 - 10.255.255.255

B

128.0.0.0 - 191.255.255.255

172.16.0.0 - 172.31.255.255

C

192.0.0.0 - 233.255.255.255

192.168.0.0 - 192.168.255.255

Summary

In this chapter, you learned how the TCP/IP protocol is the defacto standard of transmitting data over a network. You also learned about Class A, B, and C networks. You learned about the default subnet masks and broadcast addresses used by the various network classes. You also learned that you can specify a subnet mask to divide larger networks into smaller ones called subnets. Finally, you learned what IP ranges are dedicated for use in private networks and how these IP address are not routed over the public Internet.

Quiz

1. 257.19.21.228 is a valid IP address.

1. True

2. False

2. Given an IP address of 199.83.131.0 and a subnet mask of 255.255.255.0, what is the broadcast address?

1. 199.83.131.0

2. 199.83.131.1

3. 199.83.131.255

4. 199.255.255.255

3. Which of the following IP addresses does not fall within a private address range?

1. 10.11.12.13

2. 11.12.13.14

3. 172.16.255.255

4. 192.168.1.100

Quiz Answers

1. B

2. C

3. B