Computing Topics --> Definitions --> TCPIP -- Background on IP Addresses, Gateways, and Subnet Masks -->

TCPIP -- Background on IP Addresses, Gateways, and Subnet Masks

Your Network Numbers

  • IP Address

    To determine your IP address, you can use the Network Operations Center's Data Jack Lookup page. When you put in the building number and wallplate number, information will be returned about the status of the walljack and the IP address associated with it.

  • Subnet Mask

    On campus, we have IP addresses beginning in 129.2 and 128.8 . The subnet masks may be different for these two; those addresses beginning in 129.2 always use a 7-bit subnet mask (255.255.254.0), while those addresses beginning in 128.8 might be using a 7-bit or an 8-bit subnet mask ( 255.255.255.0). Older 128.8 addresses will be using an 8-bit subnet mask, but newer ones might be using the 7-bit subnet mask. Consult the information page sent out from NI about the walljack to be sure.

  • Gateway (Router) -- Once you have determined the subnet mask, you can use it to figure out the gateway (router) address:

    For an 8-bit subnet mask
    Take the first 3 sets of numbers of the IP address, and replace the last set with a 1. So 128.8.4.34 would have a gateway address of 128.8.4.1 .

    For a 7-bit subnet mask
    This is a bit trickier. Take the first 2 sets of numbers as is from the IP address, but if the third set of numbers is ODD, round down to the next even number. If it's EVEN, keep the number from the IP address. Replace the last set of numbers with a 1. So 129.2.5.123 and 129.2.4.27 both have a gateway address of 129.2.4.1 .

More Technical Information

IP addresses are specified as 4 8-bit numbers. For example, oberon.umd.edu has the numeric IP address 129.2.4.185.

These addresses are assigned via a two-step process. First, an institution or company applies for a domain. They are assigned a domain based on how many computers they expect to connect to the internet. There are three classes of networks: class A, class B, and class C.

  • Class A users are assigned 1 8-bit number, such as 129 , and get to manage the other 24 bits themselves.
  • Class B users are assigned 2 8-bit numbers, such as 129.2 , and manage the remaining 16 bits themselves.
  • Class C users are assigned 3 8-bit numbers, such as 129.2.8 and get to manage the remaining 8 bits themselves.

Someone at the site is placed in charge of assigning IP addresses, and is responsible for managing whatever bits are up to the site's discretion.

At the University of Maryland, we have been assigned 2 Class B domains: 128.8 and 129.2

Network Infrastructure (NI) is responsible for assigning IP addresses to individual users and departments.

The Class B domains on campus are further divided into subnets. Each subnet uses a gateway to access the rest of the world outside of its subnet.

Here at the OIT, we have several subnets; one of them has addresses beginning in129.2.8 and 129.2.9 . These might appear to be two subnets, but they are actually one. This is because, unlike a domain, a subnet number is not required to consist of 8 bits. It can consist of any number of available bits, so long as at least 1 bit is left over for the host number. However, typical values are 8 and 7. We are using 7 subnet bits in the 129.2 domain (we are using 8 subnet bits in much of the 128.8 domain). If we look at a binary representation:

10000001 00000010 00001000 129.2.8
10000001 00000010 00001001 129.2.9

we notice that the 7 bits immediately following the 129.2 domain (i.e, 0000100) are the same for both 129.2.9 and 129.2.8 . This is the subnet number. The difference comes in the 8th bit, which is the beginning of the 9-bit host number. Thus, we have host numbers ranging from

0 00000001 to
1 11111110

When represented as 4 8-bit numbers, these are the IP addresses

129.2.8.1 through 129.2.9.254

(0 and 255 are reserved numbers.)

All of these hosts use the same gateway to talk to the rest of the world, 129.2.8.1 . Anytime a host on this subnet sends out a packet to another host, it must check to see whether that host is on its own subnet or somewhere else. If the host is on its own subnet, it simply addresses the packet to that host and that host receives it. If, on the other hand, the host is outside the subnet, the originating host addresses the packet to the gateway (129.2.8.1), and the gateway then passes it on. Thus, each host must be able to identify whether or not a host is on its own subnet.

A host accomplishes this by comparing its own domain and subnet with the domain and subnet of the destination host. This is where the "subnet mask" comes in. The host can do a logical AND of the mask and each address in question, which will produce two addresses consisting of the domain and subnet, but having only zeros for the host number. These can then be compared, and if they are the same, the host knows the other host is on its own subnet. (Remember that the AND operation only produces "1" if both values are 1; otherwise, it produces 0. Thus, ANDing a value with a 1 reproduces the original value, while ANDing a value with a 0 always produces 0.)

If a 7-bit subnet mask is in use, it looks like this:

11111111 11111111 11111110 00000000

Notice that the first 16 bits, which correspond with the domain part of the address are all ones, and the next 7 bits, which correspond with the subnet part of the address are also all ones. Thus, the domain and subnet will be reproduced intact when an AND is done between and address and this mask. The last 9 bits are all zeros; this corresponds to the host part of the address. When an AND is done between the address and this mask, the last 9 bits of the address will be changed to zeros, allowing two addresses to be compared to see if they have the same domain and subnet but ignoring the host number.

In a decimal representation, this subnet mask is 255.255.254.0 .

Similarly, an 8-bit subnet mask looks like this:

11111111 11111111 11111111 00000000

or

255.255.255.0

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology University of Maryland