开发者

subneting in cidr notation

I just have problem with subneting network address in CID开发者_开发知识库R notaion ,can anyone explain it for me? for example how can I solve this question:

Give the subnet addresses in CIDR notation if the network address 197.23.37.128/25 is divided into 4 subnets (you can use both the first and last subnets)

Any help would be appreciated


There is a great perl script available that will help you visualize how this works. Example output:

$ ./ipcalc 197.23.37.128/25
Address:   197.23.37.128        11000101.00010111.00100101.1 0000000
Netmask:   255.255.255.128 = 25 11111111.11111111.11111111.1 0000000
Wildcard:  0.0.0.127            00000000.00000000.00000000.0 1111111
=>
Network:   197.23.37.128/25     11000101.00010111.00100101.1 0000000
HostMin:   197.23.37.129        11000101.00010111.00100101.1 0000001
HostMax:   197.23.37.254        11000101.00010111.00100101.1 1111110
Broadcast: 197.23.37.255        11000101.00010111.00100101.1 1111111
Hosts/Net: 126                   Class C

The network part of the mask in your problem is 25 bits long. If you want to divide it into 4 more subnets, you need two more bits. (because math.pow(2,2) == 4) So you'd have to extend it to a /27, as follows:

$ ./ipcalc 197.23.37.128/27
Address:   197.23.37.128        11000101.00010111.00100101.100 00000
Netmask:   255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Wildcard:  0.0.0.31             00000000.00000000.00000000.000 11111
=>
Network:   197.23.37.128/27     11000101.00010111.00100101.100 00000
HostMin:   197.23.37.129        11000101.00010111.00100101.100 00001
HostMax:   197.23.37.158        11000101.00010111.00100101.100 11110
Broadcast: 197.23.37.159        11000101.00010111.00100101.100 11111
Hosts/Net: 30                    Class C

To get the next group of 5 bits, add one to the network mask:

$ python
>>> 128 + 0b100000
160

So your next subnet is 197.23.37.160/27, and so on.


You might take a look at the Wikipedia article on CIDR. The /25 means that the first 25 bits of the address are used for identifying the network. This leaves 7 bits to identify individual hosts, or 128 host addresses. If you partition (4) the remaining addresses, then you get blocks of 32 hosts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜