Everyone should come to the #CCNA game ready to configure OSPF, with network commands, and with wildcard masks that match entire classful networks, match subnets, and match individual IP addresses. Use today’s post to check your answers. But it’s always best to read the original lab and try it for yourself first!
Answers
Figure 1: Three Router Triangle with IP Subnets
Example 4: R1 Config
router ospf 5 router-id 1.1.1.1 network 172.30.0.0 0.0.255.255 area 0 network 172.16.0.0 0.0.255.255 area 0
Example 5: R2 Config
router ospf 5 router-id 2.2.2.2 network 172.30.1.2 0.0.0.0 area 0 network 172.30.1.5 0.0.0.0 area 0 network 172.16.2.2 0.0.0.0 area 0
Example 6: R3 Config
router ospf 5 router-id 3.3.3.3 network 172.30.1.4 0.0.0.3 area 0 network 172.30.1.4 0.0.0.3 area 0 network 172.16.3.0 0.0.0.255 area 0
Commentary
First, ignore the network commands for a moment. For this lab each of the routers will be configured with an OSPF process ID of 5 (this is a locally significant number only). R1 will be configured with a router-id of 1.1.1.1, R2 will be configured with a router-id of 2.2.2.2 and R3 will be configured with a router-id of 3.3.3.3 using the router-id command.
Could you have used different process IDs and router IDs? Sure. Those are simply the numbers this lab exercise asked you to use.
???wwo – note to self – the next bit, up to “R1’s Configuration” is copied from “Traditional OSPF – 1”. Thanks, Wendell
The most problematic area that people have with the legacy configuration of OSPF is with the network command, specifically the wildcard mask. The wildcard mask (as used with IP Access Control Lists, or ACLs) limits the parts of the interface IP addresses that is compared to the number in a network command.
Deeper Background
While this lab does not get into all the theory of wildcard masks, but I felt the need for a little more detail than normal in this case. To match all addresses in a classful network, you need to use one of three easily-understood wildcard masks. In particular:
- Class A: Wildcard mask 0.255.255.255 means “compare the first 1 octet, ignore the last 3”, which is useful for matching all addresses in a class A network
- Class B: Wildcard mask 0.0.255.255 means “compare the first 2 octets, ignore the last 2 octets”, which is useful for matching all addresses in a class B network
- Class C: Wildcard mask 0.0.0.255 means “compare the first 3 octets, ignore the last 1 octet”, which is useful for matching all addresses in a class C network
To match all addresses in the subnet connected to an interface, you have two calculate two values. First, calculate the subnet ID as usual. Then, calculate the wildcard mask by subtracting the subnet mask from 255.255.255.255. That is, if you subtract a subnet mask (in dotted decimal form) from 255.255.255.255, the resulting wildcard mask can be used when matching all packets in a subnet that uses that mask. For instance:
- To match subnet 10.1.1.0 255.255.255.0, use wildcard mask 0.0.0.255.
- To match subnet 10.1.1.0 255.255.255.192, use wildcard mask 0.0.0.63.
- To match subnet 10.1.1.0 255.255.255.224, use wildcard mask 0.0.0.31.
Network Commands on R1
The lab asked us to match only classful networks with R1’s network command. As it turns out, R1 connects to two different class B networks: 172.16.0.0 and 172.30.0.0. As class B networks, with default mask 255.255.0.0, the correct wildcard mask to match that range of addresses is 0.0.255.255, meaning “match interfaces with the same first two octets”. The two network commands list the classful networks, wildcard mask 0.0.255.255, and area 0.
Network Commands on R2
For R2, the lab asked us to match the specific IP addresses on the interface. To do that, use wildcard mask 0.0.0.0, which means “all four octets of the address must match”. With three interfaces configured with IPv4 addresses, R2 needed three network commands, each listing the exact IPv4 address of R2’s interfaces, with wildcard mask 0.0.0.0.
Network Commands on R3
R3 has the requirement that each network command match only the addresses in a single subnet. To create this configuration, each network command uses the DDN subnet mask, subtracted from 255.255.255.255. R3 uses two different subnet masks, resulting in two different wildcard masks, as follows:
255.255.255.252 – results in wildcard mask 0.0.0.3
255.255.255.0 – results in wildcard mask 0.0.0.255
The resulting configuration lists two network commands that happen to have a wildcard mask of 0.0.0.3, because two interfaces on R3 (G0/1, G0/2) use DDN wildcard mask 255.255.255.252. The last network command on R3 uses wildcard mask 0.0.0.255, along with subnet 172.16.3.0, which matches all IP addresses in subnet 172.16.3.0 255.255.255.0.