29 thg 3, 2008

Subnet Cheat Sheet

http://krow.net/dict/subnet.html

subnet mask
Last modified: Tuesday, January 15, 2008

A mask used to determine what subnet an IP address belongs to. An IP address has two components, the network address and the host address. For example, consider the IP address 150.215.017.009. Assuming this is part of a Class B network, the first two numbers (150.215) represent the Class B network address, and the second two numbers (017.009) identify a particular host on this network.

Subnetting enables the network administrator to further divide the host part of the address into two or more subnets. In this case, a part of the host address is reserved to identify the particular subnet. This is easier to see if we show the IP address in binary format. The full address is:

10010110.11010111.00010001.00001001

The Class B network part is:

10010110.11010111

and the host address is

00010001.00001001

If this network is divided into 14 subnets, however, then the first 4 bits of the host address (0001) are reserved for identifying the subnet.

The subnet mask is the network address plus the bits reserved for identifying the subnetwork. (By convention, the bits for the network address are all set to 1, though it would also work if the bits were set exactly as in the network address.) In this case, therefore, the subnet mask would be 11111111.11111111.11110000.00000000. It's called a mask because it can be used to identify the subnet to which an IP address belongs by performing a bitwise AND operation on the mask and the IP address. The result is the subnetwork address:
Subnet Mask 255.255.240.000 11111111.11111111.11110000.00000000
IP Address 150.215.017.009 10010110.11010111.00010001.00001001
Subnet Address 150.215.016.000 10010110.11010111.00010000.00000000

The subnet address, therefore, is 150.215.016.000.

http://www.webopedia.com/TERM/S/subnet_mask.html

Calculating Subnet Masks

By Joshua Erdman
Digital Foundation, inc.
Subnet Masks in Binary

The easiest way to explain a subnet mask is by looking at the IP address and subnet mask in its binary format. Before you continue, be sure you have a good grip on counting with binary, we have provided a quick binary primer if you need a refresher. If you do not care for the intricasies of calculating a subnet mask and just need to know the correct mask for your situation, we have provided a reference table.

Not to mention you should already be familiar with the IP address. This article explains the basic use of an IP address and why we need a subnet mask.

A regular IP address when converted to binary is 32 bits in length, each segment being 8 bits long. Refer to our first address example of 63.26.15.5 with a subnet mask of 255.255.255.0 in binary.
Network and Host Addresses

In this example, it is only the last segment that changes from one host to another; this last segment is known as the host address; the first 3 segments, for this example, make up the network address. If we were to use an address with a subnet mask of 255.255.0.0 then the first 2 segments would make up the network address and the last two would be the host address. This is the kind of effect the subnet mask has on your IP address. It determines how big your network group is.

With that said, to go into any deeper detail we must look at the addressing in binary. Since we are just dealing with 32 binary bits we can stop grouping them in sets of 8 bits per segment and deal with them as a 32 bit string. Now when you create a mask, it does not have to be limited to groups of 8 bits (and it can have man more values than 255 or 0). These are called Variable Length Subnet Masks (VLSMs). By calculating out your VLSM you can create any block of IP addresses in sizes of powers of 2 minus 2.

For example, We can create a mask that only allows for 14 hosts (remember 14 hosts is 2 to the power of 4 then we subtract 2). Knowing that it is 2 to the power of 4, we know that we have an address block (subnet) with 4 bits for the hosts. That leaves a remaining 28 bits for the network address, also known as a /28. Now that we know the size of the network block we want (14 hosts) let's calculate the subnet mask that we would use for a /28 network.

CLUE: A block of IP addresses is referred to as a subnet. Because of this that is how subnet masks got their name,they are key into declaring how large a subnet actually is.

First map out your binary numbers again and keep them in groups of 8 bits each. That makes it easy to get the decimal number for each segment. Since our network size is 28 bits long we represent that with a string of 28 1s and the remainings 4 bits as 0s. So the first 3 segments (of 8 bits each) are all 1s. The decimal equivalent of an 8 bit segment of all 1s is 255. So the first 3 segments are 255. That leaves us with 4 bits left in the mask for the last segment. It will look something like this:

128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 0

To make it easy, we have included a subnet mask calculator. This calculator converts decimal IP addresses and Subnet Masks. You can also optionally enter a destination IP address to see the results.

Add up the bits that are flagged with a one and we see that the last segment of the subnet mask with 14 hosts ( 16 - 2 ) is 240. For a subnet mask of 255.255.255.240 That is pretty much it with creating subnet masks, but now you need to learn a new rule about addressing.
IP Addresses with VLSMs

When you use a subnet mask of 255.255.255.192 what you have essentially done is divided up your last segment into 4 blocks (subnets). Using the binary of the last segment we can see our subnet mask only uses the first 2 most significant bits. Recall that the network address is made up from all the bits that line up with the 1s in the subnet mask. So in this case the network address 'overflows' into the last segment because it has two bits available in the last segment. The host address has the last 6 bits in the last segment. Let's see what this subnet masks looks like:

128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0

First lets say we have a network subnet of 10.10.10.X and we are using the same subnet mask 255.255.255.192 Our network host (HOST1) is currently using the address 10.10.10.75 Now lets display the binary of the last segment for both the subnet mask and the address of our host.

|
128 64|32 16 8 4 2 1
SM 1 1| 0 0 0 0 0 0
HOST1 0 1| 0 0 1 0 1 1
|
Network Host

Notice the bar I drew in that divides the bits of the last segment. The last 6 bits on right are the host bits, we know this because it matches up with all the 0s in the subnet masks. Fromt he same logic we know about all the bits for the entwork masks because of the same reason, the network address matches up with all the 1s in the subnet mask.

So let's calculate the first and last addresses that can exist on the subnet of HOST1. To do this, that the ful address of the host and make the host side all 0s and do it again with all 1s. Look at the example:

|
128 64|32 16 8 4 2 1
SM 1 1| 0 0 0 0 0 0=192
HOST1 0 1| 0 0 1 0 1 1=75
0s 0 1| 0 0 0 0 0 0=64
1s 0 1| 1 1 1 1 1 1=127
|
Network Host

The valid host addresses in the same subnet as our sample host are in the range of 10.10.10.64 - 10.10.10.127
Notice how there is specific requirements of the available addresses in the subnet.

So why doesn't a host with the IP address of 10.10.10.33 and SM 255.255.255.192 (HOST2) see HOST1 as a local computer?
Let's display all the data in binary:

|
128 64|32 16 8 4 2 1
SM 1 1| 0 0 0 0 0 0=192
HOST1 0 1| 0 0 1 0 1 1=75
HOST2 0 0| 1 0 0 0 0 1=33
|
Network Host

Look at the first 2 bits in the network section of the each host. HOST1 and HOST2 have DIFFERENT network addresses! So a subnet mask plays a much more complicated role than just declaring the size of a subnet. It also limits that addresses you can use in a subnet. In our last example we noticed that a subnet mask of 255.255.255.192 will create a subnet of 64 addresses (for 62 hosts). But if you tried to start the addressing at 10.10.10.32 - 10.10.10.95 what actually happens is that your subnet overlapps into two separate subnets. Just do the calculations and you will see (just as I displayed above) that the network addresses of the first 32 hosts in the invalid subnet will have a different network address than the last 32 hosts in the invalid subnet.
Application

Learing how to create and declare subnet masks is not only useful for the technicians of ISPs who are assigning subnets to their customers. Using subnet masks is also key for firewalls and access lists. If you group IP addresses together based on host type (such as assigning all the workstations the addresses 10.10.10.128 - 10.10.10.254 and the servers the addresses 10.10.10.1 - 10.10.10.127) but use the subnet mask 255.255.255.0 (so that the hosts will communicate directly) you can then use masking as a way to apply different access rules with your firewall without having to specify each IP address individually.

References:
Cisco Access Control Lists

http://www.networkclue.com/routing/tcpip/calculating-masks.aspx

+++++


1- Các địa chỉ thuộc lớp A, B, C có những giá trị netmask [b]mặc định[b] là /8; /16; /24. Khi không dùng giá trị mặc định thì người ta nói bạn đang "chia subnet". Ví dụ một máy có địa chỉ 172.16.1.1 nếu không nói gì cả sẽ được hiểu ngầm giá trị netmask là 255.255.0.0, nhưng bạn hoàn toàn có thể dùng netmask khác đi, không có vấn đề gì. Khi bạn học đến đầu môn 291 bạn sẽ được giải thích về chia subnet

2 - Trong kết nối Point-to-Point (PPP) thường giá trị IP trùng với Gateway và có netmask là 255.255.255.255. Sở dĩ có điều này vì trong kết nối PPP giữa 2 máy A và B, máy A mốn gởi dữ liệu đến 1 máy khác ví dụ máy C thì con đường duy nhất là thông qua máy B, mà giữa A và B lại không có máy nào khác, nên đương nhiên khi A gởi dữ liệu lên đường truyền thì B nhận được; vì thế A không cần quan tâm đến Gateway.

Trong kết nối ADSL bạn dùng PPPoE là một dạng đặc biệt của Point-to-Point

Host Route !
ADSL cũng là dịch vụ quay số (RAS), mạng WAN Point to Point (PPP). RAS client (ADSL Modem) sẽ được cấp IP động như sau (ví dụ):

IP address: 222.253.155.54
Subnet mask: 255.255.255.255
Default Gateway: 222.253.155.1 (RAS Server)

(Subnet mask: Mục đích để nhận biết Host đích đang ở mạng (subnet) nào )
Chính vì mạng PPP nên Subnet mask: 255.255.255.255 (32 con số 1) có nghĩa là "Host Route" không phải tìm đường đến mạng đích mà là tìm đường đến máy đích.

Túm lại: Subnet mask 255.255.255.255 là Host route
Trả Lời Với Trích Dẫn

http://www.nhatnghe.com/forum/showthread.php?t=247

+++++++++++++

Địa chỉ mạng LAN mà các bạn hay gán gồm có 3 dải địa chỉ gọi là private IP address tuơng ứng với 3 lớp, mỗi lớp này tương ứng với một subnet mask:
- Class A: 10.0.0.0/8 --> subnet: 255.0.0.0
- Class B: 172.16.0.0/12 --> subnet: 255.255.0.0 (Những số sau dấu / thể hiện số bit dành cho Net-ID ... nói ở duới)
- Class C: 192.168.0.0/16 --> subnet: 255.255.255.0

Trong các địa chỉ IP đều có hai phần, là Net-ID và Host-ID, net ID để xác định IP đó thuộc lớp mạng nào, còn Host ID là số còn lại chỉ ra các máy host trong mạng đó.

Một địa chỉ IP thì có 32 bit chia làm 4 nhóm mỗi nhóm 8 bit đúng không, rồi nhé
Lớp A: Net-ID là 8 bit đầu, 24 bit còn lại là host-ID
Lớp B: Net-ID là 16 bit đầu, 16 bit còn lại là Host-ID
Lớp C: Net-ID là 24 bit đầu, 8 bit còn lại là Host-ID

Số bit trong Host-ID sẽ xác định đuợc 2^n - 2 host có thể gán IP trong mạng

Còn Subnet Mask, dùng để xác định trong địa chỉ IP sẽ có bao nhiêu bit dùng cho Net-ID và bao nhiêu bit dùng cho Host-ID, nếu là Net-ID thì sẽ là các bit 1, còn host-ID sẽ là các bit 0, do đó subnet mask của một địa chỉ lớp A sẽ có dạng 11111111.00000000.00000000.00000000
= 255.0.0.0

Địa chỉ mạng đuợc sinh ra từ địa chỉ IP bằng cách cho tất cả các bit trong Host-ID = 0, còn lại giữ nguyên, nó có thể đựoc suy ra khi biết địa chỉ IP và Subnet Mask thông qua phép AND bit.

VD:
Địa chỉ IP là 10.34.23.134 = 00001010.00100010.00010111.10000110
Subnet Mask 255.0.0.0 = 11111111.00000000.00000000.00000000 (tức là dùng 8 bit cho net-ID, còn lại cho host-ID)
=> địa chỉ mạng: AND = 00001010.00000000.00000000.00000000 = 10.0.0.0

Sơ sơ là như thế, và Subnet mask là cần thiêt trong mọi network, và việc bạn kết nối như thế nào tới modem không quan trọng, vì giữa máy bạn và modem đuợc coi là một network. Cái subnet này về sau phần IP planning còn phức tạp hơn nữa cơ....

++

Sm là chia một địa chỉ IP thành hai phần: network và host. Giả sử bạn có một lớp địa chỉ nào đó bạn có thể chia nó nhỏ ra thành các subnet nhỏ hơn, qua đó tạo được nhiều mạng hơn phục vụ vào mục đích của bạn.
Giả sử chúng ta có một mạng là 192.168.10.0 với Sm là 255.255.255.0
Với mạng này thì dãy địa chỉ khả dụng là: 192.168.10.1 ->192.168.10.254 vì IP 192.168.10.255 được dành làm địa chỉ broadcast. Nếu ta muốn chia số IP ra làm hai mạng thì ta phải subnetting.
VD như ở mạng trên nếu ta dùng thêm một SM là 192.168.10.127 ta sẽ có hai mạng con (subnet) như sau:
192.168.10.1->192.168.10.127
192.168.10.129->192.168.10.254

Như vậy dễ thấy SM sẽ quy định xem subnet sẽ lớn bao nhiêu hay nói cách khác là mạng này sẽ được chia làm mấy phần.
Chúng ta đã quen với địa chỉ IP 4 octet và cách đổi mã nhị phân nhưng dù sao mình khuyên các bạn nên học thuộc một số giá trị “nhạy cảm” sau:
252 = 11111100
248 = 11111000
240 = 11110000
224 = 11100000
192 = 11000000

Mọi người cũng chú ý dạng IP kiểu 192.168.10.0 /24 với ý nghĩa của số 24 ở đây là: ta có SM với 24 số 1 ở đầu tức là: 11111111.11111111.11111111. 00000000 hay 255.255.255.0

+++

Subnet mask này dùng để phân chia địa chỉ trong mạng LAN để các máy trong cùng một mạng có thể liên lạc với nhau mà ko sợ sẽ trùng địa chỉ IP. Subnet mask sẽ gồm hai phần :Network và host. Tùy vào trường hợp cụ thể mà người ta có thể dùng bao nhiêu bit cho phần mạng và bao nhiêu bit cho phần host.
Vd: Ngươi ta có một địa chỉ là 192.168.0.0/16 và muốn chia làm ba vùng mạng Vùng 1 có 300host Vùng 2 500host Vùng 3 700host
Địa chỉ vùng 1 khi đó sẽ là 192.168.1.2 ->192.168.2.254 còn subnet mask sẽ là 255.255.252.0(23 bit cho vùng mạng)
Địa chỉ vùng 1 khi đó sẽ là 192.168.3.2 ->192.168.4.254 còn subnet mask sẽ là 255.255.254.0(23 bit cho vùng mạng)
Địa chỉ vùng 3 khi đó sẽ là 192.168.1.2 ->192.168.3.254 còn subnet mask sẽ là 255.255.252.0(22bit cho vùng mạng)


+++

Subnet Mask dùng để xác định xem IP đích đến có nằm trong mạng LAN ko ( nếu IP đích nắm trong mạng LAN thì router sẽ gửi trực tiếp mà ko cần thông qua 1 router khác )

Ví dụ cho dễ hiểu :

IP trong LAN của bạn là a.b.c.x
Subnet Mask là : 255.255.255.0
bạn gửi 1 gói tin đến IP : a.b.c.y

Thì modem sẽ and theo bit IP với Subnet Mask để xác định xem IP đích có nằm trong mạng LAN ko
bạn hãy để ý Subnet Mask : 255.255.255.0 nghĩa là 1111.1111.1111.0000
Như vậy a.b.c.x & ( and theo bit ) 255.255.255.0 = a.b.c.0
a.b.c.y & ( and theo bit ) 255.255.255.0 = a.b.c.0
=> 2 địa chỉ trên trong cùng mạng LAN
Như vậy với Subnet Mask là : 255.255.255.0 thì có thể cấp tối đa 255 địa chỉ IP
Mạng nội bộ trường mình Subnet Mask net là : 255.255.0.0 => có thể cấp phát tối đa 2^16 địa chỉ IP

http://www.fotech.org/forum/index.php?showtopic=9750

++++++++++++++++++++

IP Subnet Calculations



1. IP Addressing

At this point you should know that IP, the Internet Protocol, is a network layer (OSI layer 3) protocol, used to route packets between hosts on different networks. To suit this purpose, IP must define an addressing scheme, so that a packet's intended destination can be indicated.

An IP address is composed of 32 bits. These 32 bits are divided into 4 octets of 8 bits each. You may have seen an IP address represented like this: 172.68.15.24. We must remember, however, that the computer understands this number only in binary, so we must often deal with them in binary. Many people are intimidated by this initially, but soon find that it is not difficult. If you do not allow yourself to be flustered, you can master this topic.

IP addresses are assigned to organizations in blocks. Each block belongs to one of three classes: class A, class B, or class C. You can tell what class an IP address is by the value in its first octet.

Class A
1-126

Class B
128-191

Class C
192 -->

An IP address consists of two fields. The first field identifies the network, and the second field identifies the node on the network. Which bits of the address are in the network field and which bits are in the host field is determined by the subnet mask.

When a class A IP license is granted, you are assigned something like this: 99.0.0.0. Only the value of the bits in the first octet is assigned. This means you are free to assign any values you wish in the second, third and fourth octets.

The default subnet mask for a class A network is 255.0.0.0. High bits, ones, indicate the bits that are part of the network field of the IP address. The default subnet mask does not create subnets. Therefore, a class A network with the default subnet mask is one network. The three octets that are unassigned and unmasked are part of the host field of the address. There is a total of 24 bits in those three octets. Each bit can be in one of two states. Therefore, 2^24 is the number of host addresses that can be assigned on that network, almost. Two addresses are reserved on every network, x.x.x.0 and x.x.x.255. So the total number of hosts possible on this network is 2^24. 2^24-2=16,777,214 hosts for a class A IP network.

When a class B license is granted, the first two octets are assigned. For example, 172.198.x.x. The default subnet mask for a class B is 255.255.0.0. One network, two octets free, 16 bits for the host address field. 2^16-2=65,534 possible host addresses on a class B IP network.

When a class C license is granted, the first three octets are assigned, for example: 193.52.16.0. The default subnet mask for a class C is 255.255.255.0. Once octet makes up the host address field. 2^8-2=254 host addresses possible on a class C network.


2. Reason for Subnetting

We said that the default subnet mask for a class A IP network is 255.0.0.0. Once octet only of a class A network address identifies the network, with this subnet mask. This leaves three octets of 8 bits each, or 24 bits, to identify the host on that one network. 2^24=16,777,216 addresses. Two addresses are reserved, x.x.x.0 and x.x.x.255. 16,777,214 nodes can be assigned an IP address on this network.

It is highly unlikely that any organization would want one network of 16,777,214 nodes. They might want that many devices connected in a wide area network (WAN), thus capable of communicating when necessary, but they will want to subdivide this huge network into mostly self-contained subnetworks of nodes that communicate with each other often. This is called subnetting.

To understand why, consider what would happen in either a broadcast or a token passing network that consisted of over 16,000,000 nodes. Nothing would happen. It simply would not work. Though the problem is not as drastic, class B and class C IP networks are often subnetted, also.

The subnet mask is used to subdivide an IP network into subnets. This is a division that takes place in OSI layer 3, so it is a logical division that is created by the addressing scheme. This logical division is usually combined with a physical division. Many subnets are physically isolated from the rest of the network by a device such as a router or a switch. This aspect of subnetting is discussed in Unit 3--Data Link Layer.


3. How Subnetting Works

The bits of an address that are masked by the subnet mask are the bits that make up the network field of the address. To subnet, the default subnet mask for a network is extended to cover bits of the address that would otherwise be part of the host field. Once these bits are masked, they become part of the network field, and are used to identify subnets of the larger network.

Here is where we begin dealing with both addresses and subnet masks in binary. Get yourself a cold beverage, stretch, take a deep breath and don't worry. Once you get your brain around the concepts, it is not difficult. You just have to keep trying until the light goes on.

3.1 Translating Binary to Decimal

Both IP addresses and subnet masks are composed of 32 bits divided into 4 octets of 8 bits each. Here is how a single octet translates from binary to decimal. Consider an octet of all ones: 11111111.
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 1 1 1 1 1 1 1 1 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

Here's another: 10111001
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 1 0 1 1 1 0 0 1 128 + 0 + 32 +16 + 8 + 0 + 0 + 1 = 185

and 00000000
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 0 0 0 0 0 0 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0

3.2 Converting Decimal to Binary

Converting decimal to binary is similar. Consider 175:
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 1 0 1 0 1 1 1 1 128 + 0 + 32 + 0 + 8 + 4 + 2 + 1 = 175

175=10101111

3.3 Simple Subnetting

The simplest way to subnet is to take the octet in the subnet mask that covers the first unassigned octet in the IP address block, and make all its bits high. Remember, a high bit, a 1, in the subnet mask indicates that that corresponding bit in the IP address is part of the network field. So, if you have a class B network 172.160.0.0, with the subnet mask 255.255.0.0, you have one network with 65, 534 possible addresses. If you take that subnet mask and make all the bits in the third octet high
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 1 1 1 1 1 1 1 1 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

you get the subnet mask 255.255.255.0.
172.60. 0. 0 255.255.255.0

Now the third octet of all the addresses on this network is part of the network field instead of the host field. That is one octet, or eight bits, that can be manipulated to create subnets. 2^8-2=254 possible subnets now on this class B network.

One octet is left for the host field. 2^8-2=254 possible host addressed on each subnet.

3.4 Advanced Subnetting

That is the simplest way to subnet, but it may not be the most desirable. You might not want 254 subnets on your class B network. Instead, you might use a subnet mask like 255.255.224.0. How many subnets would this give you? The first step is to see how many bits are allocated to the network by this mask.
128 64 32 16 8 4 2 1 --- -- -- -- - - - - 1 1 1 0 0 0 0 0 128 + 64 + 32 + 0 + 0 + 0 + 0 + 0 = 224

3 bits are allocated. 2^3-2=6 subnets.

How many hosts on each subnet? Well, 5 bits from this octet are left for the host field, and 8 bits in the fourth octet, for a total of 13 bits in the host field. 2^13-2=8190 possible hosts on each subnet.

The subnet mask is always extended by masking off the next bit in the address, from left to right. Thus, the last octet in the subnet mask will always be one of these: 128, 192, 224, 240, 248, 252, 254 or 255.

Given the IP address of a host and the subnet address for the network, you need to be able to calculate which subnet that host is on. To do this we compare the binary representation of the pertinent octet of the subnet mask with the binary representation of the corresponding octet in the IP address. Example:
IP address=172.60.50.2 subnet mask=255.255.224.0 50= 00110010 224=11100000

We perform a logical on these two numbers. We will be left with only the bits where there is a one in both octets.
00110010 11100000 -------- 00100000=32

This host is on subnet 172.60.32.0.

We also need to be able to find the range of assignable IP addresses on this subnet. To do this, we take the binary that tells us the subnet address, in this case 00100000, and compare it with the subnet mask.
00100000 11100000

The bits converted by the mask we will leave as they are. The rest of the bits we make high. So
00100000 11100000 -------- 0011111=63

The range of assignable IP addresses on the subnet 172.60.32.0 is 172.60.32.1-172.60.63.254.

On every network and subnet, two addresses are reserved. At the low end of the range of addresses for the network or subnet, in this case 172.60.64.0, is the address for the network or subnet itself. The address at the high end of the range of addresses, in this case 172.60.95.255, is the broadcast address. Any message sent to the broadcast address will be received by every host on the network.

+++

Subnet Masks
Khi ta chia một Network ra thành nhiều Network nhỏ hơn, các Network nhỏ nầy được gọI là Subnet. Theo quy ước, các địa chỉ IP được chia ra làm ba Class (lớp) như sau:

Address Class
Subnet mask trong dạng nhị phân
Subnet mask

Class A
11111111 00000000 00000000 00000000
255.0.0.0

Class B
11111111 11111111 00000000 00000000
255.255.0.0

Class C
11111111 11111111 11111111 00000000
255.255.255.0


Subnet Mask của Class A bằng 255.0.0.0 có nghĩa rằng ta dùng 8 bits, tính từ trái qua phải (các bits được set thành 1), của địa chỉ IP để phân biệt các NetworkID của Class A. Trong khi đó, các bits còn sót lại (trong trường hợp Class A là 24 bits đuợc reset thành 0) được dùng để biểu diễn computers, gọi là HostID. Nếu bạn chưa quen cách dùng số nhị phân hãy đọc qua bài Hệ thống số nhị phân.

Subnetting
Hãy xét đến một địa chỉ IP class B, 139.12.0.0, với subnet mask là 255.255.0.0 (có thể viết là: 139.12.0.0/16, ở đây số 16 có nghĩa là 16 bits được dùng cho NetworkID). Một Network với địa chỉ thế nầy có thể chứa 65,534 nodes hay computers (65,534 = (2^16) –2 ) . Đây là một con số quá lớn, trên mạng sẽ có đầy broadcast traffic.

Giả tỉ chúng ta chia cái Network nầy ra làm bốn Subnet. Công việc sẽ bao gồm ba bước:

1) Xác định cái Subnet mask
2) Liệt kê ID của các Subnet mới
3) Cho biết IP address range của các HostID trong mỗi Subnet

Bước 1: Xác định cái Subnet mask
Để đếm cho đến 4 trong hệ thống nhị phân (cho 4 Subnet) ta cần 2 bits. Công thức tổng quát là:

Y = 2^X

mà Y = con số Subnets (= 4)
X = số bits cần thêm (= 2)

Do đó cái Subnet mask sẽ cần 16 (bits trước đây) +2 (bits mới) = 18 bits

Địa chỉ IP mới sẽ là 139.12.0.0/18 (để ý con số 18 thay vì 16 như trước đây). Con số hosts tối đa có trong mỗi Subnet sẽ là: ((2^14) –2) = 16,382. Và tổng số các hosts trong 4 Subnets là: 16382 * 4 = 65,528 hosts.

Bước 2: Liệt kê ID của các Subnet mới
Trong địa chỉ IP mới (139.12.0.0/18) con số 18 nói đến việc ta dùng 18 bits, đếm từ bên trái, của 32 bit IP address để biểu diễn địa chỉ IP của một Subnet.

Subnet mask trong dạng nhị phân
Subnet mask

11111111 11111111 11000000 00000000
255.255.192.0


Như thế NetworkID của bốn Subnets mới có là:

Subnet
Subnet ID trong dạng nhị phân
Subnet ID

1
10001011.00001100.00000000.00000000
139.12.0.0/18

2
10001011.00001100.01000000.00000000
139.12.64.0/18

3
10001011.00001100.10000000.00000000
139.12.128.0/18

4
10001011.00001100.11000000.00000000
139.12.192.0/18


Bước 3: Cho biết IP address range của các HostID trong mỗi Subnet
Vì Subnet ID đã dùng hết 18 bits nên số bits còn lại (32-18= 14) được dùng cho HostID.
Nhớ cái luật dùng cho Host ID là tất cả mọi bits không thể đều là 0 hay 1.

Subnet
HostID IP address trong dạng nhị phân
HostID IP address Range

1
10001011.00001100.00000000.00000001
10001011.00001100.00111111.11111110
139.12.0.1/18 -139.12.63.254/18

2
10001011.00001100.01000000.00000001 10001011.00001100.01111111.11111110
139.12.64.1/18 -139.12.127.254/18

3
10001011.00001100.10000000.00000001
10001011.00001100.10111111.11111110
139.12.128.1/18 -139.12.191.254/18

4
10001011.00001100.11000000.00000001 10001011.00001100.11111111.11111110
139.12.192.0/18 –139.12.255.254


Bạn có để ý thấy trong mỗi Subnet, cái range của HostID từ con số nhỏ nhất (màu xanh) đến con số lớn nhất (màu cam) đều y hệt nhau không?

Bây giờ ta thử đặt cho mình một bài tập với câu hỏi:

Bạn có thể dùng Class B IP address cho một mạng gồm 4000 computers được không? Câu trả lời là ĐƯỢC. Chỉ cần làm một bài toán nhỏ.

Giả tỉ cái IP address là 192.168.1.1. Thay vì bắt đầu với Subnet mask, trước hết chúng ta tính xem mình cần bao nhiêu bits cho 4000 hosts.

Con số hosts ta có thể có trong một network được tính bằng công thức:

Y = (2^X –2)

Nhớ cái luật dùng cho Host ID là tất cả mọi bits không thể đều là 0 hay 1.

4094 = (2^12 –2)
X = 12 , ta cần 12 bits cho HostIDs, do đó Subnet mask sẽ chiếm 20 (=32-12) bits.

Quá trình tính toán nói trên nầy mang tên là Variable Length Subnet Mask(VLSM).

Supernetting
Giả tỉ ta mạng của ta có 3 Subnets:

Accounting: gồm 200 hosts
Finance : gồm 400 hosts
Marketing: gồm 200 hosts

Bạn hòa mạng với Internet và được Internet Service Provider (ISP) cho 4 Class C IP addresses như sau:
192.250.9.0/24
192.250.10.0/24
192.250.11.0/24
192.250.12.0/24

Bạn có 3 segments và bạn muốn mỗi segment chứa một Network.
Bây giờ bạn làm sao?

Địa chỉ IP trong Class C với default subnet mask 24 cho ta con số Hosts tối đa trong mỗi Network là [(2^X) – 2] = (2^8) – 2 = 254. Như thế segments Accounting và Marketing không bị trở ngại nào cả.

Nhưng ta thấy Segment Finance cần thêm 1 bit mới đủ. Ta làm như sau:

Bước 1: Liệt kê Network IP addresses trong dạng nhị phân
192.250.9.0/24 11000000 11111010 00001001 00000000 (1)
192.250.10.0/24 11000000 11111010 00001010 00000000 (2)
192.250.11.0/24 11000000 11111010 00001011 00000000 (3)
192.250.12.0/24 11000000 11111010 00001100 00000000 (4)

Bước 2: Nhận diện network prefix notation
23 bits đầu (từ trái qua phải) của 2 network IP address (2) and (3) đều giống nhau.

Nếu chúng ta thu Subnet mask từ 24 xuống 23 cho (2) và (3) ta sẽ có một Subnet có thể cung cấp 508 hosts.

IP address của mỗi segment trở thành:

Accounting: gồm 200 hosts: 192.250.9.0/24
Finance: gồm 400 hosts: 192.250.10.0/23
Marketing: gồm 200 hosts: 192.250.12.0/24

Bây giờ IP address 192.250.11.0 trở thành một HostID tầm thường trong Subnet 192.250.10.0/23.

Quá trình ta làm vừa qua bằng cách bớt số bits trong Subnet mask khi gom hai hay bốn (v.v..) subnets lại với nhau để tăng con số HostID tối đa trong một Subnet, được gọi là SUPERNETTING.

Supernetting đuợc dùng trong router bổ xung CIDR (Classless Interdomain Routing và VLSM (Variable Length Subnet Mask).

Và luôn luôn nhớ rằng trong internetwork, NETWORK ID phải là địa chỉ độc đáo (unique).

++++

IP Subnet Calculations
Tính toán mạng con trong giao thức mạng



1. IP Addressing (Địa chỉ giao thức mạng)

Điểm này bạn nên biết, giao thức mạng Internet thuộc giao thức lớp mạng (Mô hình OSI lớp 3), được dùng để tìm đường giữa các máy tính khác nhau trên mạng. để tương thích với mục đích này, IP phải định nghĩa theo hệ thống địa chỉ, để mà điểm đến mong muốn của một gói tin có thể được chỉ ra.


Một địa chỉ IP bao gồm 32 bits. Những Bits này được chia thành 4 bộ mỗi bộ 8 bits. Bạn thấy địa chỉ IP biểu thị như sau: 172.68.15.24. Tuy nhiên, chúng ta phải nhớ rằng máy tính chỉ hiểu các con số này theo dạng nhị phân, vì vậy chúng ta thường làm việc với nó theo số nhị phân. nhiều người ban đầu cảm thấy sợ khi gặp vấn đề này, nhưng bạn sẽ thấy nó không khó ngay khi tiếp xúc. Nếu bạn không bối rối, bạn có thể học giỏi chủ đề này.


Địa chỉ IP được gán theo cấu trúc khối. Mối khối thuộc một trong 3 lớp: lớp A, lớp B, lớp C. Bạn có thể phân biệt một địa chỉ IP thuộc lớp nào bằng cách xem khối 8 bit đầu tiên.

Lớp A
1-126

Lớp B
128-191

Lớp C
192-223 (Bổ sung_ Sorry tác giả)
Lớp D
..

Một địa chỉ IP bao gồm 2 khoảng. khoảng thứ 1 định dạng mạng, và cái còn lại định đạng số điểm (máy tính- thiết bị có IP) trong mạng. Bit nào thuộc khoảng mạng bit nào thuộc điểm trong mạng quyết định bởi mặt nạ mạng.

Khi một địa chỉ IP thuộc lớp A được cấp, bạn được gán con số dạng: 99.0.0.0. Chỉ giá trị của những bit thuộc bộ 8 đầu được gán. Điều này có nghĩa là bạn có thể tự do cho giá trị ở các bộ 8 còn lại.

Mặt nạ mạng mặc định cho lớp A là 255.0.0.0. Bit cao, 1, chỉ ra rằng những bit đó thuộc khoảng mạng của địa chỉ IP. mặt nạ mạng mặc định không chia mạng con. Do đó, Một mạng lớp A với mặc định mặt nạ mạng là một mạng. 3 bộ 8 không được gán và đánh dấu thuộc khoảng cho các thiết bị có thể nhận IP của địa chỉ. Có tổng cộng 24 bit trong 3 bộ 8 còn lại. Mỗi bit có thể có 1 hoặc 2 trạng thái. Do vậy, hầu hết tất cả 2^24 là số lượng địa chỉ máy có thể được gán trong mạng này. 2 địa chỉ dành riêng trong mỗi mạng là x.x.x.0 và x.x.x.255. Vì vậy số máy trong mạng lớp A là 2^24-2=16,777,214


Khi địa chỉ IP lớp B được cấp phát, 2 bộ 8 đầu tiên được gán. Chẳng hạn như, 172.198.x.x. Mặt nạ mạng mặc định cho lớp B là 255.255.0.0. Một mạng, 2 bộ 8b tự do, 16 bit dành cho địa chỉ các máy con. 2^16-2=65,534 địa chỉ máy có thể cấp cho các thiết bị thuộc lớp B.

Khi lớp C được cấp, 3 bộ 8 đầu được gán, ví dụ như 192.52.16.0. Mặt nạ mạng mặc định của lớp C là 255.255.255.0. Chỉ một bộ 8 cho các địa chỉ máy. 2^8-2-154 địa chỉ máy có thể cho lớp C

2. Reason for Subnetting (Lý đó để chia mạng)

Như đã nói, giá chị mặt nạ mạng mặc định cho địa chỉ IP lớp A là 255.0.0.0. Chỉ một bộ 8 của lớp A nhận dạng mạng khi dùng mặt nạ mạng này. Điều này để 3 bộ 8 bit hay 24 bit, chỉ ra số máy trong mạng. 2^24=16,777,216 địa chỉ. 2 địa chỉ dành riêng, x.x.x.0 và x.x.x.255. 16,777,214 máy là số đia chỉ IP có thể được cấp cho các máy trong mạng này.

Rất có thể là một tổ chức muốn 1 mạng với 16,777,2214 điểm. Có lẽ họ muốn nhiều thiết bị kết nối với nhau trong mạng diện rộng, như vậy có khả năng tương tác khi cần, nhưng họ sẽ muốn chia cái mạng lớp này thành các mạng độc lập của các điểm mà thường tương tác với nhau nhiều. Cái này gọi là Subnetting.

Để hiêu tại sao, xem xet cái gì xảy ra cả trong mạng quảng bá và mạng Token pasing (Pó tay) bao gồm hơn 16,000,000 điểm. Không có gì xảy ra. Đơn giản vì nó không hoạt động. Cho dù vấn đề không mãnh liệt, nhưng lớp B và C cũng thường được chia thành các mạng con.

Mặt nạ mạng được dùng để chia nhỏ một địa chỉ mạng ra thành các mạng con. Việc chia này xảy ra ở lớp 3 trong mô hình OSI, do đó sự phân chia hợp lý được tạo bởi hệ thống địa chỉ. Sự phân chi logic này thường đi đôi với phân chia vật lý. Nhiều mạng con bị cô lập về vật lý với phần còn lại của mạng bởi thiết bị như Router hay Switch. Bên ngoài của Subnetting được thảo luận trong bài 3 – Lớp Data link

http://www.nhatnghe.com/forum/showthread.php?t=2756&page=2


++++++++++++++++++++++++++++

Subnet Masks

Khi ta chia một Network ra thành nhiều Network nhỏ hơn, các Network nhỏ nầy được gọI là Subnet. Theo quy ước, các địa chỉ IP được chia ra làm ba Class (lớp) như sau:

Address Class


Subnet mask trong dạng nhị phân


Subnet mask

Class A


11111111 00000000 00000000 00000000


255.0.0.0

Class B


11111111 11111111 00000000 00000000


255.255.0.0

Class C


11111111 11111111 11111111 00000000


255.255.255.0

Subnet Mask của Class A bằng 255.0.0.0 có nghĩa rằng ta dùng 8 bits, tính từ trái qua phải (các bits được set thành 1), của địa chỉ IP để phân biệt các NetworkID của Class A. Trong khi đó, các bits còn sót lại (trong trường hợp Class A là 24 bits đuợc reset thành 0) được dùng để biểu diễn computers, gọi là HostID. Nếu bạn chưa quen cách dùng số nhị phân hãy đọc qua bài Hệ thống số nhị phân.
Subnetting

Hãy xét đến một địa chỉ IP class B, 139.12.0.0, với subnet mask là 255.255.0.0 (có thể viết là: 139.12.0.0/16, ở đây số 16 có nghĩa là 16 bits được dùng cho NetworkID). Một Network với địa chỉ thế nầy có thể chứa 65,534 nodes hay computers (65,534 = (2^16) –2 ) . Đây là một con số quá lớn, trên mạng sẽ có đầy broadcast traffic.

Giả tỉ chúng ta chia cái Network nầy ra làm bốn Subnet. Công việc sẽ bao gồm ba bước:

1) Xác định cái Subnet mask
2) Liệt kê ID của các Subnet mới
3) Cho biết IP address range của các HostID trong mỗi Subnet
Bước 1: Xác định cái Subnet mask

Để đếm cho đến 4 trong hệ thống nhị phân (cho 4 Subnet) ta cần 2 bits. Công thức tổng quát là:

Y = 2^X

mà Y = con số Subnets (= 4)
X = số bits cần thêm (= 2)

Do đó cái Subnet mask sẽ cần 16 (bits trước đây) +2 (bits mới) = 18 bits

Địa chỉ IP mới sẽ là 139.12.0.0/18 (để ý con số 18 thay vì 16 như trước đây). Con số hosts tối đa có trong mỗi Subnet sẽ là: ((2^14) –2) = 16,382. Và tổng số các hosts trong 4 Subnets là: 16382 * 4 = 65,528 hosts.
Bước 2: Liệt kê ID của các Subnet mới

Trong địa chỉ IP mới (139.12.0.0/18) con số 18 nói đến việc ta dùng 18 bits, đếm từ bên trái, của 32 bit IP address để biểu diễn địa chỉ IP của một Subnet.

Subnet mask trong dạng nhị phân


Subnet mask

11111111 11111111 11000000 00000000


255.255.192.0

Như thế NetworkID của bốn Subnets mới có là:

Subnet


Subnet ID trong dạng nhị phân


Subnet ID

1


10001011.00001100.00000000.00000000


139.12.0.0/18

2


10001011.00001100.01000000.00000000


139.12.64.0/18

3


10001011.00001100.10000000.00000000


139.12.128.0/18

4


10001011.00001100.11000000.00000000


139.12.192.0/18
Bước 3: Cho biết IP address range của các HostID trong mỗi Subnet

Vì Subnet ID đã dùng hết 18 bits nên số bits còn lại (32-18= 14) được dùng cho HostID.
Nhớ cái luật dùng cho Host ID là tất cả mọi bits không thể đều là 0 hay 1.

Subnet


HostID IP address trong dạng nhị phân


HostID IP address Range

1


10001011.00001100.00000000.00000001
10001011.00001100.00111111.11111110


139.12.0.1/18 -139.12.63.254/18

2


10001011.00001100.01000000.00000001 10001011.00001100.01111111.11111110


139.12.64.1/18 -139.12.127.254/18

3


10001011.00001100.10000000.00000001
10001011.00001100.10111111.11111110


139.12.128.1/18 -139.12.191.254/18

4


10001011.00001100.11000000.00000001 10001011.00001100.11111111.11111110


139.12.192.0/18 –139.12.255.254

Bạn có để ý thấy trong mỗi Subnet, cái range của HostID từ con số nhỏ nhất (màu xanh) đến con số lớn nhất (màu cam) đều y hệt nhau không?

Bây giờ ta thử đặt cho mình một bài tập với câu hỏi:

Bạn có thể dùng Class B IP address cho một mạng gồm 4000 computers được không? Câu trả lời là ĐƯỢC. Chỉ cần làm một bài toán nhỏ.

Giả tỉ cái IP address là 192.168.1.1. Thay vì bắt đầu với Subnet mask, trước hết chúng ta tính xem mình cần bao nhiêu bits cho 4000 hosts.

Con số hosts ta có thể có trong một network được tính bằng công thức:

Y = (2^X –2)

Nhớ cái luật dùng cho Host ID là tất cả mọi bits không thể đều là 0 hay 1.

4094 = (2^12 –2)
X = 12 , ta cần 12 bits cho HostIDs, do đó Subnet mask sẽ chiếm 20 (=32-12) bits.

Quá trình tính toán nói trên nầy mang tên là Variable Length Subnet Mask(VLSM).
Supernetting

Giả tỉ ta mạng của ta có 3 Subnets:

Accounting: gồm 200 hosts
Finance : gồm 400 hosts
Marketing: gồm 200 hosts

Bạn hòa mạng với Internet và được Internet Service Provider (ISP) cho 4 Class C IP addresses như sau:
192.250.9.0/24
192.250.10.0/24
192.250.11.0/24
192.250.12.0/24

Bạn có 3 segments và bạn muốn mỗi segment chứa một Network.
Bây giờ bạn làm sao?

Địa chỉ IP trong Class C với default subnet mask 24 cho ta con số Hosts tối đa trong mỗi Network là [(2^X) – 2] = (2^8) – 2 = 254. Như thế segments Accounting và Marketing không bị trở ngại nào cả.

Nhưng ta thấy Segment Finance cần thêm 1 bit mới đủ. Ta làm như sau:
Bước 1: Liệt kê Network IP addresses trong dạng nhị phân

192.250.9.0/24 11000000 11111010 00001001 00000000 (1)
192.250.10.0/24 11000000 11111010 00001010 00000000 (2)
192.250.11.0/24 11000000 11111010 00001011 00000000 (3)
192.250.12.0/24 11000000 11111010 00001100 00000000 (4)
Bước 2: Nhận diện network prefix notation

23 bits đầu (từ trái qua phải) của 2 network IP address (2) and (3) đều giống nhau.

Nếu chúng ta thu Subnet mask từ 24 xuống 23 cho (2) và (3) ta sẽ có một Subnet có thể cung cấp 508 hosts.

IP address của mỗi segment trở thành:

Accounting: gồm 200 hosts: 192.250.9.0/24
Finance: gồm 400 hosts: 192.250.10.0/23
Marketing: gồm 200 hosts: 192.250.12.0/24

Bây giờ IP address 192.250.11.0 trở thành một HostID tầm thường trong Subnet 192.250.10.0/23.

Quá trình ta làm vừa qua bằng cách bớt số bits trong Subnet mask khi gom hai hay bốn (v.v..) subnets lại với nhau để tăng con số HostID tối đa trong một Subnet, được gọi là SUPERNETTING.

Supernetting đuợc dùng trong router bổ xung CIDR (Classless Interdomain Routing và VLSM (Variable Length Subnet Mask).

Và luôn luôn nhớ rằng trong internetwork, NETWORK ID phải là địa chỉ độc đáo (unique).

http://www.echip.com.vn/echiproot/weblh/suutam/2002/vovisoft/submark.htm

++++++++++


An explanation of Subnet Masks

What is a subnet?

IP mask numbers are used to divide Internet addresses into logical blocks called subnets. They can also be used to organise network resources that may share varying degrees of common physical infrastructure but the network administrator wishes to keep logically separate for administrative reasons.

Please note that there are many topics and subtleties not covered here and this should be seen as a simplified overview.

What use are they?

Devices on the network use the mask to determine what network route data can take. The information for these routes is held in a look-up table called a routing table, which is essentially a list of subnets and where to send data intended for a device with an IP in that subnet.

Some subnets are pre-defined as being for special purposes. By convention several of these (eg IPs starting 10.x.x.x and 192.168.x.x) are used in local area networks and deemed 'private' addresses, which means that they can only connect to the rest of the Internet by a device that can translate their private address to a valid public one. This process is called Network Address Translation (NAT). Many network administrators opt for a NAT solution for the additional security it can provide, or because they don't have sufficient public IPs for every device on their network. In this case it is common for a smaller range from within one of the pre-defined 'private' ranges to be used.

Subnet masks can also be used as a convenience when we wish to refer to a block of addresses for administrative purposes, typically by referring to the first address in the range (the 'network address') and the appropriate mask.

eg: 192.168.4.0/30 will refer to the four addresses 192.168.4.0, 192.168.4.1, 192.168.4.2 and 192.168.4.3

What do they look like?

The 'slash' notation (ie /24) is known as CIDR (Classless Inter-Domain Routing) format (see the table below), while the more conventional 255.255.255.0 notation is more properly considered a subnet mask. These are often used interchangeably.

The mask pattern such as '255.255.255.0' is actually a decimal representation of four binary numbers separated by '.' , each number thus separated sometimes referred to as an 'octet' since each binary number has eight bits.

Since an eight bit number can represent 255 different values (not including zero), this is the highest value you will see in an octet.

The mask is derived by first representing an IP address in binary form. Some of the digits can be 'reserved' to represent the subnet. These start with the digits to the left. The network mask is a pattern of ones and zeros that tells the reader which bits to read to determine the subnet (the ones), and which bits to read to determine the individual device (the zeroes).

eg: 11111111.11111111.11111111.00000000

If a device receives an ip address with this mask, it knows that only the last 8 digits represent the unique IP address of the station, and the first 24 digits represent the subnet.

For readability this mask is then translated to some human readable form. In this case it is obvious that this 24-bit mask can be represented by the slash notation '/24'. The conversion from the binary octet '11111111' to decimal gives us '255' so the whole mask reads '255.255.255.0'.

The actual binary conversion process is straightforward - simply convert each octet individually. The Windows calculator can do it for you (Choose View/Scientific from the menu, hit the 'Bin' radio button, type in your number then hit the 'Dec' radio button).

If you want to do this conversion manually, it is easy enough. Numbers are represented by digits where the right most digit always represents 'units', and the preceding columns are powers of the base number.

eg:

9653 in Decimal (Base 10) 10^3="thousands" 10^2="hundreds" "tens" "ones"
9 6 5 3



252 in Binary (Base 2) 2^7=128 2^6=64 2^5=32 2^4=16 2^3=8 2^2=4 2 ones
1 1 1 1 1 1 0 0


The way to interpret the binary number is simply then to add up how many of each column we have. (This is simple in binary as we can only have one or none of each column)

128+64+32+16+8+4+0+0=252

Slash notation lookup table

Net bits: bits reserved for the network mask.

Total-addresses: how many unique addresses can be represented. To determine how many are available to be assigned to devices you need to subtract 2 from the provided number to allow for the 'network' and 'broadcast' address. A further one of these may need to be assigned to a router.

Net bits
Subnet mask Total-addresses

/20


255.255.240.0


4096

/21


255.255.248.0


2048

/22


255.255.252.0


1024

/23


255.255.254.0


512

/24


255.255.255.0


256

/25


255.255.255.128


128

/26


255.255.255.192


64

/27


255.255.255.224


32

/28


255.255.255.240


16

/29


255.255.255.248


8
/30

255.255.255.252


4

eg: 192.168.1.0/25 would include all address between 192.168.1.0 and 192.168.1.127.

eg: 192.168.1.128/25 would include all address between 192.168.1.128 and 192.168.1.255.

http://www.rm.com/Support/TechnicalArticle.asp?cref=TEC543024

++++++++++++++++++

Subnet Masks and Subnetting
A subnet allows the flow of network traffic between hosts to be segregated based on a network configuration. By organizing hosts into logical groups, subnetting can improve network security and performance.
Subnet Mask
Perhaps the most recognizable aspect of subnetting is the subnet mask. Like IP addresses, a subnet mask contains four bytes (32 bits) and is often written using the same "dotted-decimal" notation. For example, a very common subnet mask in its binary representation

11111111 11111111 11111111 00000000

is typically shown in the equivalent, more readable form

255.255.255.0

Applying a Subnet Mask
A subnet mask neither works like an IP address, nor does it exist independently from them. Instead, subnet masks accompany an IP address and the two values work together. Applying the subnet mask to an IP address splits the address into two parts, an "extended network address" and a host address.

For a subnet mask to be valid, its leftmost bits must be set to '1'. For example,

00000000 00000000 00000000 00000000

is an invalid subnet mask because the leftmost bit is set to '0'.

Conversely, the rightmost bits in a valid subnet mask must be set to '0', not '1'. Therefore,

11111111 11111111 11111111 11111111

is invalid.

All valid subnet masks contain two parts: the left side with all mask bits set to '1' (the extended network portion) and the right side with all bits set to '0' (the host portion), such as the first example above.

Next page > IP Subnetting in Practice > Pages:
1 - IP Address Notation,
2 - IP Address Classes, Broadcast and Multicast,
3 - IP Loopback and Private Addresses, IPv6 Anycast,
4 - DNS - Domain Name System,
5 - IP Network Numbering,
6 - Subnet Mask and Subnetting,
7 - IP Subnetting in Practice,
8 - CIDR - Classess Internet Domain Routing,
9 - IP Practice Test
Suggested Reading

Using IP Addresses on Home NetworksIP Tutorial Online CourseIP Technology Practice Exam
IP Address Tutorial - More

IP Address NotationDNS - Domain Name SystemCIDR - Classless Inter-Domain Routing
More About IP

Finding IP AddressesWorking With IP AddressesIP and IPv6 Network Protocols
Related Articles

IP Tutorial - Subnet Mask and SubnettingSubnet - Subnets in Computer NetworkingLinux Network Administrators Guide - 2.4.2. Subnet...Linux Network Administrators Guide - Creating SubnetsLinux Network Administrators Guide - 2.4.3. Gatewa...

http://compnetworking.about.com/od/workingwithipaddresses/a/subnetmask.htm

++

Subnetting in Practice
Subnetting works by applying the concept of extended network addresses to individual computer (and other network device) addresses.

An extended network address includes both a network address and additional bits that represent the subnet number... (see below)
More of this Feature
• IP Address Notation
• IP Address Classes, Broadcast and Multicast
• IP Loopback and Private Addresses, IPv6 Anycast
• DNS - Domain Name System
• IP Network Numbering
• IP Subnetting
• CIDR - Classless Internet Domain Routing

Related Resources
• IP Practice Test
• TCP/IP Basics
• IP Protocol

... . Together, these two data elements support a two-level addressing scheme recognized by standard implementations of IP. The network address and subnet number, when combined with the host address, therefore support a three-level scheme.

Consider the following real-world example. A small business plans to use the 192.168.1.0 network for its internal (intranet) hosts. The human resources department wants their computers to be on a restricted part of this network because they store payroll information and other sensitive employee data. But because this is a Class C network, the default subnet mask of 255.255.255.0 allows all computers on the network to be peers (to send messages directly to each other) by default.

The first four bits of 192.168.1.0 -

1100

place this network in the Class C range and also fix the length of the network address at 24 bits. To subnet this network, more than 24 bits must be set to '1' on the left side of the subnet mask. For instance, the 25-bit mask 255.255.255.128 creates a two-subnet network as follows.

Network address
(24 bits) Subnet number
(1 bit) Extended network Host address range
11000000 10101000 00000001 0 192.168.1.0 192.168.1.1 - 192.168.1.127
11000000 10101000 00000001 1 192.168.1.128 192.168.1.129 - 192.168.1.255

For every additional bit set to '1' in the mask, another bit becomes available in the subnet number to index additional subnets. A two-bit subnet number can support up to four subnets, a three-bit number supports up to eight subnets, and so on.
Private Networks and Subnets
As mentioned earlier in this tutorial, the governing bodies that administer Internet Protocol have reserved certain networks for internal uses. In general, intranets utilizing these networks gain more control over managing their IP configuration and Internet access. The default subnet masks associated with these private networks are listed below.

Network address range Default mask
10.0.0.0 - 10.255.255.255 255.0.0.0
172.16.0.0 - 172.31.255.255 255.240.0.0
192.168.0.0 - 192.168.255.255 255.255.0.0

Consult RFC 1918 for more details about these special networks.
Subnetting Review

Subnetting allows network administrators some flexibility in defining relationships among network hosts. Hosts on different subnets can only "talk" to each other through specialized network gateway devices like routers. The ability to filter traffic between subnets can make more bandwidth available to applications and can limit access in desirable ways.

http://compnetworking.about.com/od/workingwithipaddresses/l/aa043000b.htm

2 nhận xét:

MCSE nói...

thông tin bài tốt đẹp
cảm ơn MCSE

MCSE nói...

rất lớn thông tin cảm ơn cho chia sẻ với chúng tôi
MCSE