10.11 The Default Route

10.12 Problem With Incorrect Subnet Mask

A standard Internet Protocol address field has two parts: a network address and a local address. Subnet addressing allows an autonomous system made up of multiple networks to share the same Internet address. To make subnets possible, the local address part of an Internet address is divided into a subnet number and a host number. The bits that identify the subnet are specified by a bit mask.

A machine with IP address 192.168.3.1 is communicating with another IP address, 192.168.1.2, both with netmask 255.255.0.0, such that they are both on network address 192.168.

The network definition of the first machine with IP address 192.168.3.1 is as follows:

# netstat -rn
Routing tables
Destination      Gateway           Flags   Refs     Use  If   PMTU  Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default          9.3.1.74          UG        0        3  tr0     -   -
9.3.1/24         9.3.1.141         U        37    44175  tr0     -   -
127/8            127.0.0.1         U         3      332  lo0     -   -
192.168.0/16     192.168.3.1       U         0       17  en0     -   -

Route Tree for Protocol Family 24 (Internet v6):
::1              ::1               UH        0        0  lo0 16896   -
# ifconfig en0
en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64B
IT>
        inet 192.168.3.1 netmask 0xffff0000 broadcast 192.168.255.255
# ping 192.168.1.2
PING 192.168.1.2: (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=1 ms
64 bytes from 192.168.1.2: icmp_seq=1 ttl=255 time=0 ms
^C
----192.168.1.2 PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/0/1 ms
#

The network definition of the first machine with IP address 192.168.1.2 is as follows:

# netstat -rn
Routing tables
Destination      Gateway           Flags   Refs     Use  If   PMTU  Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default          9.3.1.74          UG        0       13  tr0     -   -
9.3.1/24         9.3.1.124         U        33   784208  tr0     -   -
127/8            127.0.0.1         U         4      319  lo0     -   -
192.168.0/16     192.168.1.2       U         0        4  en0     -   -

Route Tree for Protocol Family 24 (Internet v6):
::1              ::1               UH        0        0  lo0 16896   -
# ifconfig en0
en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64B
IT>
        inet 192.168.1.2 netmask 0xffff0000 broadcast 192.168.255.255
# ping 192.168.3.1
PING 192.168.3.1: (192.168.3.1): 56 data bytes
64 bytes from 192.168.3.1: icmp_seq=0 ttl=255 time=1 ms
64 bytes from 192.168.3.1: icmp_seq=1 ttl=255 time=0 ms
^C
----192.168.3.1 PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/0/1 ms
#

If the netmask definition of the machine with IP address 192.168.1.2 is changed to 255.255.255.0 making the network address 192.168.1, then the two machines will no long communicate:

# netstat -rn
Routing tables
Destination      Gateway           Flags   Refs     Use  If   PMTU  Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default          9.3.1.74          UG        0       13  tr0     -   -
9.3.1/24         9.3.1.124         U        34   822719  tr0     -   -
127/8            127.0.0.1         U         4      319  lo0     -   -
192.168.1/24     192.168.1.2       U         0        0  en0     -   -

Route Tree for Protocol Family 24 (Internet v6):
::1              ::1               UH        0        0  lo0 16896   -
# ifconfig en0
en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64B
IT>
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
# ping 192.168.3.1
PING 192.168.3.1: (192.168.3.1): 56 data bytes
^C
----192.168.3.1 PING Statistics----
2 packets transmitted, 0 packets received, 100% packet loss
#

The network definition of the machine with IP address 192.168.3.1 is unchanged, but the ping command no longer works:

# netstat -rn
Routing tables
Destination      Gateway           Flags   Refs     Use  If   PMTU  Exp  Groups

Route Tree for Protocol Family 2 (Internet):
default          9.3.1.74          UG        0        3  tr0     -   -
9.3.1/24         9.3.1.141         U        37    44663  tr0     -   -
127/8            127.0.0.1         U         3      332  lo0     -   -
192.168.0/16     192.168.3.1       U         0       26  en0     -   -

Route Tree for Protocol Family 24 (Internet v6):
::1              ::1               UH        0        0  lo0 16896   -
# ifconfig en0
en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 192.168.3.1 netmask 0xffff0000 broadcast 192.168.255.255
# ping 192.168.1.2
PING 192.168.1.2: (192.168.1.2): 56 data bytes
^C
----192.168.1.2 PING Statistics----
4 packets transmitted, 0 packets received, 100% packet loss
#

10.13 Value of thewall on Network Traffic