In: Categories » » Ethernet » A computer that uses the Internet Protocol must have an IP address
A computer that uses the Internet Protocol must have an IP address. A network administrator may manually assign an IP address to each computer or the network may have a way of assigning addresses automatically to computers that connect to the network. An IPv4 address is 32 bits. As explained earlier in this networking tutorial, the conventional way to express an IP address is in dotted-quad format, such as 192.168.111.1.
Assigning Addresses
Each IP datagram includes the IP addresses of the datagram’s source and destination. A computer’s IP address must be unique within the network or networks that the computer can communicate with. In a local network with no direct connection to other networks, the address only needs to be different from the other addresses in the local network. In theory an isolated local network could use any IP addresses, but the IP standard reserves three blocks of addresses for local use. For communicating over the Internet, the address must be different from the address of every other computer on the Internet. As described earlier in this networking tutorial, the network administrator typically obtains the right to use one or more IP addresses from the ISP that supplies the network’s Internet connection. An ISP in turn obtains the right to use addresses via a system that involves a variety of organizations that manage the allocating and assigning of addresses. At the top is the Internet Corporation for Assigned Names and Numbers (ICANN), at www.icann.org. ICANN is a non-profit corporation that manages the top-level assigning and allocating of IP addresses. ICANN also manages the Internet’s domain name system, the root server system that supports the domain name system, and the assigning of numbers to Internet protocols. Under ICANN are several regional registries that manage the assigning and allocating of IP addresses in specific geographic areas. For example, the American Registry for Internet Numbers (ARIN) at www.arin.net allocates and assigns Internet addresses in North and South America and a few other areas. The regional registries assign and allocate addresses to some large end users and Internet Service Providers (ISPs). The ISPs may in turn assign some of their allocated addresses to end users and may allocate blocks of addresses to other ISPs, who may assign and allocate their addresses, and so on down the line.
The Network Address and Host Address
Each IP address has two parts: a network address, which is the same for all of the interfaces in the network, and a host address, which is unique to the interface within the network. The leftmost bits of the IP address are the network address and the rightmost bits are the host address. Routers use network addresses to help in determining where to forward received datagrams. The hosts in a local network are generally located near each other physically. So a router can have a table entry that tells the router to forward all datagrams directed to a specific network address to a router that is physically closer to the network. Without network addresses, routers would have to have a separate entry for each IP address, which would quickly become unmanageable. The number of bits allocated to the network address and host address depends on the network’s size.
A network with a 24-bit network address and 8-bit host addresses can have up to 254 hosts. (Host and network addresses of all zeros or all 1s have special meanings and can’t be assigned to individual hosts or networks.) A network with an 8-bit network address and 24-bits host addresses can have over 2 million hosts. To keep from running out of available IP addresses, network addresses should be as long as possible while still enabling every host on the Internet to have a unique host address. If every network had an 8-bit network address, there could be no more than 254 networks on the Internet. But if every network had a 24-bit network address, each network could have no more than 254 hosts. There are two protocols for assigning network addresses on the Internet. The original protocol, called classful addressing, defines three network classes with network addresses of 8, 16, and 24 bits. By examining the first three bits of the IP address, a router can determine what class of network the host belongs to, and thus how many bits make up the network address. Many networks with classful addressing are also divided into subnetworks, or subnets. For each subnet, the routers in the local network store an additional 32-bit value called the subnet mask, which enables routers to determine which subnet a datagram is directed to. A newer, more flexible and efficient alternative to classful addressing is classless addressing, where a network address can be any number of bits. A value called the IP prefix, or network prefix, specifies the number of bits in the network address. Routers that support classless addressing use the IP prefixes in determining where to forward datagrams.
Classful Addressing
Table 4-2 shows the five network classes defined by RFC0791 for classful addressing. The most significant bits of an IP address indicates the class of the network the host belongs to and how many bytes make up the network address. You can identify the class from the decimal value of the first byte or from the binary value of the few most significant bits. In a Class A network, the first byte is between 1 and 126, and the most significant bit is 0. The network address is 1 byte, leaving three bytes for the host address. There can be up to 126 Class A networks. In a Class B network, the first byte is between 128 and 191, and the two most significant bits are 10. The network address is 2 bytes, leaving two bytes for the host address. There can be up to 65,534 Class B networks. In a Class C network, the first byte is between 192 and 223, and the three most significant bits are 110. The network address is 3 bytes, leaving 1 byte for the host address. There can be up to 16,777,214 Class C networks. In a Class D network, the first byte is between 224 and 239, and the four most significant bits are 1110. Class D networks are reserved for multicasting, described later in this networking tutorial. In a Class E network, the first byte is between 240 and 255, and the four most significant bits are 1111. Class E is reserved for future use.
Using Subnets
Subnetting is the process of dividing a network into groups called subnetworks, or subnets. The hosts within a subnet are typically physically near each other and may belong to the same department or facility within an organization. In the same way that routers use network addresses to decide where to route traffic on the Internet, routers can use subnet IDs to decide where to route traffic within a network.
A small, isolated local network doesn’t have to concern itself with subnets. A large local network might use subnets for easier routing of messages. A public IP address obtained from an ISP is likely to be in a subnet, so even if your embedded system is in a small network, if the system connects to the Internet, the public IP address is likely to be in a subnet. Besides helping in routing, subnetting helps to solve the shortage of available network addresses. With only three general-purpose network classes, many organizations requesting network addresses would have to request much larger blocks of addresses than needed. For example, a network of 300 hosts is too large for Class C, but with a Class B address, tens of thousands of addresses would be unused. With subnets, a 300-host network can reserve a portion of a Class B network, leaving the remaining addresses for other subnets. In a subnet, the host-address portion of an IP address has two parts: a subnet ID and a host ID. The subnet ID is the same for all hosts in the subnet, while each host ID is unique in the subnet. The network-address portion of the IP address is the same for all of the hosts in all of the subnets in the network. A subnet ID can be any combination of bits in the host-address portion of the IP address, but in practice it’s almost always the most significant bits. Network article 4-9 shows an example. Three Ethernet networks are subnets in a Class B network. A hub in each subnet connects to a router that enables the computers in the subnets to communicate with computers in other subnets and on the Internet. In each of the IP addresses, the first two bytes (172.16) are the network address, the third byte is the subnet ID (1, 2, or 3), and the fourth byte is the host ID. A subnet ID may use any number of the bits in the host address. For example, a Class C network that uses four bits for the subnet mask can have up to 14 subnets (24-2) and each subnet can have up to 14 hosts. As explained earlier, you can determine how many bits of an IP address are the network address by examining the most significant bits in the address.
The Subnet Mask
Determining which bits in the host address are the subnet ID requires using a 32-bit value called the subnet mask.
In the subnet mask, the bits that correspond to the bits in the network address and the subnet ID are ones, and the bits that correspond to the bits in the host ID are zeros. For example, in a Class B network, two bytes are the network address and two bytes are the host address. The subnet mask for a Class B network with eight bits of subnet ID is: 255.255.255.0 With eight bits of subnet ID, the network can have up to 254 subnets, and each subnet can have up to 254 hosts. In a similar way, the subnet mask for a Class C network with four bits of subnet ID is: 255.255.255.240 (Decimal 240 equals binary 11110000.) Program code can use the subnet mask to determine if a destination address is in the same subnet. To do so, perform a logical AND of the destination address and the subnet mask and compare the result to a logical AND of the host address and the subnet mask. If the values match, the destination is in the same subnet.
legal notice
Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.
Useful tools and features
related articles
EDTP Electronics Packet Whacker At a glance: An Ethernet interface on a circuit board with headers for connecting to a CPU. Typical use: adding Ethernet to any microcontroller circuit. Ethernet support: 10BASE-T Source: EDTP Electronics (www.edtp.com) Hardware. The Packet Whacker (Network article 3-11) from EDTP Electronics is an Ethernet interface only. The circuit board contains a Realtek RTL8019AS Ethernet controller, an RJ-45 connector, two headers that bring out the si...
2. NE2000 Compatibility
NE2000 Compatibility A term you’re likely to hear in reference to program code for network controllers is NE2000-compatible. The NE2000 was an early and popular PC network interface card from Novell. The card contained National Semiconductor’s DP8390 controller. Software for systems that use the ’8390 or a compatible chip has come to be known as NE2000-compatible code. A major feature of the ’8390 is its set of internal registers. By reading and writing to the registers, a CPU can c...
3. Using the Internet Protocol in Local and Internet Communications
The protocols in the IEEE 802.3 Ethernet standard enable the computers in a local network to exchange messages with each other. In practice, most Ethernet networks also use Internet protocols such as TCP or UDP and IP. These provide defined and well-supported methods for accomplishing common tasks such as flow control and flexible addressing and routing of messages. Messages that travel on the Internet must use IP. And because TCP and UDP are designed to work along with IP, local communications that use TCP or UDP also use...
4. There are several options for obtaining an Internet connection
Technologies for Connecting There are several options for obtaining an Internet connection. A long-popular way for home users to connect to the Internet is via dial-up connections on phone lines. For higher speeds, alternatives are a Digital Subscriber Line (DSL), an Integrated Services Digital Network (ISDN) line, or a cable modem. Satellite connections are also possible. Table 4-1 compares the capabilities of the different methods. Not every connection type is available in all locations. Depending on ...
5. Every computer that communicates over the Internet must have an IP address
Static and Dynamic IP Addresses Every computer that communicates over the Internet must have an IP address, which the computer typically receives from its ISP. The IP address may be static or dynamic. A static IP address stays the same until someone explicitly changes it, while a dynamic IP address can change on every boot up or network connect (though the address typically changes only occasionally). An embedded system may store a static IP address in non-volatile memory, either within an application...
6. Obtaining and Using a Domain Name
Obtaining and Using a Domain Name After you obtain Internet access, connect your embedded system to the Internet, and configure your firewall to enable the embedded system to communicate, the system is ready to send and receive messages on the Internet. Applications running on other computers on the Internet can access the embedded system by specifying its public IP address. For example, to view a server’s home page, in the Address text box of a Web browser, you enter http:// followed by the server&rsquo...
7. Inside the Internet Protocol
The Internet Protocol (IP) helps data find its way to its destination even if the data must travel through other networks, including the many and varied networks that make up the Internet. Although it’s called the Internet Protocol, local networks can use IP as well. Many communications in local networks use IP because they use its companion protocols, TCP and UDP. This section introduces IP, including how computers obtain IP addresses, the format of IP datagrams, how IP and the domain name system help in getti...
8. With classless addressing the network address and IP prefix
Classless Addressing With classless addressing, the network address and IP prefix are often expressed in the form: xxx.xxx.xxx.xxx/n where xxx.xxx.xxx.xxx is the lowest IP address in the network and n is the number of bits in the network-address portion of the IP address. For example, with a network address and IP prefix of 192.0.2.0/24, the network address is 192.0.2 (three bytes, or 24 bits), and the final eight bits in the IP address are the host address. In routing datagrams for addresses that us...
9. Considerations when Using Dynamic IP Addresses
Dynamic Allocation One thing that automatic allocation doesn’t define is a way to reclaim addresses that are no longer in use. Reclaiming addresses is essential in networks that have more potential hosts than available IP addresses. For example, the hosts connected to an ISP at any one time will vary as different customers go on and off line. If the ISP assigns a permanent, or static, address to every computer that connects, it will eventually run out of addresses, even if only a few customers connec...
10. Hosts that support IP must also support the ICMP
The Internet Control Message Protocol (ICMP) Hosts that support IP must also support the Internet Control Message Protocol (ICMP) defined by RFC 792: Internet Control Message Protocol. ICMP is a basic protocol for sending messages. Some common uses for ICMP are to send a PING message to learn if a host is available on the network and to obtain the IP addresses of local routers. ICMP messages travel in IP datagrams. The Protocol field in the IP header is 1 to indicate ICMP. The first byte in the data portion of...
