Thursday, February 3, 2011

IP addressing issue

I am not bad with networks, however, I am doing badly in IP addressing. It is affecting me very much. For example, while working on access lists on a Cisco router, I had to assign a serial port the IP address 24.17.2.2 and a subnet 255.255.255.240. I thought the corresponding subnet would be 255.0.0.0, because 24.17.2.2 is a Class A IP address.

How may I improve my IP addressing skills?

  • When you are using a custom subnet you are using classless ip addressing. This allows a large block of IP addresses, like those in a class a network to be sliced up into smaller networks. You do this for a variety of reasons. Do a Google search for Subnetting Tutorial and you will find a ton of resources. Cisco's site has some very good games on how to perform subnetting as well.

    jscott : Why not just provide @user56454 a link to SF's very own hit question: [How does Subnetting Work?](http://serverfault.com/questions/49765/how-does-subnetting-work)
    Robert Kaucher : Oooh. That is quite good. I actually did not know about it. Stored for future use.
  • 255.255.255.240 is an example of a variable length subnet mask, which is used with CIDR, or classless inter-domain routing. CIDR is a way to split Class-A/B/C networks into smaller subnetworks where you don't need say, a full 254 addresses (or 16 million, in the case of a Class-A).

    In this case, 255.255.255.240 is a mask for a network of 14 hosts. A tool like whatmask is very helpful here:

    $ whatmask 24.17.2.2/28
    
    ------------------------------------------------
               TCP/IP NETWORK INFORMATION
    ------------------------------------------------
    IP Entered = ..................: 24.17.2.2
    CIDR = ........................: /28
    Netmask = .....................: 255.255.255.240
    Netmask (hex) = ...............: 0xfffffff0
    Wildcard Bits = ...............: 0.0.0.15
    ------------------------------------------------
    Network Address = .............: 24.17.2.0
    Broadcast Address = ...........: 24.17.2.15
    Usable IP Addresses = .........: 14
    First Usable IP Address = .....: 24.17.2.1
    Last Usable IP Address = ......: 24.17.2.14
    

    CIDR is useful in cases where you don't need a full Class-C network (254 addresses) (or something even larger). If you only have a network of a dozen or so hosts it's a more efficient use of IP address space.

    Hope that helps.

  • The notion of class is similar to subnets. The difference is that a class block is assigned to a particular compagny or person. In that case the ip block 24.x.x.x were given to an compagny that decide to divide it in multiple part. Maybe the compagny sold a little part of their IP adress space. The class notation is not really used in our days.

    Instead we use netmask. Netmask gives helps a router separate the subnet-part and the host-part. How? It's simple all bits set to 1 is part of the subnet address and the ones set to zero is the host address. The router just have to perform an bitwise and with the netmask and the IP address to retrive subnet address. Another way to write the netmask is by appending a /x to a base subnet address i.e. 24.17.2.2/28.

    A subnet is a group of hosts in the same network as in there is no routers that has to be contact to esthablish a connection between two hosts in the same subnet. So you want to assigned the same subnet address to those hosts. There is two adresses that are taking when yo form a subnet the first on and the last one. The first address is to designate the subnet itself, it is not an usable address and anything sent to that address will be discarded. The last address of a subnet is the broadcast address is something is sent to that address it will be received by all the host on the subnet.

    If we take an subnet like 10.0.0.0/24 (or netmask 255.255.255.0): we can have host from 10.0.0.1 to 10.0.0.254 so we can set 254 ip addresses. We used 10.0.0.0 to designate the subnet and 10.0.0.255 would be the broadcast address.

    If we look at the possible subnet we have:

    /32 (255.255.255.255): Only one usable ip address (you don't have a subnet address nor a broadcast). It is used in point-to-point connection

    /31 (255.255.255.254): Is quite a bit unuseful because most of routers sets a subnet address and a broadcast so you don't have any other host. But if your router follows the exeption to that rule you have two IP possible.

    /32 (255.255.255.252): Is more useful you have one subnet address, two host IP and the broadcast.

    /x: You can continue to calculate what it would give as number of hosts possible on a network with the rule: 2^(32-x)-2

    /0 (0.0.0.0): Is not possible because you need a subnet part.

    If apply these rule to the internet itself we can think of some weird things.

    The IP 0.0.0.0 would designate the subnet of all subnet so the whole internet. It fact it points to nothing just like the first address of a subnet.

    The IP 255.255.255.255 would designate the broadcast for all internet hosts but in fact it is reduce to the local subnet (for obvious security reason). Host use it when configuring their IP with the DHCP protocol.

    So in ending I will explain your own example:

    24.17.2.2 is your IP address. 255.255.255.240 your netmask (so it's a /28) We have 16 possible IP addresses, so if we remove the 2 reserved we have 14 possible host. Then 24.17.2.0 is the subnet address. And 24.17.2.15 the broadcast address. Range 24.17.2.1-24.17.2.14 is usabla hosts addresses.

    Hope it was interesting and useful.

    From Gopoi
  • Here is a section from a Cisco class I am taking (note the bolded text near the end).

    Historic Network Classes

    Historically, RFC1700 grouped the unicast ranges into specific sizes called class A, class B, and class C addresses. It also defined class D (multicast) and class E (experimental) addresses, as previously presented.

    The unicast address classes A, B, and C defined specifically-sized networks as well as specific address blocks for these networks, as shown in the figure. A company or organization was assigned an entire class A, class B, or class C address block. This use of address space is referred to as classful addressing.

    Class A Blocks

    A class A address block was designed to support extremely large networks with more than 16 million host addresses. Class A IPv4 addresses used a fixed /8 prefix with the first octet to indicate the network address. The remaining three octets were used for host addresses.

    To reserve address space for the remaining address classes, all class A addresses required that the most significant bit of the high-order octet be a zero. This meant that there were only 128 possible class A networks, 0.0.0.0 /8 to 127.0.0.0 /8, before taking out the reserved address blocks. Even though the class A addresses reserved one-half of the address space, because of their limit of 128 networks, they could only be allocated to approximately 120 companies or organizations.

    Class B Blocks

    Class B address space was designed to support the needs of moderate to large size networks with more than 65,000 hosts. A class B IP address used the two high-order octets to indicate the network address. The other two octets specified host addresses. As with class A, address space for the remaining address classes needed to be reserved.

    For class B addresses, the most significant two bits of the high-order octet were 10. This restricted the address block for class B to 128.0.0.0 /16 to 191.255.0.0 /16. Class B had slightly more efficient allocation of addresses than class A because it equally divided 25% of the total IPv4 address space among approximately 16,000 networks.

    Class C Blocks

    The class C address space was the most commonly available of the historic address classes. This address space was intended to provide addresses for small networks with a maximum of 254 hosts.

    Class C address blocks used a /24 prefix. This meant that a class C network used only the last octet as host addresses with the three high-order octets used to indicate the network address.

    Class C address blocks set aside address space for class D (multicast) and class E (experimental) by using a fixed value of 110 for the three most significant bits of the high-order octet. This restricted the address block for class C to 192.0.0.0 /16 to 223.255.255.0 /16. Although it occupied only 12.5% of the total IPv4 address space, it could provide addresses to 2 million networks.

    Limits to the Class-based System

    Not all organizations' requirements fit well into one of these three classes. Classful allocation of address space often wasted many addresses, which exhausted the availability of IPv4 addresses. For example, a company that had a network with 260 hosts would need to be given a class B address with more than 65,000 addresses.

    Even though this classful system was all but abandoned in the late 1990s, you will see remnants of it in networks today. For example, when you assign an IPv4 address to a computer, the operating system examines the address being assigned to determine if this address is a class A, class B, or class C. The operating system then assumes the prefix used by that class and makes the appropriate subnet mask assignment.

    Another example is the assumption of the mask by some routing protocols. When some routing protocols receive an advertised route, it may assume the prefix length based on the class of the address.

    Classless Addressing

    The system that we currently use is referred to as classless addressing. With the classless system, address blocks appropriate to the number of hosts are assigned to companies or organizations without regard to the unicast class.

    From dbasnett

0 comments:

Post a Comment