ifconfig/route network exercise


Work with 1 or more other students. Establish your group now. Members of the student group will choose and apply to their computers IP network addresses that place the computers into a common network group ("subnet"). You will then be able to communicate intra-group. Then members of your network will each set up their machine to reach one of the other networks in the classroom. You will then be able to communicate inter-group.

Background information:

A netmask tells the number of machines that can be in a network-- the network size. Without explanation, here are the netmasks for networks of various sizes:

For groups of 128 (126 machines) - 255.255.255.128  or  /25
For groups of 64 (62 machines) - 255.255.255.192  or  /26
For groups of 32 (30 machines) - 255.255.255.224  or  /27
For groups of 16 (14 machines) - 255.255.255.240  or  /28
For groups of 8 (6 machines) - 255.255.255.248  or  /29
For groups of 4 (2 machines) - 255.255.255.252  or  /30

The linux "route" command (at left, or equivalent "ip" command at right) can add routes to the local route table:

Add route to a machine (host route):

route add –host 192.168.4.2 eth0

or,   ip route add 192.168.4.2 dev eth0

Add route to a group of machines (network route - local): 

route add –net 192.168.4.0 netmask 255.255.255.0 eth0 

ip route add 192.168.4.0/24 dev eth0

Add route to a group of machines (network route - gatewayed):

route add –net 192.168.5.0 netmask 255.255.255.0 gw 192.168.4.1 

ip route add 192.168.5.0/24 via 192.168.4.1

Add route to “any and all” (default route):

route add default gw 192.168.4.1

ip route replace default via 192.168.4.1

View the route table:

route -n

ip route show

 

Network definition/planning:

1) Choose values for the first 3 octets of the network you are going to create. Octets can't exceed 254.
     Example: 10.20.30

2) Choose a network size, from among those shown above (e.g., 8 or 32).
     Example: 16

3) Note and write down the netmask for that size.
     Example: 255.255.255.240

4) Decide where your network will start. You've chosen its size. But, if the size is 4 and the first 3 octets are 100.110.120, your 4-value net might mathematically be

100.110.120.0
100.110.120.1  or:
100.110.120.2
100.110.120.3
100.110.120.1
100.110.120.2  or:
100.110.120.3
100.110.120.4
100.110.120.179
100.110.120.180  or:
100.110.120.181
100.110.120.182
100.110.120.204
100.110.120.205
100.110.120.206
100.110.120.207

But there is a constraint. The value of the 4th octet of the 1st address in your network's address range must be an integral multiple of your network size. So the middle two examples are illegal because neither 1 nor 179 is a multiple of 4. While the first and last examples are fine because both 0 and 204 are multiples of 4. Starting with your chosen size, choose some integer multiplier of it such that the product doesn't exceed 255.
Example: 9

5) Compose the 4th octet of your network's address by doing the multiplication.
Example: 9 x 16 = 144

6) Write out the full IP address of your network.
Example: 10.20.30.144

7) Write down the entire set of addresses that comprise your network.
Example:
10.20.30.144
10.20.30.145
10.20.30.146
10.20.30.147
10.20.30.148
10.20.30.149
10.20.30.150
10.20.30.151
10.20.30.152
10.20.30.153
10.20.30.154
10.20.30.155
10.20.30.156
10.20.30.157
10.20.30.158
10.20.30.159


Network implementation/creation:

1) Choose one of the addresses from your network's set other than a) the first one, b) the last one, or c) one that another student has chosen. Consult with the other students in your group to satisfy (c).
Example: 10.20.30.153

2) Apply it to your computer's NIC (network interface card) with the linux command ifconfig <interface> <address> netmask <netmask>
Example:  ifconfig eth0 10.20.30.153 netmask 255.255.255.240     or     ip addr add 10.2.30.153/28 dev eth0

3) Test your "integration" with fellow members by ensuring you can ping them:
Example: ping 10.20.30.145

4) Test your inability to contact addresses outside your network by trying to ping one which starts with the same 3 octets but a "wrong" 4th octet. Note the resulting error message.
Example: ping 10.20.30.100

5) Examine your routing table with the linux command route -n. Look for information in the table that seems to suggest your observed ability to ping within but inability to ping outside your network.

6) Speak to another group in the classroom. Have them give you their network address and netmask. Give them yours.
Example: 192.240.17.48 and 255.255.255.248 (theirs, suppose)

7) Try to ping one of their members. Note the failure. Your machine doesn't know that they are reachable through your NIC. For that matter, their machines are similarly ignorant of your existence. The 2 networks are not logically integrated with each other. Below we change that.
Example: ping 192.240.17.50

8) Augment your routing table to inform your machine who "they" are (in terms of (4) ) and where (in terms of the network interfaces available to/within your machine) with the linux command route add -net <network address> netmask <netmask> <interface>.
Example:  route add -net 192.240.17.48 netmask 255.255.255.248 eth0  or   ip route add 192.240.17.48/29 dev eth0

9) After they have reciprocated, test your two networks' integration by ensuring you can ping one of their members:
Example: ping 192.240.17.50