Network = Network Address + Netmask

 

IP networks (sometimes called subnets) are defined by specifying a network address plus a netmask. In effect, they define a position and an extent respectively.

 

The network address pinpoints a position within the internet's 4-billion-plus pool of addresses. (4-billion is the quantity that can be represented by the internet addressing system because its addresses are 32-bit binary numbers. That's as high as you can count with 32 bits.) The binary form of a legal network address is n consecutive bits having any value, followed by m consecutive bits having value 0, where n+m=32.

 

The netmask expresses a length, or the network's size. The binary form of a legal netmask is n consecutive bits having value 1, followed by m consecutive bits having value 0, where n+m=32.

 

          n                             m

 

 


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx        n + m = 32

 

 

 

Network address's form: Netmask's form:

 

          n                             m                                      n                                 m

 

 


xxxxxxxxxxx000000000000000000000         11111111111000000000000000000000

 

 

 

The network then consists of the number of addresses represented by the netmask, laid end-to-end starting at the network address (inclusive) and proceeding till the defined number of addresses has been exhausted.

 

The number of addresses represented by a netmask is 2 raised to the power equal to the number of zeros at the end of the netmask. For example:

 

11111111 11111111 11111111 11111000 represents 2 to the 3rd power, or 8 addresses. (This netmask in dot-quad notation is 255.255.255.248.)

 

11111111 11111111 11111111 11100000 represents 2 to the 5th power, or 32 addresses. (This netmask in dot-quad notation is 255.255.255.224.)

 

So the network defined by network address 209.220.186.8 and netmask 255.255.255.252 consists of 4 addresses (2 raised to the 2 zeros at the end of 252) counted off consecutively starting with 209.220.186.8, or

 

209.220.186.8

209.220.186.9

209.220.186.10

209.220.186.11.

 

The network defined by network address 209.220.186.8 and netmask 255.255.255.248 consists of 8 addresses (2 raised to the 3 zeros at the end of 248) counted off consecutively starting with 209.220.186.8, or

 

209.220.186.8

209.220.186.9

209.220.186.10

209.220.186.11

209.220.186.12

209.220.186.13

209.220.186.14

209.220.186.15.

 

By contrast the network defined by network address 209.220.186.8 and netmask 255.255.255.240 is not a legal network. This network is 16 addresses in extent (2 raised to the 4 zeros at the end of 240). But network addresses must be integral multiples of the size defined by their netmask. 8, while it is an integral multiple of both 4 and 8 so that the above 2 examples are valid, is not an integral multiple of 16 so this one is invalid. If you want to define a network with netmask 255.255.255.240 (i.e., a 16-address network) you must position it at, for example, 209.220.186.0 or 209.220.186.16 or 209.220.186.32.

 

For a given IP address, the address of the network to which it belongs can be derived by binary AND-ing it with that network's netmask. Doing so with any of the 4 addresses in above network 209.220.186.8/255.255.255.252 will yield 209.220.186.8. And doing so with any of the 8 addresses in above network 209.220.186.8/255.255.255.248 will also yield 209.220.186.8.

 

 

 

Assignment:

 

Test the practical legality of the subnets defined below by attempting to make route destinations out of them with the Linux "route" command. The route command will accept those that are legal, and create an error (with a screen showing route's syntax) for those that are illegal. Here are the subnets for you to test:

 

 

    network address/netmask

 

1) 209.220.186.96/255.255.255.224

2) 209.220.186.96/255.255.255.192

3) 209.220.186.240/255.255.255.240

4) 209.220.186.240/255.255.255.224

5) 209.220.186.128/255.255.255.192

6) 209.220.186.128/255.255.255.64

7) 209.220.16.80/255.255.255.240

8) 209.220.186.64/255.255.255.192

 

You would test each one by specifying both its network address and netmask in the route command. So for the first example you would issue the command:

 

route add -net 209.220.186.96 netmask 255.255.255.224 eth0

 

       [ Note: interface name may not be "eth0", 

          probably "eno1" on class laptops or "enp0s3" on VirtualBox virtual machines
          "ifconfig -a" lists existing interfaces ]

 

in order to see whether the command "takes" or not. If it does, the routing table will show the new route. (Before doing this make sure eth0 has an address assigned to it. Assign one by issuing the command "ifconfig eth0 192.168.3.1".) You can view the routing table by issuing the command:

 

route -n

 

(If at any point you wish to remove a route you have entered into the table, issue the exact same command you used to enter it with add replaced by del." For example:

 

route del -net 209.220.186.96 netmask 255.255.255.224 eth0

 

removes the line added above to the routing table. You can reproduce on the command line a previously issued command by successively pressing the up-arrow key, which operates in Linux the same way as with the doskey program in DOS.)

 

For every subnet definition you are to provide three answers. First, telling whether the route command succeeded or failed. Second, an explanation for failure. Third, a number giving the size of the subnet your route command is trying to create (which is expressed by its netmask).

 

Finally, for subnets 7 and 8, look closely at them and the relationship between them. (For clarity of understanding I suggest for these, and for all of them, that you draw a linear diagram locating and sizing the subnet on an address number line.) You should perceive what might appear to be a conflict between them. Identify in your own mind the apparent conflict and try to explain the observed result in relation to it. Be prepared to offer an explanation in class (this question not to be included in the answer file you'll submit).

 

What to submit:

[ If your class is utilizing Canvas, the questions below are embodied in a Canvas quiz. Take that quiz, ignoring alternative submittal instructions below. ]

Submit your answers to the questions following these preparation and submittal instructions (you will use ftp to deposit your answer file in your "assignments" subdirectory on the remote server). Please name your file "masks.txt". I will grade these using an automated script, so the format of the answer is critical to intelligibility.

 1. The route command for network 1

 a. succeeded
 b. failed

 

2. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

3. The size of the subnet your route command is implicitly trying to create for network 1, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

4. The route command for network 2

 a. succeeded
 b. failed

 

5. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

6. The size of the subnet your route command is implicitly trying to create for network 2, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

7. The route command for network 3

 a. succeeded
 b. failed

 

8. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

9. The size of the subnet your route command is implicitly trying to create for network 3, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

10. The route command for network 4

 a. succeeded
 b. failed

 

11. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

12. The size of the subnet your route command is implicitly trying to create for network 4, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

13. The route command for network 5

 a. succeeded
 b. failed

 

14. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

15. The size of the subnet your route command is implicitly trying to create for network 5, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

16. The route command for network 6

 a. succeeded
 b. failed

 

17. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

18. The size of the subnet your route command is implicitly trying to create for network 6, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

19. The route command for network 7

 a. succeeded
 b. failed

 

20. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

21. The size of the subnet your route command is implicitly trying to create for network 7, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined

 

---

 

22. The route command for network 8

 a. succeeded
 b. failed

 

23. Why did it fail?
 a. I just told you, it didn't fail!
 b. because the network address isn't a multiple of the netmask-indicated network size

 c. because the network address final octet isn't a power of two
 d. because the netmask-indicated size isn't a multiple of the network address
 e. because the netmask given isn't a legal one
 f. because the network address given isn't a legal one

 

24. The size of the subnet your route command is implicitly trying to create for network 8, based on the command's netmask, is
 a. 4

 b. 8

 c. 16

 d. 32

 e. 64

 f. 128

 g. 256

 h. undetermined