Monday, December 19, 2016

Networks VI

How IPv4 Addresses Work



Every host on an IP-based network must have a unique IP address. An IP
address is a Network layer (3) address that is logically assigned to a
network host. Because the IP address is a logical address, it’s not
permanent. It can be changed at any time.




The IP address is different from the MAC address. The MAC address is a
Data Link layer (2) hardware address that is burned into a ROM chip on
every network board sold in the world. The MAC address is hard-coded
and can’t be changed.



NOTE The Address Resolution Protocol (ARP) is used to map logical IP
addresses assigned to systems to their hard-coded MAC addresses.



An IP address consists of four numbers, separated by periods. Examples
of valid IP addresses include


• 12.34.181.78
• 192.168.1.1
• 246.270.3.8


NOTE   IPv4 addresses are sometimes called “dotted quad” addresses.




In decimal notation, each number must be between 0 and 255. For
example, 192.168.1.1 is a valid IP address. Here are some examples of
invalid IP addresses:



• 256.78.1.3    Can’t use a value greater than 255 

• 10.3.4        Must use four values



Each number in the address is actually an eight-bit binary number
called an octet. Because each octet is a binary number, it can be
represented as 0’s and 1’s. For example, the address 192.168.1.1 can
be represented in binary form as



11000000.10101000.00000001.00000001



There are several simple ways to convert between the eight-bit binary
address and the three- digit decimal version of an IP address. One
option is to use the calculator software that comes with most Linux
distributions (and even Windows) in Scientific mode. To convert a
decimal IP address number to binary, enter the decimal version and
then click the Bin option.




You can also go the other direction by entering a binary number in Bin
mode and then switching to Dec mode, which will convert the binary
number to its decimal equivalent.




If you’re the mathematical type, you can also perform the conversion
manually. Use the following to determine the value of each bit in a
binary number:



• Bit 1 = 128
• Bit 2 = 64
• Bit 3 = 32
• Bit 4 = 16
• Bit 5 = 8
• Bit 6 = 4
• Bit 7 = 2
• Bit 8 = 1



For example, 11000000 = 128 + 64 = 192.



Some IP addresses are reserved and can’t be assigned to a host. For
example, the last octet in a host IP address can’t be a 0. This is
reserved for the address of the network segment itself that the host
resides on. For example, the network address for the host assigned an
IP address of 192.168.1.1 is 192.168.1.0.




In addition, the last octet of an IP address assigned to a host can’t
be 255. This is reserved for sending a broadcast to all hosts on the
segment. In the preceding example, the broadcast address for a host
with an IP address of 192.168.1.1 would be 192.168.1.255.




It’s critical that you understand that every host on an IP-based
network must have a unique IP address assigned to it. No two hosts on
the same IP network can have the same IP address assigned. If the host
resides on a public network, such as the Internet, it must use a
globally unique IP address. You can apply to the Internet Assigned
Numbers Authority (IANA) for a block of registered IP addresses. Once
an IP address is assigned, no one else in the world can use it on a
public network.




This actually introduces a key problem with IP version 4. The 32-bit
addressing scheme used by IPv4 allows for a maximum of four billion
possible unique addresses. This seemed like a lot of addresses back
when IPv4 was originally defined. However, today this finite amount of
available addresses has been almost completely allocated.





One way to get around this shortage of IPv4 addresses is to use
private networks with network address translation (NAT). With network
address translation, you can use a NAT router to present a single
registered IP address to a public network while using private IP
addresses on the network behind it. This is shown in Figure 15-3.




Using a NAT router has many advantages. Key among these is the fact
that you can hide a huge private network behind a public interface (or
a couple of public interfaces). This allows a large organization to
implement its network and only need a relatively small number of
globally unique public IP addresses.




Within each class of IP address are blocks of addresses called private
or reserved IP addresses. These addresses are unallocated and can be
used by anyone who wants to use them. This allows you to use private
addresses on your local network and still be able to connect to public
networks, such as the Internet. All traffic from your private network
appears to be originating from the registered IP address configured on
the public side of the NAT router.



The private IP address ranges are


10.0.0.0 – 10.255.255.255 (Class A)
172.16.0.0 – 172.31.255.255 (Class B)
• 192.168.0.0 – 192.168.255.255 (Class C)



These are nonroutable addresses, meaning that if you try to use them
on a public network, such as the Internet, IP routers won’t forward
data to or from them. This is handled by network address translation
to a public IP address by a NAT router. This allows anyone in the
world to use these private IP address ranges without worrying about
conflicts, even if multiple instances are used. NAT makes this all
possible!




In addition to assigning an IP address, you also need to assign a
subnet mask when configuring the IP protocol on a Linux system.






LX0-104 Exam Objectives (R)

No comments:

Post a Comment