* Remark: from 0-255 (000000002 to 111111112 )
Network ID 1-126 (7-bits)* | Host ID 0-255 | Host ID 0-255 | Host ID 0-255 |
Network ID
Host ID
* Remark: 127 is reserved (預留) for loopback and diagnostic (診斷) functions.
Network ID 128-191 (6-bits)* | Network ID 0-255 | Host ID 0-255 | Host ID 0-255 |
Network ID
Host ID
Network ID 192-223 (5-bits)* | Network ID 0-255 | Network ID 0-255 | Host ID 0-255 |
Network ID
Host ID
224.0.0.0 to 239.255.255.255 is used for multicast packets to send to a group of hosts.
e.g. WINS server use multicast packets to call WINS clients.
240.0.0.0 to 255.255.255.254 is reserved for future use.
* Remark: 255.255.255.255 represent to broadcast.
Subnet mask is used to identify the source IP and the destination IP belong
to local network or remote network,
so IP Address must work with subnet mask.
e.g.1
A |
![]() |
-----------------------> | ![]() |
B |
Computer A | IP | 128.64.32.2 | 10000000.00100000.00010000.00000010 |
Subnet Mask | 255.0.0.0 | 11111111.00000000.00000000.00000000 | |
Network | 128.0.0.0 | 10000000.00000000.00000000.00000000 | |
Computer B | IP | 128.64.32.3 | 10000000.00100000.00010000.00000011 |
Subnet Mask | 255.0.0.0 | 11111111.00000000.00000000.00000000 | |
Network | 128.0.0.0 | 10000000.00000000.00000000.00000000 |
So Computer A and Computer B is located in same network (local network), the packets can sent directly.
e.g.2
A |
![]() |
-----------------------> | ![]() |
B |
Computer A | IP | 128.64.32.2 | 10000000.00100000.00010000.00000010 |
Subnet Mask | 255.255.0.0 | 11111111.11111111.00000000.00000000 | |
Network | 128.64.0.0 | 10000000.00100000.00000000.00000000 | |
Computer B | IP | 128.64.32.3 | 10000000.00100000.00010000.00000011 |
Subnet Mask | 255.0.0.0 | 11111111.00000000.00000000.00000000 | |
Network | 128.0.0.0 | 10000000.00000000.00000000.00000000 |
So Computer A and Computer B is located in remote network, the packets is sent to default gateway (Router).
Subnetting network means to dividing a network into multiple smaller network.
* the subnet bits cannot be all 0 or all 1.
* subnet bits 由頭取出, 不能分開.
e.g.1
IP | 128.64.32.2 | 10000000.01000000.00100000.00000010 |
Subnet Mask | 255.224.0.0 ## | 11111111.11100000.00000000.00000000 |
Network | 128.64.0.0 | 10000000.01000000.00000000.00000000 |
## when using 224 as subnetting, we can have 6 subnet:
00100000 | 32 |
01000000 | 64 |
01100000 | 96 |
10000000 | 128 |
10100000 | 160 |
11000000 | 192 |
e.g.2
A |
![]() |
-----------------------> | ![]() |
B |
Computer A | IP | 128.40.32.2 | 10000000.00100100.00010000.00000010 |
Subnet Mask | 255.224.0.0 | 11111111.11100000.00000000.00000000 | |
Network | 128.32.0.0 | 10000000.00100000.00000000.00000000 | |
Computer B | IP | 128.196.32.3 | 10000000.11000100.00010000.00000011 |
Subnet Mask | 255.224.0.0 | 11111111.11100000.00000000.00000000 | |
Network | 128.192.0.0 | 10000000.11000000.00000000.00000000 |
So Computer A and Computer B is located in remote network, the packets is sent to default gateway (Router).
Computer A is belongs to 128.32.0.0 network, host ID= 8.32.2
Computer B is belongs to 128.192.0.0 network, host ID= 4.32.3
e.g.3
A |
![]() |
-----------------------> | ![]() |
B |
Computer A | IP | 200.200.100.100 | 11001000.11001000.01100100.01100100 |
Subnet Mask | 255.255.255.224 | 11111111.11111111.11111111.11100000 | |
Network | 200.200.100.96 | 11001000.11001000.01100100.01100000 | |
Computer B | IP | 200.200.100.130 | 11001000.11001000.01100100.10000010 |
Subnet Mask | 255.255.255.224 | 11111111.11111111.11111111.11100000 | |
Network | 200.200.100.128 | 11001000.11001000.01100100.10000000 |
So Computer A and Computer B is located in remote network, the packets is sent to default gateway (Router).
Computer A is belongs to 200.200.100.96 network, host ID= 4
Computer B is belongs to 200.200.100.128 network, host ID = 2
Also called CIDR (Classless InterDomain Routing)
Supernetting is used to combine some small network into a lager network.
e.g.
Your company has been assigned 8 class C network.
Network |
|
220.78.168.0 | 11011100.01001110.10101000.00000000 |
220.78.169.0 | 11011100.01001110.10101001.00000000 |
220.78.170.0 | 11011100.01001110.10101010.00000000 |
220.78.171.0 | 11011100.01001110.10101011.00000000 |
220.78.172.0 | 11011100.01001110.10101100.00000000 |
220.78.173.0 | 11011100.01001110.10101101.00000000 |
220.78.174.0 | 11011100.01001110.10101110.00000000 |
220.78.175.0 | 11011100.01001110.10101111.00000000 |
Seen in binary, we notice that the first five bits is same, hence, we can use the supernet mask:
255.255.248.0=11111111.11111111.11111000.00000000