zoukankan      html  css  js  c++  java
  • subnetting and the subnet mask

    原文:https://www.techopedia.com/6/28587/internet/8-steps-to-understanding-ip-subnetting/5

    Step 4 - Subnetting and the Subnet Mask

    To subnet a network is to create logical divisions of the network. Subnetting, therefore, involves dividing the network into smaller portions called subnets. Subnetting applies to IP addresses because this is done by borrowing bits from the host portion of the IP address. In a sense, the IP address then has three components - the network part, the subnet part and, finally, the host part.

    We create a subnet by logically grabbing the last bit from the network component of the address and using it to determine the number of subnets required. In the following example, a Class C address normally has 24 bits for the network address and eight for the host, but we are going to borrow the left-most bit of the host address and declare it as identifying the subnet.

    If the bit is a 0, then that will be one subnet; if the bit is a 1, that would be the second subnet. Of course, with only one borrowed bit we can only have two possible subnets. By the same token, that also reduces the number of hosts we can have on the network to 127 (but actually 125 useable addresses given all zeros and all ones are not recommended addresses), down from 255.

    So how can you tell how many bits should be borrowed, or, in other words, how many subnets we want to have on our network?

    The answer is with a subnet mask.

    Subnet masks sound a lot scarier than they really are. All that a subnet mask does is indicate how many bits are being “borrowed” from the host component of an IP address. If you can’t remember anything about subnetting, remember this concept. It is the foundation of all subnetting.

    The reason a subnet mask has this name is that it literally masks out the host bits being borrowed from the host address portion of the IP address.

    In the following diagram, there is a subnet mask for a Class C address. The subnet mask is 255.255.255.128 which, when translated into bits, indicates which bits of the host part of the address will be used to determine the subnet number.

    Of course, more bits borrowed means fewer individually addressable hosts that can be on the network. Sometimes, all the combinations and permutations can be confusing, so here are some tables of subnet possibilities.

    Note that this combination of IP addresses and subnet masks in the charts are written as two separate values, such as Network Address = 205.112.45.60, Mask = 255.255.255.128, or as an IP address with the number of bits indicated as being used for the mask, like 205.112.45.60/25.

    Subnet masks work because of the magic of Boolean logic. To best understand how a subnet mask actually does its thing, you must remember that a subnet mask is only relevant when getting to a subnet. In other words, determining what subnet an IP address lives on is the only reason for a subnet mask. It’s devices like routers and switches that make use of subnet masks.

  • 相关阅读:
    iOS 学习
    swift
    (九)Javabean与Jsp(来自那些年的笔记)
    (八)JSP 技术知识点总结(来自那些年的笔记)
    java抽象工厂模式
    java工厂方法模式
    java的简单工厂模式
    服务提供者框架讲解 之 myJDBC
    第一条:考虑用静态工厂方法代替构造器
    另辟蹊径的归并排序复杂度分析
  • 原文地址:https://www.cnblogs.com/oxspirt/p/6224909.html
Copyright © 2011-2022 走看看