关于IP子网的一点基础知识

2008-02-23 04:56:35来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

If you work with networks, odds are pretty good that you're familiar with Cisco IP subnetting. But that doesn't mean you know all there is to know. It never hurts to refresh your subnetting skills—particularly if you're planning on taking a Cisco exam soon.

IP subnetting isn't some obscure, esoteric topic that only the network administration "gurus" can understand. In fact, you should be able to get a firm grasp on subnetting in about an hour.

However, just like almost anything else, you won't be able to understand subnetting unless you use it—and practice. Learning subnetting takes some repetition. And once you do learn it, you'll quickly forget it if you don't practice it periodically.

What is IP subnetting?
Subnetting means breaking a large network into smaller networks. You can accomplish this by changing the subnet mask.

When it comes to subnetting, how are routers different from computers?
Every computer needs three components in order to communicate both on its network and outside its network (e.g., to the Internet).

An IP address
A subnet mask: Combined with the IP address, the subnet mask tells the computer which IP addresses are on its local network.
A default gateway: A computer uses the default gateway to transmit data not on its local network. If a computer only needs to communicate on its own LAN, a default gateway isn't necessary.
Routers function similarly to computers; every interface has an IP address and a subnet mask. While routers can also have default gateways, they don't always have them.

In addition, every interface on a router must be on a different network. In fact, the router won't let you place two interfaces on the same network.

Where did subnetting come from?
Published in 1990, RFC 1166 specified five different classes of IP addresses:

Class A: Any IP address that begins with 1 to 127 has a subnet mask of 255.0.0.0.
Class B: Any IP address that begins with 128 to 191 has a subnet mask of 255.255.0.0.
Class C: Any IP address that begins with 192 to 223 has a subnet mask of 255.255.255.0.
Class D is for multicast traffic only.
Class E is experimental.
However, these fixed classes and subnet masks didn't fit the growth requirements of the Internet, and the industry abandoned them in favor of Classless Inter-Domain Routing (CIDR) in 1995 (RFC 1817). CIDR uses variable length subnet masks (VLSM) (RFC 1518 and RFC 1519). That means the classes above, with their fixed length subnet masks (FLSM), were no longer applicable.

VLSM means that the subnet mask can dynamically change based on how many networks or hosts you need. So, while it's important to know the default (fixed length) subnet masks for testing purposes, a subnet mask for an IP that begins with 192 may or may not be 255.255.255.0.

What do 1s and 0s have to do with it?

Subnetting is taking the original subnet mask and adding bits to it to create more networks. In other words, if you convert a subnet mask into binary form and add more 1s, you are subnetting that network. The more 1s that are present in the subnet mask means the more networks with a fewer number of hosts. The more 0s that are present in the subnet mask means the fewer networks and the more hosts you have.

In other words, the subnet mask tells routers and computers which portion of the IP address is for the network and which is for the host. If you slide the line between network and host to the left, you create fewer networks and more hosts. If you slide the line to the right, you create more networks and fewer hosts.

How can I write out subnet masks?
You can write out subnet masks in two different ways: dotted decimal notation and slash notation. The dotted decimal notation method is more than likely what you're familiar with. This involves writing the numbers and separating them by periods (i.e., dots). For example, you would write a Class C default subnet mask as 255.255.255.0.

To use the slash notation method, you convert the subnet mask into binary form, writing the number of 1s in the subnet mask instead. For example, in binary form, 255.255.255.0 would be 11111111 11111111 11111111 00000000.

In slash notation, this "translates" to /24—in other words, the number of 1s. So, you would write your IP network with its subnet mask like this: 192.168.1.0/24. While the slash notation method may seem more complicated, keep in mind that it makes diagramming and note taking easier.

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Ping命令的使用还有这么多要注意的

下一篇:网络使用的学习总结