One of the things that I find both counterintuitive and often misunderstood is the role of the network command in interior gateway protocols. This command is used in the router configuration mode on Cisco devices. While there are some protocol specifics that should be understood, it behaves similarly between RIP, EIGRP and OSPF. The common misconception is that the network statement determines what will be advertised. While it can affect what is being advertised, that is not the direct purpose of this command.
If you have mistakenly thought the network command determines what is being advertised, you’re certainly not alone. We can even find verbiage in the output of “show ip protocols” that lends credibility to this position. Let’s take a look at the following configuration.
In the above example, I have enable EIGRP on all of the interfaces.
interface Loopback0 ip address 184.108.40.206 255.255.255.0 interface Loopback1 ip address 220.127.116.11 255.255.255.0 interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 router eigrp 1 network 18.104.22.168 0.0.0.0 network 22.214.171.124 0.0.0.0 network 192.168.1.1 0.0.0.0 auto-summary
interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.0 interface FastEthernet0/1 no ip address router eigrp 1 network 192.168.1.2 0.0.0.0 auto-summary
Notice the output of show ip protocols on R1
R1#show ip protocols Routing Protocol is "eigrp 1" Outgoing update filter list for all interfaces is not set // --snip-- for brevity Automatic network summarization is in effect Automatic address summarization: 192.168.1.0/24 for Loopback0, Loopback1 126.96.36.199/8 for FastEthernet0/0, Loopback0 Summarizing with metric 128256 188.8.131.52/8 for FastEthernet0/0, Loopback1 Summarizing with metric 128256 Maximum path: 4 Routing for Networks: 184.108.40.206/32 220.127.116.11/32 192.168.1.1/32 // --snip-- for brevity
I would like to call attention to the section that says Routing for Networks and indicates three IP addresses with a /32 mask. This information is derived directly from the network statements. Moreover, the router isn’t really routing for these specific routes, it is routing for the interfaces that have IP addresses that MATCH these entries.
To prove this, let’s see what R2 has in it’s routing table.
R2#show ip route // --snip-- for brevity Gateway of last resort is not set D 18.104.22.168/8 [90/409600] via 192.168.1.1, 00:14:47, FastEthernet0/0 D 22.214.171.124/8 [90/409600] via 192.168.1.1, 00:14:13, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet0/0
As we can see the routes are actually summaries addresses from the subnets represented by Loopback0 and Loopback1. Let’s go back to R1 and disable auto-summarization so we can get a clearer picture.
R1(config)#router eigrp 1 R1(config-router)#no auto-summary
R2#show ip route // --snip-- for brevity Gateway of last resort is not set 126.96.36.199/24 is subnetted, 1 subnets D 188.8.131.52 [90/409600] via 192.168.1.1, 00:00:39, FastEthernet0/0 184.108.40.206/24 is subnetted, 1 subnets D 220.127.116.11 [90/409600] via 192.168.1.1, 00:00:39, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet0/0
Now we can see that there is an exact correlation between the EIGRP learned routes at R2 and the loopback interfaces of R1. The network statements and what is listed in “show ip protocols” are in sync. However, the /24 routes associated with the individual Loopback interfaces are what is being advertised.
So what exactly is the role of the network statement if it isn’t to describe what should be advertised? The short answer to this question is that these statements determine what interface or interfaces should run the given routing protocol. It does this by matching the IP address on the interface. To illustrate this point, let’s take another look at R1.
interface Loopback0 ip address 18.104.22.168 255.255.255.0 interface Loopback1 ip address 22.214.171.124 255.255.255.0 interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 router eigrp 1 network 126.96.36.199 0.0.0.0 network 188.8.131.52 0.0.0.0 network 192.168.1.1 0.0.0.0
As the EIGRP process assesses which interfaces it should run on, all interfaces have IP addresses that match EIGRP network statements. For example, network 184.108.40.206 0.0.0.0 matches the IP on Loopback0. Since Loopback0 represents network 220.127.116.11/24, the entire /24 is what will be advertised.
The mask of 0.0.0.0 is a configuration that expects an exact match. We don’t always have to configure the network statement to do an exact match. A configuration that would enable EIGRP on any IPv4 interface would look like the following.
router eigrp 1 network 0.0.0.0 255.255.255.255
Some people prefer to inversely match the wildcard mask with the subnet mask. For example:
router eigrp 1 network 18.104.22.168 0.0.0.255 network 22.214.171.124 0.0.0.255 network 192.168.1.0 0.0.0.255
In either case, the wildcard mask expects an exact match only where the 0’s are found. For example, the first statement above attempts to match 1.1.1.x. The example of 0.0.0.0 255.255.255.255 matches x.x.x.x (or anything). The point here is that we’re performing a match to enable the protocol for a represented network.
Most would find this concept easier to grasp if we simply enabled the protocol on a given interface. That is actually what we do with IPv6 IGP configurations.
The final thing I would mention regarding network statements is that IOS makes some assumptions when we don’t provide a mask. In the case of entering a normal Class A, Class B or Class C address, the router assumes the associated class and doesn’t show any wildcard mask. It even changes the IP address as necessary to provide to the classful network.
R2(config)#router eigrp 1 R2(config-router)#network 10.1.1.0 R2(config-router)#do show run | sec eigrp router eigrp 1 network 10.0.0.0
Notice that Class A address 10.1.1.0 was converted to 10.0.0.0, the classful network it belongs to.
Network Statements are a configuration construct found in the Cisco IOS syntax. Although it is often otherwise stated, the network statements only indirectly determine what will be advertised. These statements allow a given routing protocol the information necessary to determine what interfaces will participating. From that point, the routing protocol takes over and advertises the networks as appropriate to the specific Interior Gateway Protocol being used.