Hello David
The main difference between the network 1.1.1.1 0.0.0.255
command and the redistribute connected
command lies in the way they function.
The network
command is used to specify which interfaces the routing protocol should run on. In your example, network 1.1.1.1 0.0.0.255
tells your router to enable the routing protocol on all interfaces that fall within the 1.1.1.1 - 1.1.1.255 IP address range. This results in two things:
- It allows the router to advertise all of the networks of all interfaces that fall within the address range
- It causes those same interfaces to participate in OSPF. That means that those interfaces actively attempt to create OSPF adjacencies by sending out OSPF hello packets.
On the other hand, the redistribute connected
command is used to include the routes of directly connected networks into the routing protocol. This means that all interfaces, regardless of their IP address, will have their directly connected networks included in the routing updates. However, those interfaces won’t actively participate in OSPF (i.e. no hello packets etc). Only their networks will be advertised.
In terms of impact, using the network
command allows for more granular control over which networks are included in the routing protocol. This can be useful in situations where you only want to advertise certain networks. The redistribute connected
command is more of a blanket approach, including all directly connected networks.
The metrics are indeed different because they are used by the routing protocol to determine the best path to a destination. The redistribute connected
command might assign a default metric to the routes it redistributes, which may not always be optimal. Therefore, it’s important to understand the network topology and the routing protocol behavior before deciding which command to use.
More information can be found at this NetworkLessons note on the topic.
I hope this has been helpful!
Laz