Follow me on Twitter:

Networking 101: IP addresses

Posted: February 13th, 2010 | Author: charlie | Filed under: Networking 101 | Tags: , , | No Comments »

Networks don’t work without addresses: whenever you are sending something, you need to specify where it should go, and where it came from. To be an effective network engineer or administrator, you need to understand IP addresses backwards and forwards: you need to think be able to think on your feet. If something breaks, likely as not it’s some address assignment has been screwed up. And spotting the problem quickly is likely to be the difference between being the hero, or the guy who “takes a long time to fix the problem.” Before covering subnetting in the next Networking 101 installment, we’d like to thoroughly explore IP addresses in their primal form. This is crucial to understanding subnets.

IPv4 Addresses and 32-bit Numbers
IP addresses are just 32-bit binary numbers, but they’re important binary numbers: you need to how to work with them. When working with subnet masks, new network administrators generally get confused with the ones they haven’t memorized. All the subnet mask amounts to is moving the boundary between the part of the address that represents a “network” and the part that represents a “host.” Once you’re comfortable with this method of thinking about IP addresses and masks, you’re mastered IP addressing.

Binary is quite simple. In binary the only numbers are zeros and ones, and a 32-bit number holds 32 zeros and ones. We’re all used to base-10 numbers, where each place in a number can hold any number from 0-9. In binary each place holds either a zero or a one. Here’s the address 255.255.255.0 in binary:

11111111.11111111.11111111.00000000

For convenience, network engineers typically break IP addresses into four 8-bit blocks, or octets. In an 8-bit number, if all of the bits are set to 1, then the number is equal to 255. In the previous address, 11111111 represents 255 and 00000000 represents zero.

The way binary really works is based on powers of two. Each bit represents a different power-of-two. Starting at the left-hand side, the most significant bit, numbers form in the following manner:

Power-of-two232...2726252423222120
Decimal4,294,967,296...1286432168421

The result is additive, meaning that if all bits are set, you simply add the power-of-two value up for each place. For example, if we have an 8-bit number, 11111111 , we simply add: 27 + 2 6 + 2 5 + 2 4 + 2 3 + 2 2 + 2 1 + 2 0 = 255

Try a non-trivial example now: 11110000

We can see that four bits are “set” in the above 8-bit number. Summing the power-of-two values in those places yields: 27 + 26 + 2 5 + 2 4 = 240

It is just that simple. If you can convert a binary number to decimal form, you can easily figure out subnet masks and network addresses, and we’ll show you how in the next issue of Networking 101.

Focusing on 32-bit IPv4 addresses themselves now, there are a few different types that need to be understood. All IP addresses can be in the range 0.0.0.0 to 255.255.255.255, but some have special uses.

Loopback:
Packets that will not leave the host–i.e. they will not traverse an external network interface. Example: 127.0.0.1

Unicast:
Packets that are destined for a single IP address. Example: 2.2.2.2

Multicast:
Packets that will be duplicated by the router, and eventually routed by multicast routing mechanisms. Example: 226.0.0.2

Limited Broadcast:
A broadcast packet, sent to every host, limited to the local subnet. Example: 255.255.255.255

Directed Broadcast:
Packets that are routed to a specific subnet, and then broadcast. Example, assuming we are not on this subnet: 1.1.1.255

There are also some special cases of IP addresses, including private and multicast addresses. Addresses in the range 224.0.0.0 – 239.255.255.255 are reserved for multicast. Everything below that range is fair game on the Internet, excluding addresses reserved by RFC 1918 and a few other special-purpose assignments. These “1918 addresses” are private addresses, meaning Internet routers will not route them. The ranges include:

  • 10.0.0.0 -10.255.255.255
  • 172.16.0.0 – 172.31.255.255
  • 192.168.0.0 – 192.168.255.255

These IP addresses can be assigned locally to as many computers as you want, but before those computers access the Internet, the addresses must be translated to a globally routable address. This is commonly done via Network Address Translation ( NAT ). The 1918 addresses aren’t the only reserved spaces, but they are defined to be “site local.” Multicast also has a reserved range of addresses that aren’t designed to escape onto the Internet: 224.0.0.0 – 224.0.0.255 are multicast “link-local” addresses.To give the necessary background for the next issue of Networking 101, we need to make sure everyone understands the concept of a local subnet. Once we have assigned a valid IP address to a computer, it will be able to speak to the local network, assuming the subnet mask is configured properly. The subnet mask tells the operating system which IP addresses are on the local subnet and which are not. If an IP we wish to talk to is located on the local subnet, then the operating system can speak directly to it without using the router. In other words, it can ARP for the machine, and just start talking. IP address and subnet mask configuration is fairly straightforward for general /24 networks. The standard 255.255.255.0 mask means that the first three octets are the network address, and the last part is reserved for hosts. For example, a computer assigned the IP of 10.0.0.1 and a mask of 255.255.255.0 (a /24, or 24-bits if you write it out in binary) can talk to anyone inside the range 10.0.0.1-10.0.0.255.Be sure to digest everything here, because in part two we’ll get to the meat of subnetting with CIDR.


No Comments yet... be the first »

Related posts:

  1. Networking 101: Subnetting – Slice Up 32-bits
  2. Networking 101: More Subnets, and IPv6
  3. Networking 101: Understanding Layers
  4. Networking 101: Layer 2, Link and Spanning Tree
  5. Are Cisco Flex Links the End of STP?


Leave a Reply

  • Powered by WP Hashcash